public abstract class KeyAgreementSpi extends Object
KeyAgreement class.| Constructor and Description |
|---|
KeyAgreementSpi()
Creates a new
KeyAgreementSpi instance. |
| Modifier and Type | Method and Description |
|---|---|
protected abstract Key |
engineDoPhase(Key key,
boolean lastPhase)
Does the next (or the last) phase of the key agreement, using the
specified key.
|
protected abstract byte[] |
engineGenerateSecret()
Generates the shared secret.
|
protected abstract int |
engineGenerateSecret(byte[] sharedSecret,
int offset)
Generates the shared secret and stores it into the buffer
sharedSecred at offset. |
protected abstract SecretKey |
engineGenerateSecret(String algorithm)
Generates the shared secret.
|
protected abstract void |
engineInit(Key key,
AlgorithmParameterSpec params,
SecureRandom random)
Initializes this
KeyAgreementSpi with the specified key,
algorithm parameters and randomness source. |
protected abstract void |
engineInit(Key key,
SecureRandom random)
Initializes this
KeyAgreementSpi with the specified key and the
specified randomness source. |
protected abstract Key engineDoPhase(Key key, boolean lastPhase) throws InvalidKeyException, IllegalStateException
key - the key received from the other party for this phase.lastPhase - set to true if this is the last phase of this key
agreement.InvalidKeyException - if the specified key cannot be used in this key agreement or
this phase,IllegalStateException - if this instance has not been initialized.protected abstract byte[] engineGenerateSecret()
throws IllegalStateException
IllegalStateException - if this key agreement is not complete.protected abstract int engineGenerateSecret(byte[] sharedSecret,
int offset)
throws IllegalStateException,
ShortBufferException
sharedSecred at offset.sharedSecret - the buffer to store the shared secret.offset - the offset in the buffer.IllegalStateException - if this key agreement is not complete.ShortBufferException - if the specified buffer is too small for the shared secret.protected abstract SecretKey engineGenerateSecret(String algorithm) throws IllegalStateException, NoSuchAlgorithmException, InvalidKeyException
algorithm - the algorithm to for the SecretKeySecretKey of the specified
algorithm.IllegalStateException - if this key agreement is not complete.NoSuchAlgorithmException - if the specified algorithm for the secret key does not
exists.InvalidKeyException - if a SecretKey with the specified algorithm cannot be
created using the generated shared secret.protected abstract void engineInit(Key key, SecureRandom random) throws InvalidKeyException
KeyAgreementSpi with the specified key and the
specified randomness source.key - the key to initialize this key agreement.random - the source for any randomness needed.InvalidKeyException - if the specified key cannot be used to initialize this key
agreement.protected abstract void engineInit(Key key, AlgorithmParameterSpec params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException
KeyAgreementSpi with the specified key,
algorithm parameters and randomness source.key - the key to initialize this key agreement.params - the parameters for this key agreement algorithm.random - the source for any randomness needed.InvalidKeyException - if the specified key cannot be used to initialize this key
agreement.InvalidAlgorithmParameterException - if the specified parameters are invalid for this key
agreement algorithm.