au.net.aba.crypto.provider
Class RC5KeyGenerator

java.lang.Object
  |
  +--javax.crypto.KeyGeneratorSpi
        |
        +--au.net.aba.crypto.provider.RC5KeyGenerator

public class RC5KeyGenerator
extends KeyGeneratorSpi

Implements a Key Generator for Secret keys to use with the RC5 cipher. This class was modeled after the RC4KeyGenerator

There is no AlgorithmParameterSpec class defined for RC4 so this generator can only be initialised using the keysize,random initialisation.

The default keysize is 64 bits, and may be any multiple of 8 less than (or equal to) 256.


Fields inherited from class javax.crypto.KeyGeneratorSpi
ident
 
Constructor Summary
RC5KeyGenerator()
           
 
Method Summary
protected  SecretKey engineGenerateKey()
          Generates a SecretKey
protected  void engineInit(java.security.spec.AlgorithmParameterSpec keyParams, java.security.SecureRandom random)
          Initializes the key generator with the specified parameter set and a user-provided source of randomness.
protected  void engineInit(int keySize, java.security.SecureRandom random)
          Initializes the key generator with the number of bits to use and a user-provided source of randomness.
protected  void engineInit(java.security.SecureRandom random)
          Initializes the key generator with a user-provided source of randomness.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RC5KeyGenerator

public RC5KeyGenerator()
Method Detail

engineInit

protected void engineInit(java.security.spec.AlgorithmParameterSpec keyParams,
                          java.security.SecureRandom random)
                   throws java.security.InvalidAlgorithmParameterException
Initializes the key generator with the specified parameter set and a user-provided source of randomness.

There are no parameters supported for RC5. Calling this method will result in an InvalidAlgorithmParameterException being thrown.

Overrides:
engineInit in class KeyGeneratorSpi
Parameters:
keyParams - key generation parameters
random - source for invoking randomness

engineInit

protected void engineInit(java.security.SecureRandom random)
Initializes the key generator with a user-provided source of randomness.

Overrides:
engineInit in class KeyGeneratorSpi
Parameters:
random - source for invoking randomness

engineInit

protected void engineInit(int keySize,
                          java.security.SecureRandom random)
Initializes the key generator with the number of bits to use and a user-provided source of randomness.

Overrides:
engineInit in class KeyGeneratorSpi
Parameters:
keyParams - key generation parameters
random - source for invoking randomness

engineGenerateKey

protected SecretKey engineGenerateKey()
Generates a SecretKey

Overrides:
engineGenerateKey in class KeyGeneratorSpi
Returns:
the new secret key