public abstract class KeyGeneratorSpi extends Object
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"
).
KeyGenerator
Constructor and Description |
---|
KeyGeneratorSpi()
Create a new key generator SPI.
|
Modifier and Type | Method and Description |
---|---|
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).
|
public KeyGeneratorSpi()
protected abstract SecretKey engineGenerateKey()
SecretKey
.protected abstract void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException
params
- The parameters.random
- The source of randomness.InvalidAlgorithmParameterException
- If the
parameters are inappropriate for this instance.protected abstract void engineInit(int keySize, SecureRandom random)
keySize
- The target key size, in bits.random
- The source of randomness.InvalidParameterException
- If the
key size is illogical or unsupported.protected abstract void engineInit(SecureRandom random)
random
- The source of randomness.