org.apache.james.mime4j.storage
Class CipherStorageProvider

java.lang.Object
  extended by org.apache.james.mime4j.storage.AbstractStorageProvider
      extended by org.apache.james.mime4j.storage.CipherStorageProvider
All Implemented Interfaces:
StorageProvider

public class CipherStorageProvider
extends AbstractStorageProvider

A StorageProvider that transparently scrambles and unscrambles the data stored by another StorageProvider.

Example usage:

 StorageProvider mistrusted = new TempFileStorageProvider();
 StorageProvider enciphered = new CipherStorageProvider(mistrusted);
 StorageProvider provider = new ThresholdStorageProvider(enciphered);
 DefaultStorageProvider.setInstance(provider);
 


Constructor Summary
CipherStorageProvider(StorageProvider backend)
          Creates a new CipherStorageProvider for the given back-end using the Blowfish cipher algorithm.
CipherStorageProvider(StorageProvider backend, java.lang.String algorithm)
          Creates a new CipherStorageProvider for the given back-end and cipher algorithm.
 
Method Summary
 StorageOutputStream createStorageOutputStream()
          Creates a StorageOutputStream where data to be stored can be written to.
 
Methods inherited from class org.apache.james.mime4j.storage.AbstractStorageProvider
store
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CipherStorageProvider

public CipherStorageProvider(StorageProvider backend)
Creates a new CipherStorageProvider for the given back-end using the Blowfish cipher algorithm.

Parameters:
backend - back-end storage strategy to encrypt.

CipherStorageProvider

public CipherStorageProvider(StorageProvider backend,
                             java.lang.String algorithm)
Creates a new CipherStorageProvider for the given back-end and cipher algorithm.

Parameters:
backend - back-end storage strategy to encrypt.
algorithm - the name of the symmetric block cipher algorithm such as "Blowfish", "AES" or "RC2".
Method Detail

createStorageOutputStream

public StorageOutputStream createStorageOutputStream()
                                              throws java.io.IOException
Description copied from interface: StorageProvider
Creates a StorageOutputStream where data to be stored can be written to. Subsequently the user can call toStorage() on that object to get a Storage instance that holds the data that has been written.

Returns:
a StorageOutputStream where data can be written to.
Throws:
java.io.IOException - if an I/O error occurs.


Copyright © 2004-2011 The Apache Software Foundation. All Rights Reserved.