Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

gnu.javax.crypto.assembly
Class Stage  view Stage download Stage.java

java.lang.Object
  extended bygnu.javax.crypto.assembly.Stage
Direct Known Subclasses:
CascadeStage, ModeStage

public abstract class Stage
extends java.lang.Object

A Stage in a Cascade Cipher.

Each stage may be either an implementation of a Block Cipher Mode of Operation (gnu.javax.crypto.mode.IMode) or another Cascade Cipher (Cascade). Each stage has also a natural operational direction when constructed for inclusion within a Cascade. This natural direction dictates how data flows from one stage into another when stages are chained together in a cascade. One can think of a stage and its natural direction as the specification of how to wire the stage into the chain. The following diagrams may help understand the paradigme. The first shows two stages chained each with a Direction.FORWARD 55 direction.

           FORWARD         FORWARD
       +------+       +-------+
       |      |       |       |
       |  +--in --+   |   +--in --+
    ---+  | Stage |   |   | Stage |  +---
          +--out--+   |   +--out--+  |
              |       |       |      |
              +-------+       +------+
 

The second diagram shows two stages, one in a Direction.FORWARD 55 direction, while the other is wired in a Direction.REVERSED 55 direction.

           FORWARD         REVERSED
       +------+               +------+
       |      |               |      |
       |  +--in --+       +--in --+  |
    ---+  | Stage |       | Stage |  +---
          +--out--+       +--out--+
              |               |
              +---------------+
 


Field Summary
static java.lang.String DIRECTION
           
protected  Direction forward
           
protected  Direction wired
           
 
Constructor Summary
protected Stage(Direction forwardDirection)
           
 
Method Summary
abstract  java.util.Set blockSizes()
          Returns the java.util.Set of supported block sizes for this Stage.
abstract  int currentBlockSize()
          Returns the currently set block size for the stage.
static Stage getInstance(Cascade cascade, Direction forwardDirection)
           
static Stage getInstance(gnu.javax.crypto.mode.IMode mode, Direction forwardDirection)
           
 void init(java.util.Map attributes)
          Initialises the stage for operation with specific characteristics.
(package private) abstract  void initDelegate(java.util.Map attributes)
           
 void reset()
          Resets the stage for re-initialisation and use with other characteristics.
(package private) abstract  void resetDelegate()
           
abstract  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.
 void update(byte[] in, int inOffset, byte[] out, int outOffset)
          Processes exactly one block of plaintext (if initialised in the Direction.FORWARD 55 state) or ciphertext (if initialised in the Direction.REVERSED 55 state).
(package private) abstract  void updateDelegate(byte[] in, int inOffset, byte[] out, int outOffset)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIRECTION

public static final java.lang.String DIRECTION
See Also:
Constant Field Values

forward

protected Direction forward

wired

protected Direction wired
Constructor Detail

Stage

protected Stage(Direction forwardDirection)
Method Detail

getInstance

public static final Stage getInstance(gnu.javax.crypto.mode.IMode mode,
                                      Direction forwardDirection)

getInstance

public static final Stage getInstance(Cascade cascade,
                                      Direction forwardDirection)

blockSizes

public abstract java.util.Set blockSizes()
Returns the java.util.Set of supported block sizes for this Stage. Each element in the returned java.util.Set is an instance of java.lang.Integer.


init

public void init(java.util.Map attributes)
          throws java.security.InvalidKeyException
Initialises the stage for operation with specific characteristics.


currentBlockSize

public abstract int currentBlockSize()
                              throws java.lang.IllegalStateException
Returns the currently set block size for the stage.


reset

public void reset()
Resets the stage for re-initialisation and use with other characteristics. This method always succeeds.


update

public void update(byte[] in,
                   int inOffset,
                   byte[] out,
                   int outOffset)
Processes exactly one block of plaintext (if initialised in the Direction.FORWARD 55 state) or ciphertext (if initialised in the Direction.REVERSED 55 state).


selfTest

public abstract 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.


initDelegate

abstract void initDelegate(java.util.Map attributes)
                    throws java.security.InvalidKeyException

resetDelegate

abstract void resetDelegate()

updateDelegate

abstract void updateDelegate(byte[] in,
                             int inOffset,
                             byte[] out,
                             int outOffset)