For the latest news and information visit
The GNU Crypto project

gnu.crypto.cipher
Interface IBlockCipherSpi

All Superinterfaces:
java.lang.Cloneable
All Known Implementing Classes:
BaseCipher

interface IBlockCipherSpi
extends java.lang.Cloneable

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

Version:
$Revision: 1.2 $

Method Summary
 java.util.Iterator blockSizes()
          Returns an Iterator over the supported block sizes.
 void decrypt(byte[] in, int inOffset, byte[] out, int outOffset, java.lang.Object k, int bs)
          Decrypts exactly one block of ciphertext.
 void encrypt(byte[] in, int inOffset, byte[] out, int outOffset, java.lang.Object k, int bs)
          Encrypts exactly one block of plaintext.
 java.util.Iterator keySizes()
          Returns an Iterator over the supported key sizes.
 java.lang.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 Detail

blockSizes

public java.util.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.

keySizes

public java.util.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 java.lang.Object makeKey(byte[] k,
                                int bs)
                         throws java.security.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.
Throws:
java.lang.IllegalArgumentException - if the block size is invalid.
java.security.InvalidKeyException - if the key data is invalid.

encrypt

public void encrypt(byte[] in,
                    int inOffset,
                    byte[] out,
                    int outOffset,
                    java.lang.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:
java.lang.IllegalArgumentException - if the block size is invalid.
java.lang.ArrayIndexOutOfBoundsException - if there is not enough room in either the plaintext or ciphertext buffers.

decrypt

public void decrypt(byte[] in,
                    int inOffset,
                    byte[] out,
                    int outOffset,
                    java.lang.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:
java.lang.IllegalArgumentException - if the block size is invalid.
java.lang.ArrayIndexOutOfBoundsException - if there is not enough room in either the plaintext or ciphertext buffers.

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.

For the latest news and information visit
The GNU Crypto project

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