org.mule.security
Class PasswordBasedEncryptionStrategy

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

public class PasswordBasedEncryptionStrategy
extends AbstractJCEEncryptionStrategy

Provides password-based encryption using JCE. Users must specify a password and optionally a salt and iteration count as well. The default algorithm is PBEWithMD5AndDES, but users can specify any valid algorithm supported by JCE.


Field Summary
static String DEFAULT_ALGORITHM
           
static int DEFAULT_ITERATION_COUNT
           
 
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
PasswordBasedEncryptionStrategy()
           
 
Method Summary
protected  AlgorithmParameterSpec createAlgorithmParameterSpec()
           
protected  KeySpec createKeySpec()
           
 int getIterationCount()
           
 byte[] getSalt()
           
protected  SecretKey getSecretKey()
           
 void initialise()
          Method used to perform any initialisation work.
 void setIterationCount(int iterationCount)
           
 void setPassword(String password)
           
 void setSalt(byte[] salt)
           
 
Methods inherited from class org.mule.security.AbstractJCEEncryptionStrategy
decrypt, 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

DEFAULT_ITERATION_COUNT

public static final int DEFAULT_ITERATION_COUNT
See Also:
Constant Field Values
Constructor Detail

PasswordBasedEncryptionStrategy

public PasswordBasedEncryptionStrategy()
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

getSalt

public byte[] getSalt()

setSalt

public void setSalt(byte[] salt)

getIterationCount

public int getIterationCount()

setIterationCount

public void setIterationCount(int iterationCount)

setPassword

public void setPassword(String password)

getSecretKey

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


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