javax.crypto
public abstract class KeyGeneratorSpi extends Object
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 java.security.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).
|
Returns: The generated key.
Parameters: params The parameters. random The source of randomness.
Throws: java.security.InvalidAlgorithmParameterException If the parameters are inappropriate for this instance.
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.
Parameters: random The source of randomness.