cgl.narada.service.security.impl
Class EntityOperationsImpl

java.lang.Object
  extended by cgl.narada.service.security.impl.EntityOperationsImpl
All Implemented Interfaces:
EntityOperations

public class EntityOperationsImpl
extends Object
implements EntityOperations

This interface encapsulates the set of operations that need to be performed to ensure secure messaging. $Date$ $Revision$


Field Summary
 Hashtable providers
           
static String providerToUse
           
static String str
           
 
Constructor Summary
EntityOperationsImpl()
           
 
Method Summary
 byte[] decryptPayload(PrivateKey privateTopicKey, byte[] encryptedBytes)
           
 byte[] decryptPayload(PrivateKey privateTopicKey, String mode, String padding, byte[] encryptedBytes)
           
 byte[] decryptPayload(PrivateKey privateTopicKey, String mode, String padding, String provider, byte[] encryptedBytes)
           
 byte[] decryptPayload(SecretKey secretTopicKey, byte[] encryptedBytes)
           
 byte[] decryptPayload(SecretKey secretTopicKey, byte[] encryptedBytes, String algModePadding, byte[] iv, String provider)
           
 byte[] decryptPayload(SecretKey secretTopicKey, String mode, String padding, byte[] encryptedPayloadBytes, byte[] iv)
           
 byte[] decryptPayload(SecretKey secretTopicKey, String mode, String padding, String provider, byte[] encryptedPayloadBytes, byte[] iv)
           
 byte[] encryptPayload(PublicKey publicTopicKey, byte[] messageBytes)
           
 byte[] encryptPayload(PublicKey publicTopicKey, String mode, String padding, byte[] payloadBytes)
           
 byte[] encryptPayload(PublicKey publicTopicKey, String mode, String padding, String provider, byte[] payloadBytes)
           
 byte[] encryptPayload(SecretKey secretTopicKey, byte[] messageBytes)
           
 byte[] encryptPayload(SecretKey secretTopicKey, byte[] messageBytes, String algModePadding, byte[] iv, String provider)
           
 byte[] encryptPayload(SecretKey secretTopicKey, String mode, String padding, byte[] payloadBytes, byte[] iv)
           
 byte[] encryptPayload(SecretKey secretTopicKey, String mode, String padding, String provider, byte[] payloadBytes, byte[] iv)
           
 byte[] generateMessageDigest(byte[] encryptedMessage, String algorithm)
          Generate a message digest for the message
 byte[] generateMessageDigest(String algorithm, String provider, byte[] encryptedPayload)
          Generate a message digest for the message
 byte[] getIV(SecretKey secretTopicKey, String mode, String padding)
           
 byte[] getIV(SecretKey secretTopicKey, String mode, String padding, String provider)
           
 byte[] getIV(String alg, String mode, String padding)
           
static void main(String[] args)
           
 byte[] signPayload(byte[] message, PrivateKey personalPrivateKey)
          Method to sign a message with the entity's personal private key
 byte[] signPayload(byte[] payload, PrivateKey personalPrivateKey, String algorithm)
          Method to sign a message with the entity's personal private key
 byte[] signPayload(PrivateKey personalPrivateKey, String algorithm, String provider, byte[] payload)
          Method to sign a message with the entity's personal private key
 void testOpsOnPayload(SecretKey secretTopicKey, byte[] messageBytes, String mode, String padding, String provider)
           
 boolean validateMessageDigest(byte[] originalDigest, byte[] encryptedMessage, String algorithm)
          Check the message integrity
 boolean validateMessageDigest(String algorithm, String provider, byte[] encryptedPayload, byte[] originalDigest)
          Check the message integrity
 boolean validateSAMLAssertion(String assertion)
          Validates the assertion speficied in the message
 boolean validateSignature(byte[] signatureBytes, byte[] message, PublicKey publisherPublicKey)
          Validates the signature associated with an encrypted message to confirm whether the message has been tampered with and also to check if the publisher is an authorized one
 boolean validateSignature(byte[] payload, byte[] signatureBytes, PublicKey publisherPublicKey, String algorithm)
          Validates the signature associated with an encrypted message to confirm whether the message has been tampered with and also to check if the publisher is an authorized one
 boolean validateSignature(PublicKey publisherPublicKey, String algorithm, String provider, byte[] payload, byte[] signatureBytes)
          Validates the signature associated with an encrypted message to confirm whether the message has been tampered with and also to check if the publisher is an authorized one
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

providers

public Hashtable providers

str

public static String str

providerToUse

public static String providerToUse
Constructor Detail

EntityOperationsImpl

public EntityOperationsImpl()
                     throws ServiceException
Throws:
ServiceException
Method Detail

getIV

public byte[] getIV(String alg,
                    String mode,
                    String padding)
             throws ServiceException
Throws:
ServiceException

encryptPayload

public byte[] encryptPayload(SecretKey secretTopicKey,
                             byte[] messageBytes,
                             String algModePadding,
                             byte[] iv,
                             String provider)
                      throws ServiceException
Throws:
ServiceException

decryptPayload

public byte[] decryptPayload(SecretKey secretTopicKey,
                             byte[] encryptedBytes,
                             String algModePadding,
                             byte[] iv,
                             String provider)
                      throws ServiceException
Throws:
ServiceException

encryptPayload

public byte[] encryptPayload(PublicKey publicTopicKey,
                             byte[] messageBytes)
                      throws ServiceException
Throws:
ServiceException

decryptPayload

public byte[] decryptPayload(PrivateKey privateTopicKey,
                             byte[] encryptedBytes)
                      throws ServiceException
Throws:
ServiceException

encryptPayload

public byte[] encryptPayload(PublicKey publicTopicKey,
                             String mode,
                             String padding,
                             byte[] payloadBytes)
                      throws ServiceException
Throws:
ServiceException

encryptPayload

public byte[] encryptPayload(PublicKey publicTopicKey,
                             String mode,
                             String padding,
                             String provider,
                             byte[] payloadBytes)
                      throws ServiceException
Throws:
ServiceException

decryptPayload

public byte[] decryptPayload(PrivateKey privateTopicKey,
                             String mode,
                             String padding,
                             byte[] encryptedBytes)
                      throws ServiceException
Throws:
ServiceException

decryptPayload

public byte[] decryptPayload(PrivateKey privateTopicKey,
                             String mode,
                             String padding,
                             String provider,
                             byte[] encryptedBytes)
                      throws ServiceException
Throws:
ServiceException

encryptPayload

public byte[] encryptPayload(SecretKey secretTopicKey,
                             byte[] messageBytes)
                      throws ServiceException
Specified by:
encryptPayload in interface EntityOperations
Throws:
ServiceException

decryptPayload

public byte[] decryptPayload(SecretKey secretTopicKey,
                             byte[] encryptedBytes)
                      throws ServiceException
Specified by:
decryptPayload in interface EntityOperations
Throws:
ServiceException

getIV

public byte[] getIV(SecretKey secretTopicKey,
                    String mode,
                    String padding)
             throws ServiceException
Throws:
ServiceException

getIV

public byte[] getIV(SecretKey secretTopicKey,
                    String mode,
                    String padding,
                    String provider)
             throws ServiceException
Throws:
ServiceException

encryptPayload

public byte[] encryptPayload(SecretKey secretTopicKey,
                             String mode,
                             String padding,
                             byte[] payloadBytes,
                             byte[] iv)
                      throws ServiceException
Throws:
ServiceException

encryptPayload

public byte[] encryptPayload(SecretKey secretTopicKey,
                             String mode,
                             String padding,
                             String provider,
                             byte[] payloadBytes,
                             byte[] iv)
                      throws ServiceException
Throws:
ServiceException

decryptPayload

public byte[] decryptPayload(SecretKey secretTopicKey,
                             String mode,
                             String padding,
                             byte[] encryptedPayloadBytes,
                             byte[] iv)
                      throws ServiceException
Throws:
ServiceException

decryptPayload

public byte[] decryptPayload(SecretKey secretTopicKey,
                             String mode,
                             String padding,
                             String provider,
                             byte[] encryptedPayloadBytes,
                             byte[] iv)
                      throws ServiceException
Throws:
ServiceException

testOpsOnPayload

public void testOpsOnPayload(SecretKey secretTopicKey,
                             byte[] messageBytes,
                             String mode,
                             String padding,
                             String provider)
                      throws ServiceException
Throws:
ServiceException

signPayload

public byte[] signPayload(byte[] message,
                          PrivateKey personalPrivateKey)
                   throws ServiceException
Method to sign a message with the entity's personal private key

Specified by:
signPayload in interface EntityOperations
Throws:
ServiceException

validateSignature

public boolean validateSignature(byte[] signatureBytes,
                                 byte[] message,
                                 PublicKey publisherPublicKey)
                          throws ServiceException
Validates the signature associated with an encrypted message to confirm whether the message has been tampered with and also to check if the publisher is an authorized one

Specified by:
validateSignature in interface EntityOperations
Throws:
ServiceException

signPayload

public byte[] signPayload(byte[] payload,
                          PrivateKey personalPrivateKey,
                          String algorithm)
                   throws ServiceException
Method to sign a message with the entity's personal private key

Throws:
ServiceException

signPayload

public byte[] signPayload(PrivateKey personalPrivateKey,
                          String algorithm,
                          String provider,
                          byte[] payload)
                   throws ServiceException
Method to sign a message with the entity's personal private key

Throws:
ServiceException

validateSignature

public boolean validateSignature(byte[] payload,
                                 byte[] signatureBytes,
                                 PublicKey publisherPublicKey,
                                 String algorithm)
                          throws ServiceException
Validates the signature associated with an encrypted message to confirm whether the message has been tampered with and also to check if the publisher is an authorized one

Throws:
ServiceException

validateSignature

public boolean validateSignature(PublicKey publisherPublicKey,
                                 String algorithm,
                                 String provider,
                                 byte[] payload,
                                 byte[] signatureBytes)
                          throws ServiceException
Validates the signature associated with an encrypted message to confirm whether the message has been tampered with and also to check if the publisher is an authorized one

Throws:
ServiceException

generateMessageDigest

public byte[] generateMessageDigest(byte[] encryptedMessage,
                                    String algorithm)
                             throws ServiceException
Generate a message digest for the message

Specified by:
generateMessageDigest in interface EntityOperations
Throws:
ServiceException

validateMessageDigest

public boolean validateMessageDigest(byte[] originalDigest,
                                     byte[] encryptedMessage,
                                     String algorithm)
                              throws ServiceException
Check the message integrity

Specified by:
validateMessageDigest in interface EntityOperations
Throws:
ServiceException

generateMessageDigest

public byte[] generateMessageDigest(String algorithm,
                                    String provider,
                                    byte[] encryptedPayload)
                             throws ServiceException
Generate a message digest for the message

Throws:
ServiceException

validateMessageDigest

public boolean validateMessageDigest(String algorithm,
                                     String provider,
                                     byte[] encryptedPayload,
                                     byte[] originalDigest)
                              throws ServiceException
Check the message integrity

Throws:
ServiceException

validateSAMLAssertion

public boolean validateSAMLAssertion(String assertion)
Validates the assertion speficied in the message

Specified by:
validateSAMLAssertion in interface EntityOperations

main

public static void main(String[] args)


For comments and suggestions please send e-mail to The NaradaBrokering Project