javax.crypto
Class KeyGeneratorSpi

java.lang.Object
  extended by javax.crypto.KeyGeneratorSpi

public abstract class KeyGeneratorSpi
extends Object

The Service Provider Interface (SPI) for the KeyGenerator class.

Providers wishing to implement a key generator must subclass this and provide an appropriate implementation for all the abstract methods below, and provide an appropriate entry in the master Provider class (the service name for key generators is "KeyGenerator").

Since:
1.4
See Also:
KeyGenerator

Constructor Summary
KeyGeneratorSpi()
          Create a new key generator SPI.
 
Method Summary
protected abstract  SecretKey engineGenerateKey()
          Generate a key, returning it as a SecretKey.
protected abstract  void engineInit(AlgorithmParameterSpec params, SecureRandom random)
          Initialize this key generator with parameters and a source of randomness.
protected abstract  void engineInit(int keySize, SecureRandom random)
          Initialize this key generator with a key size (in bits) and a source of randomness.
protected abstract  void engineInit(SecureRandom random)
          Initialize this key generator with a source of randomness; the implementation should use reasonable default parameters (such as generated key size).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyGeneratorSpi

public KeyGeneratorSpi()
Create a new key generator SPI.

Method Detail

engineGenerateKey

protected abstract SecretKey engineGenerateKey()
Generate a key, returning it as a SecretKey.

Returns:
The generated key.

engineInit

protected abstract void engineInit(AlgorithmParameterSpec params,
                                   SecureRandom random)
                            throws InvalidAlgorithmParameterException
Initialize this key generator with parameters and a source of randomness.

Parameters:
params - The parameters.
random - The source of randomness.
Throws:
InvalidAlgorithmParameterException - If the parameters are inappropriate for this instance.

engineInit

protected abstract void engineInit(int keySize,
                                   SecureRandom random)
Initialize this key generator with a key size (in bits) and a source of randomness.

Parameters:
keySize - The target key size, in bits.
random - The source of randomness.
Throws:
InvalidParameterException - If the key size is illogical or unsupported.

engineInit

protected abstract void engineInit(SecureRandom random)
Initialize this key generator with a source of randomness; the implementation should use reasonable default parameters (such as generated key size).

Parameters:
random - The source of randomness.