Class au.net.aba.crypto.provider.DESKeyGenerator
All Packages Class Hierarchy This Package Previous Next Index
Class au.net.aba.crypto.provider.DESKeyGenerator
java.lang.Object
|
+----javax.crypto.KeyGeneratorSpi
|
+----au.net.aba.crypto.provider.DESKeyGenerator
- public class DESKeyGenerator
- extends KeyGeneratorSpi
This class is used for generating random DES keys. This class
should not be instantiated directly, instead use the
javax.crypto.KeyGenerator interface.
There is no AlgorithmParameterSpec class defined for DES so this
generator can only be initialised using the keysize,random
initialisation.
The returned key will be a non-weak key with odd parity.
-
ident
-
-
rand
-
-
DESKeyGenerator()
-
-
engineGenerateKey()
- Generates a secret key, setting odd parity and confirming that the
key is not a weak key.
-
engineInit(AlgorithmParameterSpec, SecureRandom)
- Initialises the key generator with the specified parameter set and
a user-provided source of randomness.
-
engineInit(SecureRandom)
- Initialises the key generator.
-
isWeakKey(byte[])
- DES has a number of weak keys.
-
setOddParity(byte[])
- DES Keys use the LSB as the odd parity bit.
ident
public final static String ident
rand
protected SecureRandom rand
DESKeyGenerator
public DESKeyGenerator()
engineInit
protected void engineInit(AlgorithmParameterSpec params,
SecureRandom random)
- Initialises the key generator with the specified parameter set and
a user-provided source of randomness.
- Overrides:
- engineInit in class KeyGeneratorSpi
engineInit
protected void engineInit(SecureRandom random)
- Initialises the key generator.
- Overrides:
- engineInit in class KeyGeneratorSpi
engineGenerateKey
protected SecretKey engineGenerateKey()
- Generates a secret key, setting odd parity and confirming that the
key is not a weak key.
- Returns:
- a secret key representing a DES key.
- Overrides:
- engineGenerateKey in class KeyGeneratorSpi
setOddParity
protected void setOddParity(byte bytes[])
- DES Keys use the LSB as the odd parity bit. This can
be used to check for corrupt keys.
- Parameters:
- bytes - the byte array to set the parity on.
isWeakKey
protected boolean isWeakKey(byte bytes[])
- DES has a number of weak keys. This method will check
the given key against the table of weak keys.
- Parameters:
- bytes - the key to check.
- Returns:
- true if the key is a known weak key false otherwise.
- See Also:
-
All Packages Class Hierarchy This Package Previous Next Index