|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectkerberos.packets.DES
This is the class for Data Encryption Standard (DES) keys. See FIPS PUB 46-1 or DEA defined in ANSI X3.92-1981 for a complete specification.
DES is the most widely used block cipher, although it is nowadays normally used repeatedly for each piece of plain-text and is called triple-DES. This is because the 56-bit key-size of the normal DES is too small to offer complete security.
The CDS for a DES key is DES(key) with key
a string of 16 hexadecimal digits to create a specific key
or DES(?) for a random DES object.
This implementation is done from the description given in Schneier's Applied Cryptography.
org.logi.crypto.keys.TriDES| Constructor Summary | |
DES()
Create a new random DES key. |
|
DES(byte[] key)
Create a new DES key with the key bits from key[0..7]. |
|
DES(long key)
Create a new DES key with the key bits from key. |
|
| Method Summary | |
int |
cipherBlockSize()
The block-size for the DES cipher is 8 bytes. |
void |
decrypt(byte[] source,
int i,
byte[] dest,
int j)
Decrypt one block of data. |
void |
encrypt(byte[] source,
int i,
byte[] dest,
int j)
Encrypt one block of data. |
boolean |
equals(java.lang.Object o)
Return true iff the two keys are equivalent. |
java.lang.String |
getAlgorithm()
The name of the algorithm is "DES". |
byte[] |
getKey()
Return the key-bits for this key as an array of 8 bytes. |
int |
getSize()
The key-size for the DES cipher is 56 bits. |
static java.lang.String |
hexString(long a)
|
static long |
makeLong(byte[] buf,
int i,
int length)
Convert a byte array to a long. |
static int |
pickBits(int a,
byte[] bits)
Construct an int by picking bits from another int. |
static long |
pickBits(long a,
byte[] bits)
Construct an long by picking bits from another long. |
int |
plainBlockSize()
The block-size for the DES cipher is 8 bytes. |
java.lang.String |
toString()
Return a CDS for this key. |
static void |
writeBytes(long a,
byte[] dest,
int i,
int length)
Write a long to a byte array. |
| Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public DES()
public DES(byte[] key)
key[0..7].
public DES(long key)
key.
| Method Detail |
public int plainBlockSize()
public int cipherBlockSize()
public int getSize()
public java.lang.String getAlgorithm()
public boolean equals(java.lang.Object o)
public byte[] getKey()
public java.lang.String toString()
org.logi.crypto.Crypto#fromString
public void encrypt(byte[] source,
int i,
byte[] dest,
int j)
source[i..i+7] and ciphertext is written to
dest[j..j+7]
public void decrypt(byte[] source,
int i,
byte[] dest,
int j)
dest[i..i+7] and plaintext is written to
source[j..j+7].
public static final long makeLong(byte[] buf,
int i,
int length)
buf[i..i+length-1].
public static final java.lang.String hexString(long a)
public static final int pickBits(int a,
byte[] bits)
bits[i] is the index of the bit within a
that should be put at index i in the result.
The most-significant bit is number 0.
public static final long pickBits(long a,
byte[] bits)
bits[i] is the index of the bit within a
that should be put at index i in the result.
The most-significant bit is number 0.
public static final void writeBytes(long a,
byte[] dest,
int i,
int length)
a are written
to dest[i..i+length-1].
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||