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.


Variable Index

 o ident
 o rand

Constructor Index

 o DESKeyGenerator()

Method Index

 o engineGenerateKey()
Generates a secret key, setting odd parity and confirming that the key is not a weak key.
 o engineInit(AlgorithmParameterSpec, SecureRandom)
Initialises the key generator with the specified parameter set and a user-provided source of randomness.
 o engineInit(SecureRandom)
Initialises the key generator.
 o isWeakKey(byte[])
DES has a number of weak keys.
 o setOddParity(byte[])
DES Keys use the LSB as the odd parity bit.

Variables

 o ident
  public final static String ident
 o rand
  protected SecureRandom rand

Constructors

 o DESKeyGenerator
  public DESKeyGenerator()

Methods

 o 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
 o engineInit
  protected void engineInit(SecureRandom random)
Initialises the key generator.
Overrides:
engineInit in class KeyGeneratorSpi
 o 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
 o 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.
 o 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