gnu.crypto.cipher

Interface IBlockCipherSpi

All Superinterfaces:
Cloneable
Known Implementing Classes:
Anubis, BaseCipher, Blowfish, Cast5, DES, Khazad, NullCipher, Rijndael, Serpent, Square, TripleDES, Twofish

(package private) interface IBlockCipherSpi
extends Cloneable

Package-private interface exposing mandatory methods to be implemented by concrete BaseCipher sub-classes.
Version:
$Revision: 1.5 $

Method Summary

Iterator
blockSizes()
Returns an Iterator over the supported block sizes.
void
decrypt(byte[] in, int inOffset, byte[] out, int outOffset, Object k, int bs)
Decrypts exactly one block of ciphertext.
void
encrypt(byte[] in, int inOffset, byte[] out, int outOffset, Object k, int bs)
Encrypts exactly one block of plaintext.
Iterator
keySizes()
Returns an Iterator over the supported key sizes.
Object
makeKey(byte[] k, int bs)
Expands a user-supplied key material into a session key for a designated block size.
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).

Method Details

blockSizes

public Iterator blockSizes()
Returns an Iterator over the supported block sizes. Each element returned by this object is a 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.

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.

keySizes

public Iterator keySizes()
Returns an Iterator over the supported key sizes. Each element returned by this object is a Integer.
Returns:
an Iterator over the supported key sizes.

makeKey

public Object makeKey(byte[] k,
                      int bs)
            throws InvalidKeyException
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.

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.