org.mule.security
Class AbstractJCEEncryptionStrategy

java.lang.Object
  extended by org.mule.security.AbstractNamedEncryptionStrategy
      extended by org.mule.security.AbstractJCEEncryptionStrategy
All Implemented Interfaces:
EncryptionStrategy, Initialisable
Direct Known Subclasses:
PasswordBasedEncryptionStrategy, SecretKeyEncryptionStrategy

public abstract class AbstractJCEEncryptionStrategy
extends AbstractNamedEncryptionStrategy

A JCE based encryption strategy. It also provides base64 encoding of encrypted/decrypted data by setting the base64encoding attribute.


Field Summary
protected  String algorithm
           
protected  boolean base64Encoding
           
protected  Cipher decryptCipher
           
protected  Cipher encryptCipher
           
protected  KeySpec keySpec
           
protected  Log logger
          logger used by this class
protected  SecretKey secretKey
           
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Constructor Summary
AbstractJCEEncryptionStrategy()
           
 
Method Summary
protected abstract  AlgorithmParameterSpec createAlgorithmParameterSpec()
           
protected abstract  KeySpec createKeySpec()
           
 byte[] decrypt(byte[] data, Object info)
           
 byte[] encrypt(byte[] data, Object info)
           
 String getAlgorithm()
           
protected abstract  SecretKey getSecretKey()
           
 void initialise()
          Method used to perform any initialisation work.
 boolean isBase64Encoding()
           
 void setAlgorithm(String algorithm)
           
 void setBase64Encoding(boolean base64Encoding)
           
 String toString()
           
 
Methods inherited from class org.mule.security.AbstractNamedEncryptionStrategy
getName, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected transient Log logger
logger used by this class


keySpec

protected KeySpec keySpec

secretKey

protected SecretKey secretKey

encryptCipher

protected Cipher encryptCipher

decryptCipher

protected Cipher decryptCipher

algorithm

protected String algorithm

base64Encoding

protected boolean base64Encoding
Constructor Detail

AbstractJCEEncryptionStrategy

public AbstractJCEEncryptionStrategy()
Method Detail

initialise

public void initialise()
                throws InitialisationException
Description copied from interface: Initialisable
Method used to perform any initialisation work. If a fatal error occurs during initialisation an InitialisationException should be thrown, causing the Mule instance to shutdown. If the error is recoverable, say by retrying to connect, a RecoverableException should be thrown. There is no guarantee that by throwing a Recoverable exception that the Mule instance will not shut down.

Throws:
InitialisationException - if a fatal error occurs causing the Mule instance to shutdown
RecoverableException - if an error occurs that can be recovered from

getSecretKey

protected abstract SecretKey getSecretKey()
                                   throws GeneralSecurityException
Throws:
GeneralSecurityException

encrypt

public byte[] encrypt(byte[] data,
                      Object info)
               throws CryptoFailureException
Throws:
CryptoFailureException

decrypt

public byte[] decrypt(byte[] data,
                      Object info)
               throws CryptoFailureException
Throws:
CryptoFailureException

getAlgorithm

public String getAlgorithm()

setAlgorithm

public void setAlgorithm(String algorithm)

toString

public String toString()
Overrides:
toString in class Object

isBase64Encoding

public boolean isBase64Encoding()

setBase64Encoding

public void setBase64Encoding(boolean base64Encoding)

createKeySpec

protected abstract KeySpec createKeySpec()

createAlgorithmParameterSpec

protected abstract AlgorithmParameterSpec createAlgorithmParameterSpec()


Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.