gnu.crypto.mode
public abstract class BaseMode extends Object implements IMode
A basic abstract class to facilitate implementing block cipher modes of operations.
Version: $Revision: 1.7 $
Field Summary | |
---|---|
protected IBlockCipher | cipher The underlying block cipher implementation. |
protected int | cipherBlockSize The block size, in bytes, to operate the underlying block cipher in. |
protected byte[] | iv The initialisation vector value. |
protected Object | lock The instance lock. |
protected int | modeBlockSize The block size, in bytes, in which to operate the mode instance. |
protected String | name The canonical name prefix of this mode. |
protected int | state The state indicator of this instance. |
Constructor Summary | |
---|---|
protected | BaseMode(String name, IBlockCipher underlyingCipher, int cipherBlockSize) Trivial constructor for use by concrete subclasses. |
Method Summary | |
---|---|
Iterator | blockSizes() Returns an Iterator over the supported block sizes. |
abstract Object | clone() |
int | currentBlockSize() |
abstract void | decryptBlock(byte[] in, int i, byte[] out, int o) |
int | defaultBlockSize() Returns the default value, in bytes, of the mode's block size. |
int | defaultKeySize() Returns the default value, in bytes, of the underlying block cipher key size. |
abstract void | encryptBlock(byte[] in, int i, byte[] out, int o) |
void | init(Map attributes) |
Iterator | keySizes() Returns an Iterator over the supported underlying block cipher key sizes. |
String | name() |
void | reset() |
boolean | selfTest() |
abstract void | setup() The initialisation phase of the concrete mode implementation. |
abstract void | teardown() The termination phase of the concrete mode implementation. |
void | update(byte[] in, int inOffset, byte[] out, int outOffset) |
Trivial constructor for use by concrete subclasses.
Parameters: name the canonical name prefix of this mode. underlyingCipher the implementation of the underlying cipher. cipherBlockSize the block size, in bytes, in which to operate the underlying cipher.
Returns an Iterator over the supported block sizes. Each element returned by this object is an Integer.
The default behaviour is to return an iterator with just one value, which is that currently configured for the underlying block cipher. Concrete implementations may override this behaviour to signal their ability to support other values.
Returns: an Iterator over the supported block sizes.
Returns the default value, in bytes, of the mode's block size. This
value is part of the construction arguments passed to the Factory methods
in ModeFactory. Unless changed by an invocation of any of the
init()
methods, a Mode instance would operate with
the same block size as its underlying block cipher. As mentioned earlier,
the block size of the underlying block cipher itself is specified in one
of the method(s) available in the factory class.
Returns: the default value, in bytes, of the mode's block size.
See Also: ModeFactory
Returns the default value, in bytes, of the underlying block cipher key size.
Returns: the default value, in bytes, of the underlying cipher's key size.
Returns an Iterator over the supported underlying block cipher key sizes. Each element returned by this object is an instance of Integer.
Returns: an Iterator over the supported key sizes.