iaik.security.cipher
Class TwofishKeyGenerator

java.lang.Object
  |
  +--javax.crypto.KeyGeneratorSpi
        |
        +--iaik.security.cipher.VarLengthKeyGenerator
              |
              +--iaik.security.cipher.TwofishKeyGenerator

public class TwofishKeyGenerator
extends iaik.security.cipher.VarLengthKeyGenerator

This class provides the functionality of KeyGenerator for generating keys to be used by the Twofish cipher.

An application uses

 KeyGenerator key_gen = KeyGenerator.getInstance("Twofish");
 
for creating a KeyGenerator object for the Twofish algorithm. For actually generating the requested secret key from the KeyGenerator object just created, an application calls the generateKey method after having initialized the generator with some random seed or relied on the default system-provided source of randomness:

 SecretKey new_key = key_gen.generateKey();
 

Version:
File Revision 8
See Also:
KeyGenerator, KeyGeneratorSpi, SecretKey, SecretKey, Twofish

Constructor Summary
TwofishKeyGenerator()
          Creates a new Twofish key generator.
 
Method Summary
protected  SecretKey engineGenerateKey()
          Generates a new key.
protected  void engineInit(AlgorithmParameterSpec params, SecureRandom random)
          Initializes this key generator.
protected  void engineInit(int strength, SecureRandom random)
          Initializes this key generator for the given strength with the given random seed.
protected  void engineInit(SecureRandom random)
          Initializes this key generator with the given random seed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TwofishKeyGenerator

public TwofishKeyGenerator()
Creates a new Twofish key generator. The name for the generated key is Twofish, length is either 128, 192, or 256 bit.
Method Detail

engineInit

protected void engineInit(AlgorithmParameterSpec params,
                          SecureRandom random)
                   throws InvalidAlgorithmParameterException
Initializes this key generator. If params is not null, otherwise this call is identical to engineInit(random).
Overrides:
engineInit in class KeyGeneratorSpi
Throws:
InvalidAlgorithmParameterException - if parameters are passed

engineInit

protected void engineInit(int strength,
                          SecureRandom random)
Initializes this key generator for the given strength with the given random seed. Lengths outside the range of minimum to maximum length default to the default length.
Overrides:
engineInit in class KeyGeneratorSpi
Parameters:
strength - the strength of the key to be created
random - the random seed

engineInit

protected void engineInit(SecureRandom random)
Initializes this key generator with the given random seed. The strength defaults to the default length.
Overrides:
engineInit in class KeyGeneratorSpi
Parameters:
random - the random seed for this generator

engineGenerateKey

protected SecretKey engineGenerateKey()
Generates a new key.
Overrides:
engineGenerateKey in class KeyGeneratorSpi
Returns:
the created key
See Also:
SecretKey

This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note).

IAIK-JCE 3.1 with IAIK-JCE CC Core 3.1, (c) 1997-2004 IAIK