gnu.crypto.mode

Class CBC

Implemented Interfaces:
Cloneable, IBlockCipher, IMode

public class CBC
extends BaseMode
implements Cloneable

The Cipher Block Chaining mode. This mode introduces feedback into the cipher by XORing the previous ciphertext block with the plaintext block before encipherment. That is, encrypting looks like this:

Ci = EK(Pi ^ Ci-1

Similarly, decrypting is:

Pi = Ci-1 ^ DK(Ci)

Version:
$Revision: 1.3 $

Field Summary

Fields inherited from class gnu.crypto.mode.BaseMode

cipher, cipherBlockSize, iv, lock, modeBlockSize, name, state

Fields inherited from interface gnu.crypto.cipher.IBlockCipher

CIPHER_BLOCK_SIZE, KEY_MATERIAL

Fields inherited from interface gnu.crypto.mode.IMode

DECRYPTION, ENCRYPTION, IV, MODE_BLOCK_SIZE, STATE

Constructor Summary

CBC(IBlockCipher underlyingCipher, int cipherBlockSize)
Package-private constructor for the factory class.

Method Summary

Object
clone()
void
decryptBlock(byte[] in, int i, byte[] out, int o)
void
encryptBlock(byte[] in, int i, byte[] out, int o)
void
setup()
The initialisation phase of the concrete mode implementation.
void
teardown()
The termination phase of the concrete mode implementation.

Methods inherited from class gnu.crypto.mode.BaseMode

blockSizes, clone, currentBlockSize, decryptBlock, defaultBlockSize, defaultKeySize, encryptBlock, init, keySizes, name, reset, selfTest, setup, teardown, update

Constructor Details

CBC

(package private)  CBC(IBlockCipher underlyingCipher,
                       int cipherBlockSize)
Package-private constructor for the factory class.
Parameters:
underlyingCipher - The cipher implementation.
cipherBlockSize - The cipher's block size.

Method Details

clone

public Object clone()
Specified by:
clone in interface IBlockCipher
Overrides:
clone in interface BaseMode

decryptBlock

public void decryptBlock(byte[] in,
                         int i,
                         byte[] out,
                         int o)
Specified by:
decryptBlock in interface IBlockCipher
Overrides:
decryptBlock in interface BaseMode

encryptBlock

public void encryptBlock(byte[] in,
                         int i,
                         byte[] out,
                         int o)
Specified by:
encryptBlock in interface IBlockCipher
Overrides:
encryptBlock in interface BaseMode

setup

public void setup()
The initialisation phase of the concrete mode implementation.
Overrides:
setup in interface BaseMode

teardown

public void teardown()
The termination phase of the concrete mode implementation.
Overrides:
teardown in interface BaseMode

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