org.mule.security
Class AbstractJCEEncryptionStrategy
java.lang.Object
org.mule.security.AbstractNamedEncryptionStrategy
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.
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
AbstractJCEEncryptionStrategy
public AbstractJCEEncryptionStrategy()
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.