public class EcdhStandardKeyAgreementKeychain
extends javax.crypto.KeyAgreementSpi
| Constructor and Description |
|---|
EcdhStandardKeyAgreementKeychain() |
| Modifier and Type | Method and Description |
|---|---|
protected java.security.Key |
engineDoPhase(java.security.Key publicKey,
boolean lastPhase)
Executes the next phase of this key agreement with the given key that was
received from one of the other parties involved in this key agreement.
|
protected byte[] |
engineGenerateSecret()
Generates the shared secret and returns it in a new buffer.
|
protected int |
engineGenerateSecret(byte[] sharedSecret,
int offset)
Generates the shared secret, and places it into the buffer
sharedSecret, beginning at offset inclusive. |
protected javax.crypto.SecretKey |
engineGenerateSecret(java.lang.String algorithm)
Creates the shared secret and returns it as a secret key object of the
requested algorithm type.
|
protected void |
engineInit(java.security.Key privateKey,
java.security.spec.AlgorithmParameterSpec params,
java.security.SecureRandom random)
Initializes this key agreement with the given key, set of algorithm
parameters, and source of randomness.
|
protected void |
engineInit(java.security.Key privateKey,
java.security.SecureRandom random)
Initializes this key agreement with the given key and source of
randomness.
|
protected java.security.Key engineDoPhase(java.security.Key publicKey,
boolean lastPhase)
throws java.security.InvalidKeyException,
java.lang.IllegalStateException
engineDoPhase in class javax.crypto.KeyAgreementSpipublicKey - [FIPS 140-2 data input] [FIPS 140-2 CSP] the key for this
phase. For example, in the case of Diffie-Hellman between 2
parties, this would be the other party's Diffie-Hellman public
key.lastPhase - [FIPS 140-2 control input] flag which indicates whether or not
this is the last phase of this key agreement.java.security.InvalidKeyException - [FIPS 140-2 status output] if the given key is
inappropriate for this phase.java.lang.IllegalStateException - [FIPS 140-2 status output] if this key agreement has not
been initialized.Fips140ErrorStateException - [FIPS 140-2 status output] thrown if the Toolkit is not
allowed to perform cryptographic operationsprotected byte[] engineGenerateSecret()
throws java.lang.IllegalStateException
This method resets this KeyAgreementSpi object, so that it
can be reused for further key agreements. Unless this key agreement is
reinitialized with one of the engineInit methods, the same
private information and algorithm parameters will be used for subsequent
key agreements.
engineGenerateSecret in class javax.crypto.KeyAgreementSpijava.lang.IllegalStateException - [FIPS 140-2 status output] if this key agreement has not
been completed yetFips140ErrorStateException - [FIPS 140-2 status output] thrown if the Toolkit is not
allowed to perform cryptographic operationsprotected javax.crypto.SecretKey engineGenerateSecret(java.lang.String algorithm)
throws java.lang.IllegalStateException,
java.security.NoSuchAlgorithmException,
java.security.InvalidKeyException
This method resets this KeyAgreementSpi object, so that it
can be reused for further key agreements. Unless this key agreement is
reinitialized with one of the engineInit methods, the same
private information and algorithm parameters will be used for subsequent
key agreements.
engineGenerateSecret in class javax.crypto.KeyAgreementSpialgorithm - [FIPS 140-2 control input] the requested secret key algorithmjava.lang.IllegalStateException - [FIPS 140-2 status output] if this key agreement has not
been completed yetjava.security.NoSuchAlgorithmException - [FIPS 140-2 status output] if the requested secret key
algorithm is not availablejava.security.InvalidKeyException - [FIPS 140-2 status output] if the shared secret key
material cannot be used to generate a secret key of the
requested algorithm type (e.g., the key material is too
short)Fips140ErrorStateException - [FIPS 140-2 status output] thrown if the Toolkit is not
allowed to perform cryptographic operationsprotected int engineGenerateSecret(byte[] sharedSecret,
int offset)
throws java.lang.IllegalStateException,
javax.crypto.ShortBufferException
sharedSecret, beginning at offset inclusive.
If the sharedSecret buffer is too small to hold the result,
a ShortBufferException is thrown. In this case, this call
should be repeated with a larger output buffer.
This method resets this KeyAgreementSpi object, so that it
can be reused for further key agreements. Unless this key agreement is
reinitialized with one of the engineInit methods, the same
private information and algorithm parameters will be used for subsequent
key agreements.
engineGenerateSecret in class javax.crypto.KeyAgreementSpisharedSecret - [FIPS 140-2 data output] [FIPS 140-2 CSP] the buffer for the
shared secretoffset - [FIPS 140-2 data input] the offset in
sharedSecret where the shared secret will be
storedsharedSecretjava.lang.IllegalStateException - [FIPS 140-2 status output] if this key agreement has not
been completed yetjavax.crypto.ShortBufferException - [FIPS 140-2 status output] if the given output buffer is
too small to hold the secretFips140ErrorStateException - [FIPS 140-2 status output] thrown if the Toolkit is not
allowed to perform cryptographic operationsprotected void engineInit(java.security.Key privateKey,
java.security.SecureRandom random)
throws java.security.InvalidKeyException
If the key agreement algorithm requires random bytes, it gets them from
the given source of randomness, random. However, if the
underlying algorithm implementation does not require any random bytes,
random is ignored.
engineInit in class javax.crypto.KeyAgreementSpiprivateKey - [FIPS 140-2 data input] [FIPS 140-2 CSP] the party's private
information. For example, in the case of the Diffie-Hellman
key agreement, this would be the party's own Diffie-Hellman
private key.random - [FIPS 140-2 control input] the source of randomnessjava.security.InvalidKeyException - [FIPS 140-2 status output] if the given key is
inappropriate for this key agreement, e.g., is of the
wrong type or has an incompatible algorithm type.Fips140ErrorStateException - [FIPS 140-2 status output] thrown if the Toolkit is not
allowed to perform cryptographic operationsprotected void engineInit(java.security.Key privateKey,
java.security.spec.AlgorithmParameterSpec params,
java.security.SecureRandom random)
throws java.security.InvalidKeyException,
java.security.InvalidAlgorithmParameterException
engineInit in class javax.crypto.KeyAgreementSpiprivateKey - [FIPS 140-2 data input] [FIPS 140-2 CSP] the party's private
information. For example, in the case of the Diffie-Hellman
key agreement, this would be the party's own Diffie-Hellman
private key.params - [FIPS 140-2 data input] the key agreement parametersrandom - [FIPS 140-2 control input] the source of randomnessjava.security.InvalidKeyException - [FIPS 140-2 status output] if the given key is
inappropriate for this key agreement, e.g., is of the
wrong type or has an incompatible algorithm type.java.security.InvalidAlgorithmParameterException - [FIPS 140-2 status output] if the given parameters are
inappropriate for this key agreement.Fips140ErrorStateException - [FIPS 140-2 status output] thrown if the Toolkit is not
allowed to perform cryptographic operations