gnu.javax.crypto.assembly
Class 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
of 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
IMode
, including the
ECB
mode which basically exposes a
symmetric-key block cipher algorithm as a
Mode of Operations.
References:
- [HAC]: Handbook of
Applied Cryptography.
CRC Press, Inc. ISBN 0-8493-8523-7, 1997
Menezes, A., van Oorschot, P. and S. Vanstone.
Object | append(Stage stage) - Adds to the end of the current chain, a designated
Stage .
|
Set<E> | blockSizes() - Returns the
Set of supported block sizes for this
Cascade that are common to all of its chained stages.
|
int | currentBlockSize() - Returns the currently set block size for the chain.
|
void | init(Map<K,V> attributes) - Initialises the chain for operation with specific characteristics.
|
Object | insert(int index, Stage stage) - Inserts a
Stage into the current chain, at the specified index
(zero-based) position.
|
Object | prepend(Stage stage) - Adds to the begining of the current chain, a designated
Stage .
|
void | reset() - Resets the chain for re-initialisation and use with other characteristics.
|
boolean | selfTest() - 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.
|
int | size() - Returns the current number of stages in this chain.
|
Iterator<E> | stages() - Returns an
Iterator over the stages contained in this instance.
|
void | update(byte[] in, int inOffset, byte[] out, int outOffset) - Processes exactly one block of plaintext (if initialised in the
Direction.FORWARD state) or ciphertext (if initialised in
the Direction.REVERSED state).
|
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
DIRECTION
public static final String DIRECTION
- "gnu.crypto.assembly.cascade.direction"
blockSize
protected int blockSize
The curently set block-size for this instance.
wired
protected Direction wired
The current operational direction of this instance.
Cascade
public Cascade()
The basic constructor. Object is special, because it has no
superclass, so there is no call to super().
blockSizes
public Set<E> blockSizes()
Returns the
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
.
- a
Set
of supported block sizes common to all the stages of
the chain.
currentBlockSize
public int currentBlockSize()
Returns the currently set block size for the chain.
- the current block size for the chain.
init
public void init(Map<K,V> attributes)
throws InvalidKeyException
Initialises the chain for operation with specific characteristics.
attributes
- a set of name-value pairs that describes the desired
future behaviour of this instance.
IllegalStateException
- if the chain, or any of its stages, is
already initialised.InvalidKeyException
- if the intialisation data provided with the
stage is incorrect or causes an invalid key to be generated.
reset
public void reset()
Resets the chain for re-initialisation and use with other characteristics.
This method always succeeds.
selfTest
public boolean selfTest()
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.
true
if the implementation passes simple
correctness tests. Returns false
otherwise.
size
public int size()
Returns the current number of stages in this chain.
- the current count of stages in this chain.
stages
public Iterator<E> stages()
Returns an
Iterator
over the stages contained in this instance.
Each element of this iterator is a concrete implementation of a
Stage
.
- an
Iterator
over the stages contained in this instance.
Each element of the returned iterator is a concrete instance of a
Stage
.
update
public void update(byte[] in,
int inOffset,
byte[] out,
int outOffset)
in
- the plaintext.inOffset
- index of in
from which to start considering
data.out
- the ciphertext.outOffset
- index of out
from which to store result.
Cascade.java --
Copyright (C) 2003, 2006 Free Software Foundation, Inc.
This file is a part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.