public class CipherStorageProvider extends AbstractStorageProvider
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);
| Modifier and Type | Class and Description |
|---|---|
private static class |
CipherStorageProvider.CipherStorage |
private static class |
CipherStorageProvider.CipherStorageOutputStream |
| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
algorithm |
private StorageProvider |
backend |
private javax.crypto.KeyGenerator |
keygen |
| Constructor and Description |
|---|
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. |
| Modifier and Type | Method and Description |
|---|---|
StorageOutputStream |
createStorageOutputStream()
Creates a
StorageOutputStream where data to be stored can be
written to. |
private javax.crypto.spec.SecretKeySpec |
getSecretKeySpec() |
storeprivate final StorageProvider backend
private final java.lang.String algorithm
private final javax.crypto.KeyGenerator keygen
public CipherStorageProvider(StorageProvider backend)
CipherStorageProvider for the given back-end
using the Blowfish cipher algorithm.backend - back-end storage strategy to encrypt.public CipherStorageProvider(StorageProvider backend, java.lang.String algorithm)
CipherStorageProvider for the given back-end
and cipher algorithm.backend - back-end storage strategy to encrypt.algorithm - the name of the symmetric block cipher algorithm such as
"Blowfish", "AES" or "RC2".public StorageOutputStream createStorageOutputStream() throws java.io.IOException
StorageProviderStorageOutputStream 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.StorageOutputStream where data can be written to.java.io.IOException - if an I/O error occurs.private javax.crypto.spec.SecretKeySpec getSecretKeySpec()