APIdia Launch Partner
Top Inners Fields Constructors Methods
sun.security.ec

public Class XDHKeyAgreement

extends KeyAgreementSpi
Class Inheritance
Known Direct Subclasses
sun.security.ec.XDHKeyAgreement.X25519, sun.security.ec.XDHKeyAgreement.X448
Imports
sun.security.util.KeyUtil, java.security.InvalidAlgorithmParameterException, .InvalidKeyException, .NoSuchAlgorithmException, .Key, .SecureRandom, .ProviderException, java.security.interfaces.XECPrivateKey, .XECPublicKey, java.security.spec.AlgorithmParameterSpec, .NamedParameterSpec, javax.crypto.KeyAgreementSpi, .SecretKey, .ShortBufferException, javax.crypto.spec.SecretKeySpec, java.util.Arrays, java.util.function.Function

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
private XECParameters
private XECOperations
private XECPrivateKey
private byte[]

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv

Method Summary

Modifier and TypeMethod and Description
private boolean
allZero(byte[] arr)

private <T extends Throwable> void
protected Key
engineDoPhase(Key key, boolean lastPhase)

Implements abstract javax.crypto.KeyAgreementSpi.engineDoPhase.

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()

Implements abstract javax.crypto.KeyAgreementSpi.engineGenerateSecret.

Generates the shared secret and returns it in a new buffer.

protected int
engineGenerateSecret(byte[] sharedSecret, int offset)

Implements abstract javax.crypto.KeyAgreementSpi.engineGenerateSecret.

Generates the shared secret, and places it into the buffer sharedSecret, beginning at offset inclusive.

protected SecretKey
engineGenerateSecret(String algorithm)

Implements abstract javax.crypto.KeyAgreementSpi.engineGenerateSecret.

Creates the shared secret and returns it as a secret key object of the requested algorithm type.

protected void
engineInit(Key key, SecureRandom random)

Implements abstract javax.crypto.KeyAgreementSpi.engineInit.

Initializes this key agreement with the given key and source of randomness.

protected void
engineInit(Key key, final AlgorithmParameterSpec params, SecureRandom random)

Implements abstract javax.crypto.KeyAgreementSpi.engineInit.

Initializes this key agreement with the given key, set of algorithm parameters, and source of randomness.

private void

Field Detail

lockedParamsback to summary
private XECParameters lockedParams
opsback to summary
private XECOperations ops
privateKeyback to summary
private XECPrivateKey privateKey
secretback to summary
private byte[] secret

Constructor Detail

XDHKeyAgreementback to summary
pack-priv XDHKeyAgreement()
XDHKeyAgreementback to summary
pack-priv XDHKeyAgreement(AlgorithmParameterSpec paramSpec)

Method Detail

allZeroback to summary
private boolean allZero(byte[] arr)
checkLockedParamsback to summary
private <T extends Throwable> void checkLockedParams(Function<String, T> exception, XECParameters params) throws Function:T
engineDoPhaseback to summary
protected Key engineDoPhase(Key key, boolean lastPhase) throws InvalidKeyException, IllegalStateException

Implements abstract javax.crypto.KeyAgreementSpi.engineDoPhase.

Doc from javax.crypto.KeyAgreementSpi.engineDoPhase.

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.

Annotations
@Override
Exceptions
InvalidKeyException:
if the given key is inappropriate for this phase.
IllegalStateException:
if this key agreement has not been initialized.
engineGenerateSecretback to summary
protected byte[] engineGenerateSecret() throws IllegalStateException

Implements abstract javax.crypto.KeyAgreementSpi.engineGenerateSecret.

Doc from javax.crypto.KeyAgreementSpi.engineGenerateSecret.

Generates the shared secret and returns it in a new buffer.

This method resets this KeyAgreementSpi object to the state that it was in after the most recent call to one of the init methods. After a call to generateSecret, the object can be reused for further key agreement operations by calling doPhase to supply new keys, and then calling generateSecret to produce a new secret. In this case, the private information and algorithm parameters supplied to init will be used for multiple key agreement operations. The init method can be called after generateSecret to change the private information used in subsequent operations.

Annotations
@Override
Exceptions
IllegalStateException:
if this key agreement has not been initialized or if doPhase has not been called to supply the keys for all parties in the agreement
engineGenerateSecretback to summary
protected int engineGenerateSecret(byte[] sharedSecret, int offset) throws IllegalStateException, ShortBufferException

Implements abstract javax.crypto.KeyAgreementSpi.engineGenerateSecret.

Doc from javax.crypto.KeyAgreementSpi.engineGenerateSecret.

Generates the shared secret, and places it into the buffer 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 to the state that it was in after the most recent call to one of the init methods. After a call to generateSecret, the object can be reused for further key agreement operations by calling doPhase to supply new keys, and then calling generateSecret to produce a new secret. In this case, the private information and algorithm parameters supplied to init will be used for multiple key agreement operations. The init method can be called after generateSecret to change the private information used in subsequent operations.

Annotations
@Override
Exceptions
IllegalStateException:
if this key agreement has not been initialized or if doPhase has not been called to supply the keys for all parties in the agreement
ShortBufferException:
if the given output buffer is too small to hold the secret
engineGenerateSecretback to summary
protected SecretKey engineGenerateSecret(String algorithm) throws IllegalStateException, NoSuchAlgorithmException, InvalidKeyException

Implements abstract javax.crypto.KeyAgreementSpi.engineGenerateSecret.

Doc from javax.crypto.KeyAgreementSpi.engineGenerateSecret.

Creates the shared secret and returns it as a secret key object of the requested algorithm type.

This method resets this KeyAgreementSpi object to the state that it was in after the most recent call to one of the init methods. After a call to generateSecret, the object can be reused for further key agreement operations by calling doPhase to supply new keys, and then calling generateSecret to produce a new secret. In this case, the private information and algorithm parameters supplied to init will be used for multiple key agreement operations. The init method can be called after generateSecret to change the private information used in subsequent operations.

Annotations
@Override
Exceptions
IllegalStateException:
if this key agreement has not been initialized or if doPhase has not been called to supply the keys for all parties in the agreement
NoSuchAlgorithmException:
if the specified secret key algorithm is not supported
InvalidKeyException:
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)
engineInitback to summary
protected void engineInit(Key key, SecureRandom random) throws InvalidKeyException

Implements abstract javax.crypto.KeyAgreementSpi.engineInit.

Doc from javax.crypto.KeyAgreementSpi.engineInit.

Initializes this key agreement with the given key and source of randomness. The given key is required to contain all the algorithm parameters required for this key agreement.

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.

Annotations
@Override
Exceptions
InvalidKeyException:
if the given key is inappropriate for this key agreement, e.g., is of the wrong type or has an incompatible algorithm type.
engineInitback to summary
protected void engineInit(Key key, final AlgorithmParameterSpec params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException

Implements abstract javax.crypto.KeyAgreementSpi.engineInit.

Doc from javax.crypto.KeyAgreementSpi.engineInit.

Initializes this key agreement with the given key, set of algorithm parameters, and source of randomness.

Annotations
@Override
Exceptions
InvalidKeyException:
if the given key is inappropriate for this key agreement, e.g., is of the wrong type or has an incompatible algorithm type.
InvalidAlgorithmParameterException:
if the given parameters are inappropriate for this key agreement.
initImplback to summary
private void initImpl(Key key) throws InvalidKeyException
sun.security.ec back to summary

pack-priv Class XDHKeyAgreement.X25519

extends XDHKeyAgreement
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from sun.security.ec.XDHKeyAgreement:
engineDoPhaseengineGenerateSecretengineGenerateSecretengineGenerateSecretengineInitengineInit

Constructor Detail

X25519back to summary
public X25519()
sun.security.ec back to summary

pack-priv Class XDHKeyAgreement.X448

extends XDHKeyAgreement
Class Inheritance

Constructor Summary

AccessConstructor and Description
public
X448()

Method Summary

Inherited from sun.security.ec.XDHKeyAgreement:
engineDoPhaseengineGenerateSecretengineGenerateSecretengineGenerateSecretengineInitengineInit

Constructor Detail

X448back to summary
public X448()