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

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)
This method is not implemented as there is no AlgorithmParameterSpec defined for DES.
 o engineInit(int, SecureRandom)
Since DES keys are of a fixed size, this method does nothing except set the random source.
 o engineInit(SecureRandom)
Initialises the key generator with the given random number source.
 o setOddParity(byte[])
DES Keys use the LSB as the odd parity bit.

Variables

 o ident
 public static final String ident

Constructors

 o DESKeyGenerator
 public DESKeyGenerator()

Methods

 o engineInit
 protected void engineInit(AlgorithmParameterSpec params,
                           SecureRandom random) throws InvalidAlgorithmParameterException
This method is not implemented as there is no AlgorithmParameterSpec defined for DES. (Use one of the other initialisation methods!)

Parameters:
params - the algorithm parameter specs for this generator.
random - a source of random numbers for this generator.
Throws: InvalidAlgorithmParameterException
An invalid parameter specification is provided.
Overrides:
engineInit in class KeyGeneratorSpi
 o engineInit
 protected void engineInit(SecureRandom random)
Initialises the key generator with the given random number source.

Parameters:
random - a source of random numbers for this generator.
Overrides:
engineInit in class KeyGeneratorSpi
 o engineInit
 protected void engineInit(int strength,
                           SecureRandom random)
Since DES keys are of a fixed size, this method does nothing except set the random source.

Parameters:
strength - the strength of the key. This parameter is ignored.
random - the source of randomness for this 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.

All Packages  Class Hierarchy  This Package  Previous  Next  Index