Interface ICipherFactory
The creation and initialization of Cipher
instances for encryption
and decryption is under control of the client.
The client can choose whatever type of cryptographic cipher he or she
prefers—with a single restriction:
For a WR database the cipher must encrypt data in the unit of a single byte.
(Such a cipher is sometimes called a byte-oriented stream cipher or
a block cipher that is turned into a byte-oriented stream cipher.
See the description of the Cipher
class for details.)
No such restriction exists for an RO database.
Of course, this interface must only be implemented if cryptographic functionality is required at all.
- Author:
- Beat Hörmann
-
Method Summary
Modifier and TypeMethodDescriptionReturns a new cipher instance to be used by ACDP for encrypting/decrypting data in a database.void
initCipher
(Cipher cipher, boolean encrypt) Initializes the specified cipher, earlier created by a call to thecreateCipher()
method.
-
Method Details
-
createCipher
Returns a new cipher instance to be used by ACDP for encrypting/decrypting data in a database.If the database is a WR database then the returned cipher must be a byte-oriented stream cipher or must behave that way. Otherwise the database is an RO database and the returned cipher may be a block cipher encrypting data in units larger than a single byte.
This method may throw various kinds of exceptions depending on the implementation. See the description of the
getInstance
methods of theCipher
class for any details.- Returns:
- The created uninitialized cipher instance, never
null
. - Throws:
Exception
- If creating the cipher fails.
-
initCipher
Initializes the specified cipher, earlier created by a call to thecreateCipher()
method.This method may throw various kinds of exceptions depending on the implementation. See the description of the
init
methods of theCipher
class for any details.- Parameters:
cipher
- The cipher to initialize, not allowed to benull
.encrypt
- Initialize the cipher for encryption (true
) or decryption (false
).- Throws:
Exception
- If initializing the cipher fails.
-