|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.logi.crypto.Crypto
org.logi.crypto.keys.K
org.logi.crypto.keys.SymmetricKey
org.logi.crypto.keys.DESKey
This is the class for Data Encryption Standard (DES) keys. 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 DESKey(key)
with key
a string of 16 hexadecimal digits to create a specific key
or DESKey(?)
for a random DESKey object.
This implementation is done from the description given in Schneier's Applied Cryptography and #################.
TriDESKey
Field Summary | |
protected static byte[] |
FP
Final Permutation. |
protected static byte[] |
IP
Initial Permutation. |
Fields inherited from class org.logi.crypto.keys.K |
fingerprint, otherFingerprint |
Fields inherited from class org.logi.crypto.Crypto |
BIT, cdsPath, EMPTY_ARRAY, FOUR, keySource, NIBBLE, ONE, primeCertainty, random, TWO, ZERO |
Constructor Summary | |
DESKey()
Create a new random DES key. |
|
DESKey(byte[] key)
Create a new DES key with the key bits from key[0..7] . |
|
DESKey(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 DESKey |
parseCDS(java.lang.String key)
If "DESKey( key )" is a valid CDS for a DESKey, then DESKey.parseCDS(key) will return the described DESKey object. |
int |
plainBlockSize()
The block-size for the DES cipher is 8 bytes. |
protected long |
subCrypt(long block)
Encrypt one block of data, sans initial and final permutations. |
protected long |
subDecrypt(long block)
Decrypt one block of data, sans initial and final permutations. |
java.lang.String |
toString()
Return a CDS for this key. |
Methods inherited from class org.logi.crypto.keys.SymmetricKey |
calcFingerprint, isPrivate, matches |
Methods inherited from class org.logi.crypto.keys.K |
getFingerprint, getFingerprint, hashCode, matchFingerprint, matchFingerprint |
Methods inherited from class org.logi.crypto.Crypto |
binString, binString, equal, equalRelaxed, equalSub, fromHexNibble, fromHexString, fromString, fromString, hexString, hexString, hexString, hexString, hexString, initRandom, initRandom, makeClass, makeInt, makeLong, makeSessionKey, pastSpace, pickBits, pickBits, readBlock, readInt, writeBytes, writeBytes, writeInt |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.logi.crypto.keys.Key |
getFingerprint, getFingerprint, hashCode, isPrivate, matches, matchFingerprint, matchFingerprint |
Field Detail |
protected static final byte[] IP
protected static final byte[] FP
Constructor Detail |
public DESKey()
public DESKey(byte[] key)
key[0..7]
.
public DESKey(long key)
key
.
Method Detail |
public static DESKey parseCDS(java.lang.String key) throws InvalidCDSException
A valid CDS can be created by calling the DESKey.toString() method.
InvalidCDSException
- if the CDS is malformed.Crypto.fromString(String)
public int plainBlockSize()
plainBlockSize
in interface CipherKey
public int cipherBlockSize()
cipherBlockSize
in interface CipherKey
public int getSize()
getSize
in interface Key
public java.lang.String getAlgorithm()
getAlgorithm
in interface Key
public boolean equals(java.lang.Object o)
public byte[] getKey()
public java.lang.String toString()
Crypto.fromString(java.io.Reader)
protected long subCrypt(long block)
public void encrypt(byte[] source, int i, byte[] dest, int j)
source[i..i+7]
and ciphertext is written to
dest[j..j+7]
encrypt
in interface CipherKey
protected long subDecrypt(long block)
public void decrypt(byte[] source, int i, byte[] dest, int j)
dest[i..i+7]
and plaintext is written to
source[j..j+7]
.
decrypt
in interface CipherKey
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |