gnu.crypto.cipher
Class TripleDES
- Cloneable, IBlockCipher, IBlockCipherSpi
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.
Triple-DES runs the DES algorithm three times with three
independent 56 bit keys. To encrypt:
Ci =
Ek3 ( Ek2-1 ( Ek1 ( Pi )))
And to decrypt:
Pi =
Ek1-1 ( Ek2 ( Ek3-1 ( Ci )))
(The "ede" comes from the encryption operation, which runs
Encrypt-Decrypt-Encrypt)
References:
- Bruce Schneier, Applied Cryptography: Protocols, Algorithms,
and Source Code in C, Second Edition. (1996 John Wiley and Sons)
ISBN 0-471-11709-9. Page 294--295.
static int | BLOCK_SIZE - Triple-DES only operates on 64 bit blocks.
|
static int | KEY_SIZE - Triple-DES uses 168 bits of a parity-adjusted 192 bit key.
|
static void | adjustParity(byte[] kb, int offset) - Transform a key so it will be parity adjusted.
|
Iterator | blockSizes() - Returns an
Iterator over the supported block sizes.
|
Object | clone()
|
void | decrypt(byte[] in, int i, byte[] out, int o, Object K, int bs) - Decrypts exactly one block of ciphertext.
|
void | encrypt(byte[] in, int i, byte[] out, int o, Object K, int bs) - Encrypts exactly one block of plaintext.
|
static boolean | isParityAdjusted(byte[] kb, int offset) - Tests if a byte array has already been parity adjusted.
|
Iterator | keySizes() - Returns an
Iterator over the supported key sizes.
|
Object | makeKey(byte[] kb, int bs) - Expands a user-supplied key material into a session key for a
designated block size.
|
clone , currentBlockSize , decryptBlock , defaultBlockSize , defaultKeySize , encryptBlock , init , name , reset , selfTest , testKat , testKat |
BLOCK_SIZE
public static final int BLOCK_SIZE
Triple-DES only operates on 64 bit blocks.
KEY_SIZE
public static final int KEY_SIZE
Triple-DES uses 168 bits of a parity-adjusted 192 bit key.
TripleDES
public TripleDES()
Default 0-arguments constructor.
adjustParity
public static void adjustParity(byte[] kb,
int offset)
Transform a key so it will be parity adjusted.
kb
- The key bytes to adjust.offset
- The starting offset into the key bytes.
decrypt
public void decrypt(byte[] in,
int i,
byte[] out,
int o,
Object K,
int bs)
Decrypts exactly one block of ciphertext.
- decrypt in interface IBlockCipherSpi
in
- the ciphertext.out
- the plaintext.bs
- the block size to use.
encrypt
public void encrypt(byte[] in,
int i,
byte[] out,
int o,
Object K,
int bs)
Encrypts exactly one block of plaintext.
- encrypt in interface IBlockCipherSpi
in
- the plaintext.out
- the ciphertext.bs
- the block size to use.
isParityAdjusted
public static boolean isParityAdjusted(byte[] kb,
int offset)
Tests if a byte array has already been parity adjusted.
kb
- The key bytes to test.offset
- The starting offset into the key bytes.
true
if the bytes in kb starting at
offset are parity adjusted.
makeKey
public Object makeKey(byte[] kb,
int bs)
throws InvalidKeyException
Expands a user-supplied key material into a session key for a
designated block size.
- makeKey in interface IBlockCipherSpi
bs
- the desired block size in bytes.
- an Object encapsulating the session key.
Copyright © 2001, 2002, 2003
Free Software Foundation,
Inc. All Rights Reserved.