org.mule.security
Class SecretKeyEncryptionStrategy

java.lang.Object
  extended by org.mule.security.AbstractNamedEncryptionStrategy
      extended by org.mule.security.AbstractJCEEncryptionStrategy
          extended by org.mule.security.SecretKeyEncryptionStrategy
All Implemented Interfaces:
EncryptionStrategy, Initialisable, NamedObject

public class SecretKeyEncryptionStrategy
extends AbstractJCEEncryptionStrategy

SecretKey based encryption using JCE. Users must specify a key as an array of bytes. This can be set directly on the strategy or a keyFactory can be specified. A keyFactory is an implementation of SecretKeyFactory and must return a byte array. The default algorthm used by this strategy is Blowfish, but users can specify any valid algorithm supported by JCE.

See Also:
SecretKeyFactory

Field Summary
static String DEFAULT_ALGORITHM
           
 
Fields inherited from class org.mule.security.AbstractJCEEncryptionStrategy
algorithm, base64Encoding, decryptCipher, encryptCipher, keySpec, logger, secretKey
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Constructor Summary
SecretKeyEncryptionStrategy()
           
 
Method Summary
protected  AlgorithmParameterSpec createAlgorithmParameterSpec()
           
protected  KeySpec createKeySpec()
           
 SecretKeyFactory getKeyFactory()
           
protected  SecretKey getSecretKey()
           
 void initialise()
          Method used to perform any initialisation work.
 void setKey(byte[] rawKey)
           
 void setKey(String rawKey)
           
 void setKeyFactory(SecretKeyFactory keyFactory)
           
 
Methods inherited from class org.mule.security.AbstractJCEEncryptionStrategy
decrypt, decrypt, encrypt, encrypt, getAlgorithm, isBase64Encoding, setAlgorithm, setBase64Encoding, 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

DEFAULT_ALGORITHM

public static final String DEFAULT_ALGORITHM
See Also:
Constant Field Values
Constructor Detail

SecretKeyEncryptionStrategy

public SecretKeyEncryptionStrategy()
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
Overrides:
initialise in class AbstractJCEEncryptionStrategy
Throws:
InitialisationException - if a fatal error occurs causing the Mule instance to shutdown
RecoverableException - if an error occurs that can be recovered from

createKeySpec

protected KeySpec createKeySpec()
Specified by:
createKeySpec in class AbstractJCEEncryptionStrategy

createAlgorithmParameterSpec

protected AlgorithmParameterSpec createAlgorithmParameterSpec()
Specified by:
createAlgorithmParameterSpec in class AbstractJCEEncryptionStrategy

setKey

public void setKey(byte[] rawKey)

setKey

public void setKey(String rawKey)

getKeyFactory

public SecretKeyFactory getKeyFactory()

setKeyFactory

public void setKeyFactory(SecretKeyFactory keyFactory)

getSecretKey

protected SecretKey getSecretKey()
                          throws GeneralSecurityException
Specified by:
getSecretKey in class AbstractJCEEncryptionStrategy
Throws:
GeneralSecurityException


Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.