Interface CryptoModule
-
- All Known Implementing Classes:
DefaultCryptoModule
public interface CryptoModule
Classes that obey this interface may be used to provide encrypting and decrypting streams to the rest of Accumulo. Classes that obey this interface may be configured as the crypto module by setting the property crypto.module.class in the accumulo-site.xml file.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CryptoModuleParameters
generateNewRandomSessionKey(CryptoModuleParameters params)
Generates a random session key and sets it into theCryptoModuleParameters.getPlaintextKey()
property.CryptoModuleParameters
getDecryptingInputStream(CryptoModuleParameters params)
CryptoModuleParameters
getEncryptingOutputStream(CryptoModuleParameters params)
Takes aCryptoModuleParameters
object containing anOutputStream
to wrap within aCipherOutputStream
.CryptoModuleParameters
initializeCipher(CryptoModuleParameters params)
Generates aCipher
object based on the parameters in the givenCryptoModuleParameters
object and places it into theCryptoModuleParameters.getCipher()
property.
-
-
-
Method Detail
-
getEncryptingOutputStream
CryptoModuleParameters getEncryptingOutputStream(CryptoModuleParameters params) throws IOException
Takes aCryptoModuleParameters
object containing anOutputStream
to wrap within aCipherOutputStream
. The various other parts of theCryptoModuleParameters
object specify the details about the type of encryption to use. Callers should pay special attention to theCryptoModuleParameters.getRecordParametersToStream()
andCryptoModuleParameters.getCloseUnderylingStreamAfterCryptoStreamClose()
flags within theCryptoModuleParameters
object, as they control whether or not this method will write to the givenOutputStream
inCryptoModuleParameters.getPlaintextOutputStream()
.This method returns a
CryptoModuleParameters
object. Implementers of this interface maintain a contract that the returned object is the same as the one passed in, always. Return values are enclosed within that object, as some other calls will typically return more than one value.- Parameters:
params
- theCryptoModuleParameters
object that specifies how to set up the encrypted stream.- Returns:
- the same
CryptoModuleParameters
object with theCryptoModuleParameters.getEncryptedOutputStream()
set to a stream that is not null. That stream may be exactly the same stream asCryptoModuleParameters.getPlaintextInputStream()
if the params object specifies no cryptography. - Throws:
IOException
-
getDecryptingInputStream
CryptoModuleParameters getDecryptingInputStream(CryptoModuleParameters params) throws IOException
Takes aCryptoModuleParameters
object containing anInputStream
to wrap within aCipherInputStream
. The various other parts of theCryptoModuleParameters
object specify the details about the type of encryption to use. Callers should pay special attention to theCryptoModuleParameters.getRecordParametersToStream()
andCryptoModuleParameters.getCloseUnderylingStreamAfterCryptoStreamClose()
flags within theCryptoModuleParameters
object, as they control whether or not this method will read from the givenInputStream
inCryptoModuleParameters.getEncryptedInputStream()
.This method returns a
CryptoModuleParameters
object. Implementers of this interface maintain a contract that the returned object is the same as the one passed in, always. Return values are enclosed within that object, as some other calls will typically return more than one value.- Parameters:
params
- theCryptoModuleParameters
object that specifies how to set up the encrypted stream.- Returns:
- the same
CryptoModuleParameters
object with theCryptoModuleParameters.getPlaintextInputStream()
set to a stream that is not null. That stream may be exactly the same stream asCryptoModuleParameters.getEncryptedInputStream()
if the params object specifies no cryptography. - Throws:
IOException
-
generateNewRandomSessionKey
CryptoModuleParameters generateNewRandomSessionKey(CryptoModuleParameters params)
Generates a random session key and sets it into theCryptoModuleParameters.getPlaintextKey()
property. Saves callers from having to set up their own secure random provider. Also will set theCryptoModuleParameters.getSecureRandom()
property if it has not already been set by some other function.- Parameters:
params
- aCryptoModuleParameters
object contained a correctly instantiated set of properties.- Returns:
- the same
CryptoModuleParameters
object with the plaintext key set
-
initializeCipher
CryptoModuleParameters initializeCipher(CryptoModuleParameters params)
Generates aCipher
object based on the parameters in the givenCryptoModuleParameters
object and places it into theCryptoModuleParameters.getCipher()
property. Callers may choose to use this method if they want to get the initialization vector from the cipher before proceeding to create wrapped streams.- Parameters:
params
- aCryptoModuleParameters
object contained a correctly instantiated set of properties.- Returns:
- the same
CryptoModuleParameters
object with the cipher set.
-
-