org.alfresco.deployment.transformers
Class SampleEncryptionTransformer

java.lang.Object
  extended by org.alfresco.deployment.transformers.SampleEncryptionTransformer
All Implemented Interfaces:
DeploymentTransportInputFilter, DeploymentTransportOutputFilter

public class SampleEncryptionTransformer
extends java.lang.Object
implements DeploymentTransportInputFilter, DeploymentTransportOutputFilter

Sample payload transformer for the File System Receiver (FSR). Encrypts the contents of the file being transmitted over the wire to a File System Receiver. The intention of this class is to be simple sample code rather than being highly secure. In particular this class uses password based encryption via a symetric key rather than a more secure (and complex) key strategy. The password will be held in plain text in the spring configuration files. Nevertheless this class will give some protection against network snooping. Enabling TripleDES requires "unlimited strength policy files" for that algorithm to be available in a Sun JVM.

See Also:
javax.crypto

Constructor Summary
SampleEncryptionTransformer()
           
 
Method Summary
 java.io.InputStream addFilter(java.io.InputStream in, java.lang.String path, java.lang.String mimeType, java.lang.String encoding)
          Decrypts inbound stream,
 java.io.OutputStream addFilter(java.io.OutputStream out, java.lang.String path, java.lang.String mimeType, java.lang.String encoding)
          Encrypted outgoing stream
 java.lang.String getCipherName()
           
 int getIterationCount()
           
 java.lang.String getPassword()
           
 void setCipherName(java.lang.String cipherName)
          The name of the cipher to use such as "PBEWithMD5AndDES".
 void setIterationCount(int iterationCount)
           
 void setPassword(java.lang.String password)
          Sets the password
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SampleEncryptionTransformer

public SampleEncryptionTransformer()
Method Detail

addFilter

public java.io.OutputStream addFilter(java.io.OutputStream out,
                                      java.lang.String path,
                                      java.lang.String mimeType,
                                      java.lang.String encoding)
Encrypted outgoing stream

Specified by:
addFilter in interface DeploymentTransportOutputFilter
Parameters:
out - the stream to encrypt
path - the path of the file to encrypt
mimeType - the encoding of the file
encoding - the mimeType of the file
Returns:
the filtered output stream

addFilter

public java.io.InputStream addFilter(java.io.InputStream in,
                                     java.lang.String path,
                                     java.lang.String mimeType,
                                     java.lang.String encoding)
Decrypts inbound stream,

Specified by:
addFilter in interface DeploymentTransportInputFilter
Parameters:
out - the stream to decrypt
path - the path of the file to decrypt
Returns:
the filtered input stream

setCipherName

public void setCipherName(java.lang.String cipherName)
The name of the cipher to use such as "PBEWithMD5AndDES".

Parameters:
cipherName - the name of the cipher to use

getCipherName

public java.lang.String getCipherName()

setPassword

public void setPassword(java.lang.String password)
Sets the password

Parameters:
password - the password used to generate a key

getPassword

public java.lang.String getPassword()

setIterationCount

public void setIterationCount(int iterationCount)

getIterationCount

public int getIterationCount()


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.