de.flexiprovider.core.shacal2
Class Shacal2KeyGenerator

java.lang.Object
  |
  +--javax.crypto.KeyGeneratorSpi
        |
        +--de.flexiprovider.api.keys.SecretKeyGenerator
              |
              +--de.flexiprovider.core.shacal2.Shacal2KeyGenerator

public class Shacal2KeyGenerator
extends SecretKeyGenerator

This class is used to generate keys for the Shacal2 block cipher. Values for the key are 128, 192, 256, 320, 384, and 448 bits, with the default being 128 bits.

Author:
Paul Nguentcheu

Constructor Summary
Shacal2KeyGenerator()
           
 
Method Summary
 SecretKey generateKey()
          Generate a Shacal2 key.
 void init(AlgorithmParameterSpec params, SecureRandom random)
          Initialize the key generator with the given parameters (which have to be an instance of Shacal2KeyGenParameterSpec) and a source of randomness.
 void init(int keySize, SecureRandom random)
          Initialize the key generator for a certain key size, using the given source of randomness.
 void init(SecureRandom random)
          Initialize the key generator with the given source of randomness.
 
Methods inherited from class de.flexiprovider.api.keys.SecretKeyGenerator
engineGenerateKey, engineInit, engineInit, engineInit, init, init, init
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Shacal2KeyGenerator

public Shacal2KeyGenerator()
Method Detail

init

public void init(AlgorithmParameterSpec params,
                 SecureRandom random)
          throws InvalidAlgorithmParameterException
Initialize the key generator with the given parameters (which have to be an instance of Shacal2KeyGenParameterSpec) and a source of randomness. If the parameters are null, the default parameters are used.
Overrides:
init in class SecretKeyGenerator
Parameters:
params - the parameters
random - the source of randomness
Throws:
InvalidAlgorithmParameterException - if the parameters are not an instance of Shacal2KeyGenParameterSpec.

init

public void init(int keySize,
                 SecureRandom random)
Initialize the key generator for a certain key size, using the given source of randomness. If the key size is invalid, the default key length is chosen (see Shacal2KeyGenParameterSpec).
Overrides:
init in class SecretKeyGenerator
Parameters:
keySize - the key size (128, 192, 256, 320, 384, or 448 bits)
random - the source of randomness

init

public void init(SecureRandom random)
Initialize the key generator with the given source of randomness. The default key size is chosen (see Shacal2KeyGenParameterSpec).
Overrides:
init in class SecretKeyGenerator
Parameters:
random - the source of randomness

generateKey

public SecretKey generateKey()
Generate a Shacal2 key.
Overrides:
generateKey in class SecretKeyGenerator
Returns:
the generated Shacal2Key