|
For the latest news and information visit The GNU Crypto project |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--gnu.crypto.cipher.BaseCipher
|
+--gnu.crypto.cipher.DES
The Data Encryption Standard. DES is a 64-bit block cipher with a 56-bit key, developed by IBM in the 1970's for the standardization process begun by the National Bureau of Standards (now NIST).
New applications should not use DES except for compatibility.
This version is based upon the description and sample implementation in [1].
References:
| Nested Class Summary | |
(package private) class |
DES.Context
Simple wrapper class around the session keys. |
| Field Summary | |
static int |
BLOCK_SIZE
DES operates on 64 bit blocks. |
static int |
KEY_SIZE
DES uses 56 bits of a 64 bit parity-adjusted key. |
| Fields inherited from class gnu.crypto.cipher.BaseCipher |
currentBlockSize, currentKey, defaultBlockSize, defaultKeySize, lock, name |
| Fields inherited from interface gnu.crypto.cipher.IBlockCipher |
CIPHER_BLOCK_SIZE, KEY_MATERIAL |
| Constructor Summary | |
DES()
Default 0-argument constructor. |
|
| Method Summary | |
static void |
adjustParity(byte[] kb,
int offset)
Adjust the parity for a raw key array. |
java.util.Iterator |
blockSizes()
Returns an Iterator over the supported block sizes. |
java.lang.Object |
clone()
Returns a clone of this instance. |
void |
decrypt(byte[] in,
int i,
byte[] out,
int o,
java.lang.Object K,
int bs)
Decrypts exactly one block of ciphertext. |
void |
encrypt(byte[] in,
int i,
byte[] out,
int o,
java.lang.Object K,
int bs)
Encrypts exactly one block of plaintext. |
static boolean |
isParityAdjusted(byte[] kb,
int offset)
Test if a byte array, which must be at least 8 bytes long, is parity adjusted. |
static boolean |
isSemiWeak(byte[] kb)
Test if a key is a semi-weak key. |
static boolean |
isWeak(byte[] kb)
Test if a key is a weak key. |
java.util.Iterator |
keySizes()
Returns an Iterator over the supported key sizes. |
java.lang.Object |
makeKey(byte[] kb,
int bs)
Expands a user-supplied key material into a session key for a designated block size. |
| Methods inherited from class gnu.crypto.cipher.BaseCipher |
currentBlockSize, decryptBlock, defaultBlockSize, defaultKeySize, encryptBlock, init, name, reset, selfTest, testKat |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int BLOCK_SIZE
public static final int KEY_SIZE
| Constructor Detail |
public DES()
| Method Detail |
public static void adjustParity(byte[] kb,
int offset)
kb - The key array, to be parity-adjusted.offset - The starting index into the key bytes.
public static boolean isParityAdjusted(byte[] kb,
int offset)
kb - The key bytes.offset - The starting index into the key bytes.
true if the first 8 bytes of kb have
been parity adjusted. false otherwise.public static boolean isWeak(byte[] kb)
kb - The key to test.
true if the key is weak.public static boolean isSemiWeak(byte[] kb)
kb - The key to test.
true if this key is semi-weak.public java.lang.Object clone()
IBlockCipherReturns a clone of this instance.
clone in interface IBlockCipherclone in class BaseCipherpublic java.util.Iterator blockSizes()
IBlockCipherReturns an Iterator over the supported block sizes. Each
element returned by this object is an Integer.
Iterator over the supported block sizes.public java.util.Iterator keySizes()
IBlockCipherReturns an Iterator over the supported key sizes. Each element
returned by this object is an Integer.
Iterator over the supported key sizes.
public java.lang.Object makeKey(byte[] kb,
int bs)
throws java.security.InvalidKeyException
IBlockCipherSpiExpands a user-supplied key material into a session key for a designated block size.
kb - the user-supplied key material.bs - the desired block size in bytes.
java.security.InvalidKeyException - if the key data is invalid.
public void encrypt(byte[] in,
int i,
byte[] out,
int o,
java.lang.Object K,
int bs)
IBlockCipherSpiEncrypts exactly one block of plaintext.
in - the plaintext.i - index of in from which to start considering
data.out - the ciphertext.o - index of out from which to store the result.K - the session key to use.bs - the block size to use.
public void decrypt(byte[] in,
int i,
byte[] out,
int o,
java.lang.Object K,
int bs)
IBlockCipherSpiDecrypts exactly one block of ciphertext.
in - the ciphertext.i - index of in from which to start considering
data.out - the plaintext.o - index of out from which to store the result.K - the session key to use.bs - the block size to use.
|
For the latest news and information visit The GNU Crypto project |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||