|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--javax.crypto.KeyGeneratorSpi
|
+--iaik.security.cipher.DESKeyGenerator
This class provides the functionality of a DES key generator. A key generator is used for creating secret keys for symmetric algorithms.
An application uses
KeyGenerator des_key_gen =
KeyGenerator.getInstance("DES"); for creating a
KeyGenerator object for the DES algorithm. For actually generating the
requested secret DES key from the KeyGenerator object just created, an
application calls the generateKey method after having initialized
the generator with some random seed or relied on the default system-provided
source of randomness:
SecretKey des_key = des_key_gen.generateKey();
Due to the way, the DES algorithm generates sub-keys for the several DES rounds, some initial keys may be classified as weak or semi-weak keys reducing the security of the DES cipher (see "Applied Cryptography", Bruce Schneier, ISBN 0-471-59756-2). This KeyGenerator class ensures to generate a strong DES key by repeating the key generation process as long as comparison with all the known weak and semi-weak DES keys will show that the just created key is not a strong one.
KeyGenerator,
KeyGeneratorSpi,
SecretKey,
SecretKey,
DES| Constructor Summary | |
DESKeyGenerator()
|
|
| Method Summary | |
static void |
adjustParity(byte[] key,
int offset)
Adjusts the parity-bits of a DES key, supplied in a byte array beginning at the given offset. |
SecretKey |
engineGenerateKey()
Generates a DES key. |
void |
engineInit(AlgorithmParameterSpec params,
SecureRandom random)
Because this DES key generator needs no parameter this initialization method only throws a InvalidAlgorithmParameterException. |
void |
engineInit(int strength,
SecureRandom random)
Initializes this DES key generator for the given strength with the given random seed. |
void |
engineInit(SecureRandom random)
Initializes this DES key generator with the given random seed. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
public DESKeyGenerator()
| Method Detail |
public void engineInit(AlgorithmParameterSpec params,
SecureRandom random)
throws InvalidAlgorithmParameterException
public void engineInit(SecureRandom random)
random - the random seed for this DES key generator
public void engineInit(int strength,
SecureRandom random)
Since a DES key has a defined length of 56 bits (respectively 64 bits when including parity bits), the given strength value would be ignored.
strength - the strength of the key to be created; ignoredrandom - the random seedpublic SecretKey engineGenerateKey()
For ensuring to create a strong DES key, the key generation process is repeated as long as comparison with all the known weak and semi-weak DES keys will show that the just created key is not a strong DES key.
SecretKey
public static void adjustParity(byte[] key,
int offset)
key - the byte array holding the DES keyoffset - the offset indicating where the key starts within the given
byte array
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||