au.net.aba.crypto.provider
Class TwofishKeyGenerator

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

public class TwofishKeyGenerator
extends KeyGeneratorSpi

This class is used for generating random Twofish keys. This class should not be instantiated directly, instead use the javax.crypto.KeyGenerator interface.

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

The default keysize is 128 bits, and may be up to 256 bits long.


Field Summary
static java.lang.String ident
           
 
Fields inherited from class javax.crypto.KeyGeneratorSpi
ident
 
Constructor Summary
TwofishKeyGenerator()
           
 
Method Summary
protected  SecretKey engineGenerateKey()
          Generates a random secret key.
protected  void engineInit(java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random)
          This method is not implemented as there is no AlgorithmParameterSpec defined for Twofish.
protected  void engineInit(int strength, java.security.SecureRandom random)
          Initialises this key generator for a certain strength, using the given source of randomness.
protected  void engineInit(java.security.SecureRandom random)
          Initialises the key generator with the given random source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ident

public static final java.lang.String ident
Constructor Detail

TwofishKeyGenerator

public TwofishKeyGenerator()
Method Detail

engineInit

protected void engineInit(java.security.spec.AlgorithmParameterSpec params,
                          java.security.SecureRandom random)
                   throws java.security.InvalidAlgorithmParameterException
This method is not implemented as there is no AlgorithmParameterSpec defined for Twofish. (Use one of the other initialisation methods!)
Overrides:
engineInit in class KeyGeneratorSpi
Parameters:
params - the algorithm parameter specs for this generator.
random - a source of random numbers for this generator.
Throws:
java.security.InvalidAlgorithmParameterException - An invalid parameter specification is provided.

engineInit

protected void engineInit(int strength,
                          java.security.SecureRandom random)
Initialises this key generator for a certain strength, using the given source of randomness.
Overrides:
engineInit in class KeyGeneratorSpi
Parameters:
strength - the strength of the key. This is an algorithm-specific metric specified in number of bits.
random - the source of randomness for this key generator

engineInit

protected void engineInit(java.security.SecureRandom random)
Initialises the key generator with the given random source.
Overrides:
engineInit in class KeyGeneratorSpi
Parameters:
random - a source of random numbers for this generator.

engineGenerateKey

protected SecretKey engineGenerateKey()
Generates a random secret key.
Overrides:
engineGenerateKey in class KeyGeneratorSpi
Returns:
a secret key representing a Twofish key.