Node:Cascade, Next:, Previous:Stage, Up:Cascades



Cascade

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.

String DIRECTION Variable
The name of a property in the attributes map that is passed to the init method, representing the cascade's desired wiring direction. The mapped value should be a valid gnu.crypto.assembly.Direction value. If this attribute is omitted, gnu.crypto.assembly.Direction.FORWARD is used.

Object append (Stage stage) throws IllegalArgumentException Function
Adds to the end of the current chain, a designated stage. Returns a unique identifier for this added stage, within this cascade. An IllegalArgumentException is 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, an IllegalStateException will be thrown if the cascade has already been initialized, or if the designated stage is null.

Object prepend (Stage stage) throws IllegalArgumentException Function
Adds to the beginning of the current chain, a designated stage. Returns a unique identifier for this added stage, within this cascade. An IllegalArgumentException is 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, an IllegalStateException will be thrown if the cascade has already been initialized, or if the designated stage is null.

Object insert (int index, Stage stage) throws IllegalArgumentException, IndexOutOfBoundsException Function
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 IllegalArgumentException if stage is already in the chain, or it has incompatible characteristics with the current elements already in the chain. Throws an IllegalStateException if the instance is already initialized. Finally, this method throws an IndexOutOfBoundsException if index is less than 0 or greater than the current size of this cascade.

int size () Function
Returns the current number of stages in this chain.

java.util.Iterator stages () Function
Returns an java.util.Iterator over the stages contained in this instance. Each element of this iterator is a concrete implementation of a gnu.crypto.assembly.Stage.

java.util.Set blockSizes () Function
Returns a java.util.Set of supported block sizes for this Cascade that are common to all of its chained stages. Each element in the returned set is an instance of Integer.

void init (java.util.Map attributes) throws InvalidKeyException Function
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 IllegalStateException if the chain, or any of its stages, is already initialized. Throws an InvalidKeyException if the initialization data provided with the stage is incorrect or causes an invalid key to be generated.

int currentBlockSize () Function
Returns the currently set block size for the chain. Throws an IllegalStateException if the instance is not yet initialized.

void reset () Function
Resets the chain for re-initialization and use with other characteristics. This method always succeeds.

void update (byte[] in, int inOffset, byte[] out, int outOffset) Function
Processes exactly one block of plaintext (if initialized in the gnu.crypto.assembly.Direction#FORWARD direction) or ciphertext (if initialised in the gnu.crypto.assembly.Direction#REVERSED direction), from in, starting at index position inOffset, returning the result in out, starting at index position outOffset. Throws an IllegalStateException if the instance is not yet initialized.

boolean selfTest () Function
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 true if the implementation passes the tests. Returns false otherwise.