Package org.apache.james.mime4j.storage
Class CipherStorageProvider
- java.lang.Object
-
- org.apache.james.mime4j.storage.AbstractStorageProvider
-
- org.apache.james.mime4j.storage.CipherStorageProvider
-
- All Implemented Interfaces:
StorageProvider
public class CipherStorageProvider extends AbstractStorageProvider
AStorageProviderthat transparently scrambles and unscrambles the data stored by anotherStorageProvider.Example usage:
StorageProvider mistrusted = new TempFileStorageProvider(); StorageProvider enciphered = new CipherStorageProvider(mistrusted); StorageProvider provider = new ThresholdStorageProvider(enciphered); DefaultStorageProvider.setInstance(provider);
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classCipherStorageProvider.CipherStorageprivate static classCipherStorageProvider.CipherStorageOutputStream
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringalgorithmprivate StorageProviderbackendprivate javax.crypto.KeyGeneratorkeygen
-
Constructor Summary
Constructors Constructor Description CipherStorageProvider(StorageProvider backend)Creates a newCipherStorageProviderfor the given back-end using the Blowfish cipher algorithm.CipherStorageProvider(StorageProvider backend, java.lang.String algorithm)Creates a newCipherStorageProviderfor the given back-end and cipher algorithm.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StorageOutputStreamcreateStorageOutputStream()Creates aStorageOutputStreamwhere data to be stored can be written to.private javax.crypto.spec.SecretKeySpecgetSecretKeySpec()-
Methods inherited from class org.apache.james.mime4j.storage.AbstractStorageProvider
store
-
-
-
-
Field Detail
-
backend
private final StorageProvider backend
-
algorithm
private final java.lang.String algorithm
-
keygen
private final javax.crypto.KeyGenerator keygen
-
-
Constructor Detail
-
CipherStorageProvider
public CipherStorageProvider(StorageProvider backend)
Creates a newCipherStorageProviderfor 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 newCipherStorageProviderfor 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:StorageProviderCreates aStorageOutputStreamwhere data to be stored can be written to. Subsequently the user can calltoStorage()on that object to get aStorageinstance that holds the data that has been written.- Returns:
- a
StorageOutputStreamwhere data can be written to. - Throws:
java.io.IOException- if an I/O error occurs.
-
getSecretKeySpec
private javax.crypto.spec.SecretKeySpec getSecretKeySpec()
-
-