CoherenceTM v3.4
Copyright© 2000-2008 by Oracle Corporation

com.tangosol.net.security
Class ClusterEncryptionFilter

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.net.security.ClusterEncryptionFilter
All Implemented Interfaces:
WrapperStreamFactory, XmlConfigurable

public class ClusterEncryptionFilter
extends Base
implements WrapperStreamFactory, XmlConfigurable

Encryption filter implementation which switches between asymmetric and symmetric encryption based upon the type of data being filtered.

Asymmetric encryption is applied to the cluster service data to protect against untrusted entities joining the cluster. Data for other services is encrypted using a random shared symmetric key which is generated by the cluster's senior member and securely provided to other members via the cluster service. Unlike most cluster service traffic the shared secret is encrypted with both the originator's private key and the recipient's public key.

Custom certificate validation may be provided by extending the AsymmetricEncryptionFilter class, and supplying the alternate implementation as part of this filter's configuration.

Author:
mf 2006.08.08
See Also:
setConfig(com.tangosol.run.xml.XmlElement), AsymmetricEncryptionFilter, SymmetricEncryptionFilter

Nested Class Summary
 class ClusterEncryptionFilter.DemultiplexingInputStream
          WrapperInputStram which chooses the appropriate wrapper based on the protocol context.
 class ClusterEncryptionFilter.MultiplexingOutputStream
          WrapperOutputStram which chooses the appropriate wrapper based on the protocol context.
 
Field Summary
protected  int m_nSharedKeySize
          Shared key length.
protected  java.lang.String m_sSharedKeyAlgorithm
          Shared key algorithm.
protected  AsymmetricEncryptionFilter m_wrapperAsymmetric
          The AsymmetricEncryptionFilter
protected  SymmetricEncryptionFilter m_wrapperSymmetric
          The SymmetricEncryptionFilter
 
Constructor Summary
ClusterEncryptionFilter()
           
 
Method Summary
 XmlElement getConfig()
          Determine the current configuration of the object.
 java.io.InputStream getInputStream(java.io.InputStream stream)
          Requests an InputStream that wraps the passed InputStream.
 java.io.OutputStream getOutputStream(java.io.OutputStream stream)
          Requests an OutputStream that wraps the passed OutputStream.
 javax.crypto.SecretKey getSharedKey()
          Return the shared key, or generate one if none exists.
protected  void readSharedKey(java.io.DataInputStream stream)
          Read the shared key from the InputStream.
protected  WrapperStreamFactory selectWrapper(ProtocolContext context)
          Select a Filter based on the supplied protocol information.
 void setConfig(XmlElement xml)
          Configures the ClusterEncryptionfilter.
 void setSharedKey(javax.crypto.SecretKey key)
          Set the shared key.
protected  void writeSharedKey(java.io.DataOutputStream stream, Member memberTo)
          Write the shared cluster secret to the supplied OutputStream.
 

Field Detail

m_sSharedKeyAlgorithm

protected java.lang.String m_sSharedKeyAlgorithm
Shared key algorithm.


m_nSharedKeySize

protected int m_nSharedKeySize
Shared key length.


m_wrapperSymmetric

protected SymmetricEncryptionFilter m_wrapperSymmetric
The SymmetricEncryptionFilter


m_wrapperAsymmetric

protected AsymmetricEncryptionFilter m_wrapperAsymmetric
The AsymmetricEncryptionFilter

Constructor Detail

ClusterEncryptionFilter

public ClusterEncryptionFilter()
Method Detail

selectWrapper

protected WrapperStreamFactory selectWrapper(ProtocolContext context)
Select a Filter based on the supplied protocol information.

Parameters:
context - the protocol context
Returns:
the WrapperStreamFactory to use

readSharedKey

protected void readSharedKey(java.io.DataInputStream stream)
Read the shared key from the InputStream.

Parameters:
stream - the stream to read the secret from

writeSharedKey

protected void writeSharedKey(java.io.DataOutputStream stream,
                              Member memberTo)
Write the shared cluster secret to the supplied OutputStream. The key will be encrypted using the target members public key.

Parameters:
stream - the stream to write the secret to
memberTo - the member to which the key will be sent

getSharedKey

public javax.crypto.SecretKey getSharedKey()
Return the shared key, or generate one if none exists.

Returns:
the shared key

setSharedKey

public void setSharedKey(javax.crypto.SecretKey key)
Set the shared key.

Parameters:
key - the shared key

getInputStream

public java.io.InputStream getInputStream(java.io.InputStream stream)
Requests an InputStream that wraps the passed InputStream.

Specified by:
getInputStream in interface WrapperStreamFactory
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)
Requests an OutputStream that wraps the passed OutputStream.

Specified by:
getOutputStream in interface WrapperStreamFactory
Parameters:
stream - the java.io.OutputStream to be wrapped
Returns:
an OutputStream that delegates to ("wraps") the passed OutputStream

getConfig

public XmlElement getConfig()
Determine the current configuration of the object.

Specified by:
getConfig in interface XmlConfigurable
Returns:
the XML configuration or null

setConfig

public void setConfig(XmlElement xml)
Configures the ClusterEncryptionfilter. This supports the same configuraiton elements as the AsymmetricEncryptionFilter as well as:

Specified by:
setConfig in interface XmlConfigurable
Parameters:
xml - the XML configuration for the object
See Also:
AsymmetricEncryptionFilter.setConfig(com.tangosol.run.xml.XmlElement)

CoherenceTM v3.4
Copyright© 2000-2008 by Oracle Corporation