gnu.crypto.cipher

Interface IBlockCipherSpi

interface IBlockCipherSpi extends Cloneable

Package-private interface exposing mandatory methods to be implemented by concrete BaseCipher sub-classes.

Version: $Revision: 1.5 $

Method Summary
IteratorblockSizes()

Returns an java.util.Iterator over the supported block sizes.

voiddecrypt(byte[] in, int inOffset, byte[] out, int outOffset, Object k, int bs)

Decrypts exactly one block of ciphertext.

voidencrypt(byte[] in, int inOffset, byte[] out, int outOffset, Object k, int bs)

Encrypts exactly one block of plaintext.

IteratorkeySizes()

Returns an java.util.Iterator over the supported key sizes.

ObjectmakeKey(byte[] k, int bs)

Expands a user-supplied key material into a session key for a designated block size.

booleanselfTest()

A correctness test that consists of basic symmetric encryption / decryption test(s) for all supported block and key sizes, as well as one (1) variable key Known Answer Test (KAT).

Method Detail

blockSizes

public Iterator blockSizes()

Returns an java.util.Iterator over the supported block sizes. Each element returned by this object is a java.lang.Integer.

Returns: an Iterator over the supported block sizes.

decrypt

public void decrypt(byte[] in, int inOffset, byte[] out, int outOffset, Object k, int bs)

Decrypts exactly one block of ciphertext.

Parameters: in the ciphertext. inOffset index of in from which to start considering data. out the plaintext. outOffset index of out from which to store the result. k the session key to use. bs the block size to use.

Throws: IllegalArgumentException if the block size is invalid. ArrayIndexOutOfBoundsException if there is not enough room in either the plaintext or ciphertext buffers.

encrypt

public void encrypt(byte[] in, int inOffset, byte[] out, int outOffset, Object k, int bs)

Encrypts exactly one block of plaintext.

Parameters: in the plaintext. inOffset index of in from which to start considering data. out the ciphertext. outOffset index of out from which to store the result. k the session key to use. bs the block size to use.

Throws: IllegalArgumentException if the block size is invalid. ArrayIndexOutOfBoundsException if there is not enough room in either the plaintext or ciphertext buffers.

keySizes

public Iterator keySizes()

Returns an java.util.Iterator over the supported key sizes. Each element returned by this object is a java.lang.Integer.

Returns: an Iterator over the supported key sizes.

makeKey

public Object makeKey(byte[] k, int bs)

Expands a user-supplied key material into a session key for a designated block size.

Parameters: k the user-supplied key material. bs the desired block size in bytes.

Returns: an Object encapsulating the session key.

Throws: IllegalArgumentException if the block size is invalid. InvalidKeyException if the key data is invalid.

selfTest

public boolean selfTest()

A correctness test that consists of basic symmetric encryption / decryption test(s) for all supported block and key sizes, as well as one (1) variable key Known Answer Test (KAT).

Returns: true if the implementation passes simple correctness tests. Returns false otherwise.

Copyright © 2001, 2002, 2003 Free Software Foundation, Inc. All Rights Reserved.