All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class cryptix.security.BlockCipher

java.lang.Object
   |
   +----cryptix.security.BlockCipher

public abstract class BlockCipher
extends Object
Note: BlockCipher is deprecated.

This is an abstract superclass for ciphers that encrypt and decrypt a fixed length block with a secret key.

BlockCipher objects support only the Cryptix v2.2 API.

Note: compatibility with Cryptix 2.2 applies only to clients of this class. Subclasses must be rewritten as JCE algorithms.

Copyright © 1997 Systemics Ltd on behalf of the Cryptix Development Team.
All rights reserved.

$Revision: 1.4 $

Author:
Systemics Ltd, David Hopwood, Raif S. Naffah
See Also:
Cipher

Variable Index

 o blockSize
The algorithm's block size in bytes.
 o cipher
The JCE cipher that is delegated to.

Constructor Index

 o BlockCipher(Cipher, byte[])
Constructs a V2.2 block cipher from a JCE cipher.

Method Index

 o blockLength()
Returns the block size of this cipher. Deprecated.
 o decrypt(byte[])
Decrypts an array of data in place. Deprecated.
 o decrypt(byte[], byte[])
Decrypts a block of data. Deprecated.
 o decrypt(byte[], int, byte[], int)
Decrypts a block of data within an array. Deprecated.
 o encrypt(byte[])
Encrypts a block of data in place. Deprecated.
 o encrypt(byte[], byte[])
Encrypts a block of data. Deprecated.
 o encrypt(byte[], int, byte[], int)
Encrypts a block of data within an array. Deprecated.
 o keyLength()
Returns the key length for this cipher. Deprecated.

Variables

 o cipher
 protected Cipher cipher
The JCE cipher that is delegated to.

 o blockSize
 protected int blockSize
The algorithm's block size in bytes.

Constructors

 o BlockCipher
 protected BlockCipher(Cipher cipher,
                       byte userKey[])
Constructs a V2.2 block cipher from a JCE cipher.

Parameters:
cipher - the java.security.Cipher object.

Methods

 o blockLength
 public final int blockLength()
Note: blockLength() is deprecated. Use blockSize(), getPlaintextBlockSize() or getCiphertextBlockSize() instead.

Returns the block size of this cipher.

Returns:
the block size (in bytes) of this cipher.
 o keyLength
 public final int keyLength()
Note: keyLength() is deprecated.

Returns the key length for this cipher.

The JCE equivalent is to call getEncoded() on the Key object, and find the length of the resulting byte array. It is not possible to directly get the key object that has been used to initialize a Cipher.

Returns:
the key length (in bytes) of this cipher.
 o encrypt
 public final void encrypt(byte buf[])
Note: encrypt() is deprecated. Use initEncrypt(key) and update(buf, 0, buf.length, text, 0) instead.

Encrypts a block of data in place. The plaintext in buf is encrypted and written back as ciphertext. buf.length must be equal to the block size.

Parameters:
buf - the buffer holding the data
Throws: CryptoError
if the buffer was the wrong length
 o encrypt
 public final void encrypt(byte in[],
                           byte out[])
Note: encrypt() is deprecated. Use initEncrypt(key) and update(in, 0, in.length, out, 0) instead.

Encrypts a block of data. The plaintext in in is encrypted and the ciphertext is written into out. Note that in and out can be the same array. in.length and out.length must be equal to the block size.

Parameters:
in - the plaintext to be encrypted
out - the ciphertext result of the encryption
Throws: CryptoError
if a buffer was the wrong length
 o encrypt
 public void encrypt(byte in[],
                     int inOffset,
                     byte out[],
                     int outOffset)
Note: encrypt() is deprecated. Use initEncrypt(key) and update(in, inOffset, blockSize, out, outOffset) instead.

Encrypts a block of data within an array. The plaintext in in[inOffset..inOffset+blockSize-1] is encrypted, and the resulting ciphertext is written to out[outOffset..outOffset+blockSize-1]. Note that there must be sufficient bytes left in each array.

The in and out arrays can be the same, in which case the behaviour is the same as if the input array was copied before any output is written.

Parameters:
in - buffer holding the plaintext to be encrypted
inOffset - the start of plaintext within in
out - buffer to write the encrypted ciphertext to
outOffset - the start of ciphertext within out
Throws: ArrayIndexOutOfBoundsException
if an offset was invalid.
 o decrypt
 public final void decrypt(byte text[])
Note: decrypt() is deprecated. Use initDecrypt(key) and update(buf, 0, buf.length, text, 0) instead.

Decrypts an array of data in place. The ciphertext in buf is decrypted and written back as plaintext. buf.length must be equal to the block size.

Parameters:
buf - the buffer holding the data
Throws: CryptoError
if the buffer was the wrong length
 o decrypt
 public final void decrypt(byte in[],
                           byte out[])
Note: decrypt() is deprecated. Use initDecrypt(key) and update(in, 0, in.length, out, 0) instead.

Decrypts a block of data. The ciphertext in in is decrypted and the plaintext is written into out. Note that in and out can be the same array. in.length and out.length must be equal to the block size.

Parameters:
in - the plaintext to be encrypted
out - the ciphertext result of the encryption
Throws: CryptoError
if a buffer was the wrong length
 o decrypt
 public void decrypt(byte in[],
                     int inOffset,
                     byte out[],
                     int outOffset)
Note: decrypt() is deprecated. Use initDecrypt(key) and update(in, inOffset, blockSize, out, outOffset) instead.

Decrypts a block of data within an array. The ciphertext in in[inOffset..inOffset+blockSize-1] is decrypted, and the resulting plaintext is written to out[outOffset..outOffset+blockSize-1]. Note that there must be sufficient bytes left in each array.

The in and out arrays can be the same, in which case the behaviour is the same as if the input array was copied before any output is written.

Parameters:
in - buffer holding the ciphertext to be decrypted
inOffset - the start of ciphertext within in
out - buffer to write the decrypted plaintext to
outOffset - the start of plaintext within out
Throws: ArrayIndexOutOfBoundsException
if an offset was invalid.

All Packages  Class Hierarchy  This Package  Previous  Next  Index