A Cascade Cipher is the concatenation of two or more block ciphers
each with independent keys. Plaintext is input to the first stage; the
output stage i is input to stage i + 1; and the output
of the last stage is the Cascade's ciphertext output.
In the simplest case, all stages in a Cascade have k-bit keys, and the stage inputs and outputs are all n-bit quantities. The stage ciphers may differ (general cascade of ciphers), or all be identical (cascade of identical ciphers).
The term block ciphers used above refers to implementations of
gnu.crypto.mode.IMode, including the gnu.crypto.mode.ECB
mode which basically exposes a symmetric-key block cipher algorithm as
a Mode of Operations.
The name of a property in the attributes map that is passed to the
initmethod, representing the cascade's desired wiring direction. The mapped value should be a validgnu.crypto.assembly.Directionvalue. If this attribute is omitted,gnu.crypto.assembly.Direction.FORWARDis used.
Adds to the end of the current chain, a designated stage. Returns a unique identifier for this added stage, within this cascade. An
IllegalArgumentExceptionis thrown if stage is already in the chain, or it has incompatible characteristics with the current elements already in the chain. On the other hand, anIllegalStateExceptionwill be thrown if the cascade has already been initialized, or if the designated stage is null.
Adds to the beginning of the current chain, a designated stage. Returns a unique identifier for this added stage, within this cascade. An
IllegalArgumentExceptionis thrown if stage is already in the chain, or it has incompatible characteristics with the current elements already in the chain. On the other hand, anIllegalStateExceptionwill be thrown if the cascade has already been initialized, or if the designated stage is null.
Inserts a designate stage Stage into the current Cascade, at the specified index (zero-based) position. Returns a unique identifier for this added stage, within this cascade. Throws an
IllegalArgumentExceptionif stage is already in the chain, or it has incompatible characteristics with the current elements already in the chain. Throws anIllegalStateExceptionif the instance is already initialized. Finally, this method throws anIndexOutOfBoundsExceptionif index is less than0or greater than the current size of this cascade.
Returns an
java.util.Iteratorover the stages contained in this instance. Each element of this iterator is a concrete implementation of agnu.crypto.assembly.Stage.
Returns a
java.util.Setof supported block sizes for this Cascade that are common to all of its chained stages. Each element in the returned set is an instance ofInteger.
Initializes the chain for operation with specific characteristics, as specified by the contents of attributes –a set of name-value pairs that describes the desired future behavior of this instance. Throws an
IllegalStateExceptionif the chain, or any of its stages, is already initialized. Throws anInvalidKeyExceptionif the initialization data provided with the stage is incorrect or causes an invalid key to be generated.
Returns the currently set block size for the chain. Throws an
IllegalStateExceptionif the instance is not yet initialized.
Resets the chain for re-initialization and use with other characteristics. This method always succeeds.
Processes exactly one block of plaintext (if initialized in the
gnu.crypto.assembly.Direction#FORWARDdirection) or ciphertext (if initialised in thegnu.crypto.assembly.Direction#REVERSEDdirection), from in, starting at index position inOffset, returning the result in out, starting at index position outOffset. Throws anIllegalStateExceptionif the instance is not yet initialized.
Conducts a simple correctness test that consists of basic symmetric encryption / decryption test(s) for all supported block and key sizes of underlying block cipher(s) wrapped by Mode leafs. The test also includes one (1) variable key Known Answer Test (KAT) for each block cipher. Returns
trueif the implementation passes the tests. Returnsfalseotherwise.