CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation

com.tangosol.net.security
Class SymmetricEncryptionFilter

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.net.security.AbstractEncryptionFilter
          extended by com.tangosol.net.security.SymmetricEncryptionFilter
All Implemented Interfaces:
WrapperStreamFactory, XmlConfigurable
Direct Known Subclasses:
PasswordBasedEncryptionFilter

public class SymmetricEncryptionFilter
extends AbstractEncryptionFilter

Symmetric encryption filter implementation.

This filter encrypts data using a shared symmetric encryption key. It may either be configured with a pre-distributed shared key, or with a randomly generated key via the ClusterEncryptionFilter.

Author:
mf 2006.07.31
See Also:
setConfig(com.tangosol.run.xml.XmlElement), ClusterEncryptionFilter

Field Summary
static String DEFAULT_ALGORITHM
          Default cryptography algorithm
static int DEFAULT_KEY_LENGTH
          Default cryptography key length
static String DEFAULT_KEYSTORE_TYPE
          Default KeyStore type.
protected  SecretKey m_key
          The SecretKey
 
Fields inherited from class com.tangosol.net.security.AbstractEncryptionFilter
DEFAULT_KEYSTORE_PATH, m_specCipherParams, m_sTransformation, m_tlsCipher
 
Constructor Summary
SymmetricEncryptionFilter()
           
 
Method Summary
static SecretKey generateKey(String sAlgorithm, int nKeySize)
          Generate a secret key according the the supplied parameters.
 InputStream getInputStream(InputStream stream)
          Requests an InputStream that wraps the passed InputStream.
 SecretKey getKey()
          Return the filter's encryption key.
 OutputStream getOutputStream(OutputStream stream)
          Requests an OutputStream that wraps the passed OutputStream.
static void main(String[] asArgv)
          Generates and insert a symmetric key into a keystore.
 void setConfig(XmlElement xml)
          Configures the Encryption filter for symetric encryption using a key from a KeyStore.
 void setKey(SecretKey key)
          Specify the filter's encryption key.
 
Methods inherited from class com.tangosol.net.security.AbstractEncryptionFilter
ensureSecurityException, ensureSecurityException, getCipher, getCipherParams, getCipherTransformation, getConfig, getKeyStore, makeCipher, setCipherParams, setCipherTransformation
 

Field Detail

m_key

protected SecretKey m_key
The SecretKey


DEFAULT_KEYSTORE_TYPE

public static final String DEFAULT_KEYSTORE_TYPE
Default KeyStore type. JCEKS is used over JKS as it supports storage of symetric keys.

See Also:
Constant Field Values

DEFAULT_ALGORITHM

public static final String DEFAULT_ALGORITHM
Default cryptography algorithm

See Also:
Constant Field Values

DEFAULT_KEY_LENGTH

public static final int DEFAULT_KEY_LENGTH
Default cryptography key length

See Also:
Constant Field Values
Constructor Detail

SymmetricEncryptionFilter

public SymmetricEncryptionFilter()
Method Detail

getInputStream

public InputStream getInputStream(InputStream stream)
Description copied from interface: WrapperStreamFactory
Requests an InputStream that wraps the passed InputStream.

Parameters:
stream - the java.io.InputStream to be wrapped
Returns:
an InputStream that delegates to ("wraps") the passed InputStream

getOutputStream

public OutputStream getOutputStream(OutputStream stream)
Description copied from interface: WrapperStreamFactory
Requests an OutputStream that wraps the passed OutputStream.

Parameters:
stream - the java.io.OutputStream to be wrapped
Returns:
an OutputStream that delegates to ("wraps") the passed OutputStream

setConfig

public void setConfig(XmlElement xml)
Configures the Encryption filter for symetric encryption using a key from a KeyStore. Supported configuration parameters include:

Parameters:
xml - the XML configuration for the object

setKey

public void setKey(SecretKey key)
Specify the filter's encryption key.

Parameters:
key - the filter's encryption key

getKey

public SecretKey getKey()
Return the filter's encryption key.

Returns:
the filter's encryption key

generateKey

public static SecretKey generateKey(String sAlgorithm,
                                    int nKeySize)
Generate a secret key according the the supplied parameters.

Parameters:
sAlgorithm - the key algorithm
nKeySize - the key size
Returns:
the secret key

main

public static void main(String[] asArgv)
Generates and insert a symmetric key into a keystore.

This utility is provided as the keytool utility distributed with the JDK only supports asymmetric keys.

Parameters:
asArgv - command line parameters

CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation