javax.crypto

Class 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 SecretKeyengineGenerateKey()
Generate a key, returning it as a SecretKey.
protected abstract voidengineInit(AlgorithmParameterSpec params, SecureRandom random)
Initialize this key generator with parameters and a source of randomness.
protected abstract voidengineInit(int keySize, SecureRandom random)
Initialize this key generator with a key size (in bits) and a source of randomness.
protected abstract voidengineInit(SecureRandom random)
Initialize this key generator with a source of randomness; the implementation should use reasonable default parameters (such as generated key size).

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)
Initialize this key generator with parameters and a source of randomness.

Parameters: params The parameters. random The source of randomness.

Throws: java.security.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: java.security.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.