gnu.crypto.mode

Class CFB

Implemented Interfaces:
Cloneable, IBlockCipher, IMode

public class CFB
extends BaseMode

The cipher feedback mode. CFB mode is a stream mode that operates on s bit blocks, where 1 <= s <= b, if b is the underlying cipher's block size. Encryption is:
I[1] = IV
I[j] = LSB(b-s, I[j-1]) | C[j-1]   for j = 2...n
O[j] = CIPH(K, I[j])               for j = 1,2...n
C[j] = P[j] ^ MSB(s, O[j])         for j = 1,2...n

And decryption is:

I[1] = IV
I[j] = LSB(b-s, I[j-1]) | C[j-1]   for j = 2...n
O[j] = CIPH(K, I[j])               for j = 1,2...n
P[j] = C[j] ^ MSB(s, O[j])         for j = 1,2...n

CFB mode requires an initialization vector, which need not be kept secret.

References:

  1. Bruce Schneier, Applied Cryptography: Protocols, Algorithms, and Source Code in C, Second Edition. (1996 John Wiley and Sons) ISBN 0-471-11709-9.
  2. Recommendation for Block Cipher Modes of Operation Methods and Techniques, Morris Dworkin.

Version:
$Revision: 1.1 $

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

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

Method Summary

Object
clone()
void
decryptBlock(byte[] in, int inOffset, byte[] out, int outOffset)
void
encryptBlock(byte[] in, int inOffset, byte[] out, int outOffset)
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

CFB

(package private)  CFB(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 inOffset,
                         byte[] out,
                         int outOffset)
Specified by:
decryptBlock in interface IBlockCipher
Overrides:
decryptBlock in interface BaseMode


encryptBlock

public void encryptBlock(byte[] in,
                         int inOffset,
                         byte[] out,
                         int outOffset)
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.