org.mule.impl.security
Class AbstractJCEEncryptionStrategy

java.lang.Object
  extended byorg.mule.impl.security.AbstractJCEEncryptionStrategy
All Implemented Interfaces:
Initialisable, UMOEncryptionStrategy
Direct Known Subclasses:
PasswordBasedEncryptionStrategy, SecretKeyEncryptionStrategy

public abstract class AbstractJCEEncryptionStrategy
extends Object
implements UMOEncryptionStrategy

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

Version:
$Revision: 3167 $
Author:
Ross Mason

Field Summary
protected  String algorithm
           
protected  boolean base64Encoding
           
protected  Cipher decryptCipher
           
protected  Cipher encryptCipher
           
protected  KeySpec keySpec
           
protected  org.apache.commons.logging.Log logger
          logger used by this class
protected  SecretKey secretKey
           
 
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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected transient org.apache.commons.logging.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.

Specified by:
initialise in interface Initialisable
Throws:
InitialisationException - if a fatal error occurs causing the Mule instance to shutdown

getSecretKey

protected abstract SecretKey getSecretKey()
                                   throws GeneralSecurityException
Throws:
GeneralSecurityException

encrypt

public byte[] encrypt(byte[] data,
                      Object info)
               throws CryptoFailureException
Specified by:
encrypt in interface UMOEncryptionStrategy
Throws:
CryptoFailureException

decrypt

public byte[] decrypt(byte[] data,
                      Object info)
               throws CryptoFailureException
Specified by:
decrypt in interface UMOEncryptionStrategy
Throws:
CryptoFailureException

getAlgorithm

public String getAlgorithm()

setAlgorithm

public void setAlgorithm(String algorithm)

toString

public String toString()

isBase64Encoding

public boolean isBase64Encoding()

setBase64Encoding

public void setBase64Encoding(boolean base64Encoding)

createKeySpec

protected abstract KeySpec createKeySpec()

createAlgorithmParameterSpec

protected abstract AlgorithmParameterSpec createAlgorithmParameterSpec()


Copyright © 2003-2006 MuleSource Inc.. All Rights Reserved.