Skip navigation links

Oracle® Coherence Java API Reference
v3.5.1

E15583-01


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. <p/> 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 java.lang.String DEFAULT_ALGORITHM
          Default cryptography algorithm
static int DEFAULT_KEY_LENGTH
          Default cryptography key length
static java.lang.String DEFAULT_KEYSTORE_TYPE
          Default KeyStore type.
protected  javax.crypto.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 javax.crypto.SecretKey generateKey(java.lang.String sAlgorithm, int nKeySize)
          Generate a secret key according the the supplied parameters.
 java.io.InputStream getInputStream(java.io.InputStream stream)
          Requests an InputStream that wraps the passed InputStream.
 javax.crypto.SecretKey getKey()
          Return the filter's encryption key.
 java.io.OutputStream getOutputStream(java.io.OutputStream stream)
          Requests an OutputStream that wraps the passed OutputStream.
static void main(java.lang.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(javax.crypto.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 javax.crypto.SecretKey m_key
The SecretKey

DEFAULT_KEYSTORE_TYPE

public static final java.lang.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 java.lang.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 java.io.InputStream getInputStream(java.io.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 java.io.OutputStream getOutputStream(java.io.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:
<li/> keyAlias - (required) the alias to use in reading the key from the keystore <li/> keyPassword - (required) the password to use in reading the key <li/> transformation - the cipher algorithm/mode/padding, defaults to key's algorithm and cipher provider defaults <li/> storeType - the type of KeyStore, defaults to JCEKS <li/> store - the URL of the KeyStore, defaults to .keystore <li/> storePassword - the password to use to access the store, defaults to keyPassword
Parameters:
xml - the XML configuration for the object

setKey

public void setKey(javax.crypto.SecretKey key)
Specify the filter's encryption key.
Parameters:
key - the filter's encryption key

getKey

public javax.crypto.SecretKey getKey()
Return the filter's encryption key.
Returns:
the filter's encryption key

generateKey

public static javax.crypto.SecretKey generateKey(java.lang.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(java.lang.String[] asArgv)
Generates and insert a symmetric key into a keystore. <p/> This utility is provided as the keytool utility distributed with the JDK only supports asymmetric keys.
Parameters:
asArgv - command line parameters

Skip navigation links

Oracle® Coherence Java API Reference
v3.5.1

E15583-01


Copyright © 2000, 2009, Oracle. All rights reserved.