gnu.crypto.mode

Class CTR

public class CTR extends BaseMode implements Cloneable

The implementation of the Counter Mode.

The algorithm steps are formally described as follows:

    CTR Encryption: O[j] = E(K)(T[j]); for j = 1, 2...n;
                    C[j] = P[j] ^ O[j]; for j = 1, 2...n.
    CTR Decryption: O[j] = E(K)(T[j]); for j = 1, 2...n;
                    P[j] = C[j] ^ O[j]; for j = 1, 2...n.
 

where P is the plaintext, C is the ciphertext, E(K) is the underlying block cipher encryption function parametrised with the session key K, and T is the Counter.

This implementation, uses a standard incrementing function with a step of 1, and an initial value similar to that described in the NIST document.

References:

  1. Recommendation for Block Cipher Modes of Operation Methods and Techniques, Morris Dworkin.

Version: $Revision: 1.7 $

Constructor Summary
CTR(IBlockCipher underlyingCipher, int cipherBlockSize)

Trivial package-private constructor for use by the Factory class.

Method Summary
IteratorblockSizes()
Objectclone()
voiddecryptBlock(byte[] in, int i, byte[] out, int o)
voidencryptBlock(byte[] in, int i, byte[] out, int o)
voidsetup()
voidteardown()

Constructor Detail

CTR

CTR(IBlockCipher underlyingCipher, int cipherBlockSize)

Trivial package-private constructor for use by the Factory class.

Parameters: underlyingCipher the underlying cipher implementation. cipherBlockSize the underlying cipher block size to use.

Method Detail

blockSizes

public Iterator blockSizes()

clone

public Object clone()

decryptBlock

public void decryptBlock(byte[] in, int i, byte[] out, int o)

encryptBlock

public void encryptBlock(byte[] in, int i, byte[] out, int o)

setup

public void setup()

teardown

public void teardown()
Copyright © 2001, 2002, 2003 Free Software Foundation, Inc. All Rights Reserved.