Package gnu.crypto.cipher
Provides a basic API for using symetric-key block cipher algorithms.
IBlockCipher | The basic visible methods of any symmetric key block cipher.
A symmetric key block cipher is a function that maps n-bit plaintext
blocks to n-bit ciphertext blocks; n being the cipher's block size.
|
IBlockCipherSpi | Package-private interface exposing mandatory methods to be implemented by
concrete BaseCipher sub-classes.
|
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. |
DES.Context | Simple wrapper class around the session keys. |
Khazad | Khazad is a 64-bit (legacy-level) block cipher that accepts a 128-bit key.
|
NullCipher | The implementation of a Null block cipher.
This cipher does not alter its input at all, claims to process block sizes
128-, 192- and 256-bit long, and key sizes from 64- to 512-bit in 8-bit
increments.
|
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.
References:
- The block
cipher Square.
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. |
WeakKeyException | Checked exception thrown to indicate that a weak key has been generated
and or specified instead of a valid non-weak value.
|
Provides a basic API for using symetric-key block cipher algorithms.
Package overview
The following diagram shows the important classes participating in this
package:
![]()
../../../../diagrams/cipher_class_diag.png"
width=547 height=318 border=0>
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 <32pt.length; i += bs)
{
cipher.encryptBlock(pt, i, ct, i);
}
for (int i = 0; i + bs <32cpt.length; i += bs)
{
cipher.decryptBlock(ct, i, cpt, i);
}
<!-- $Revision: 1.4 $ -->
Copyright © 2001, 2002, 2003
Free Software Foundation,
Inc. All Rights Reserved.