Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
| For the latest news and information visit The GNU Crypto project
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES

## Package gnu.crypto.cipher

Provides a basic API for using symetric-key block cipher algorithms.

See:
Description

Interface Summary
IBlockCipher | The basic visible methods of any symmetric key block cipher.

Class Summary
Anubis | Anubis is a 128-bit block cipher that accepts a variable-length key.
BaseCipher | A basic abstract class to facilitate implementing symmetric key block ciphers.
Blowfish | Blowfish is a 16-round, 64-bit Feistel cipher designed by Bruce Schneier.
Cast5 | An implmenetation of the `CAST5` (a.k.a.
CipherFactory | A Factory to instantiate symmetric block cipher instances.
DES | The Data Encryption Standard.
Khazad | Khazad is a 64-bit (legacy-level) block cipher that accepts a 128-bit key.
NullCipher | The implementation of a Null block cipher.
Rijndael | Rijndael --pronounced Reindaal-- is the AES.
Serpent | Serpent is a 32-round substitution-permutation network block cipher, operating on 128-bit blocks and accepting keys of 128, 192, and 256 bits in length.
Square | Square is a 128-bit key, 128-bit block cipher algorithm developed by Joan Daemen, Lars Knudsen and Vincent Rijmen.
TripleDES | Triple-DES, 3DES, or DESede is a combined cipher that uses three iterations of the Data Encryption Standard cipher to improve the security (at the cost of speed) of plain DES.
Twofish | Twofish is a balanced 128-bit Feistel cipher, consisting of 16 rounds.

Exception Summary
WeakKeyException | Checked exception thrown to indicate that a weak key has been generated and or specified instead of a valid non-weak value.

## Package gnu.crypto.cipher Description

Provides a basic API for using symetric-key block cipher algorithms.

## Package overview

The following diagram shows the important classes participating in this package:

Here is a simple example of how to use the AES cipher. It transforms the plaintext to the ciphertext, and the ciphertext back to the plaintext, using the AES in electronic codebook mode with no padding. Note also the classes for cipher modes and padding schemes for more complex constructions.

    IBlockCipher cipher = CipherFactory.getInstance("AES");
    Map attributes = new HashMap();
    attributes.put(IBlockCipher.CIPHER_BLOCK_SIZE, new Integer(16));
    attributes.put(IBlockCipher.KEY_MATERIAL, key_bytes);

    cipher.init(attributes);
    int bs = cipher.currentBlockSize();
    for (int i = 0; i + bs < pt.length; i += bs)
      {
        cipher.encryptBlock(pt, i, ct, i);
      }

    for (int i = 0; i + bs < cpt.length; i += bs)
      {
        cipher.decryptBlock(ct, i, cpt, i);
      }

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
| For the latest news and information visit The GNU Crypto project
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES

Copyright © 2001, 2002, 2003, 2004 Free Software Foundation, Inc.