Package org.conscrypt
Class OpenSSLBaseDHKeyAgreement<T>
java.lang.Object
javax.crypto.KeyAgreementSpi
org.conscrypt.OpenSSLBaseDHKeyAgreement<T>
- Direct Known Subclasses:
OpenSSLECDHKeyAgreement,OpenSSLXDHKeyAgreement
Generic base classe for Diffie-Hellman style key agreement backed by the OpenSSL engine.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract intcomputeKey(byte[] buffer, T theirPublicKey, T ourPrivateKey) Given the public keytheirPublicKeyand the private keyourPrivateKeywrite the shared secret tobufferand return the actual output size.protected abstract Tprotected abstract TengineDoPhase(Key key, boolean lastPhase) protected byte[]protected intengineGenerateSecret(byte[] sharedSecret, int offset) protected SecretKeyengineGenerateSecret(String algorithm) protected voidengineInit(Key key, SecureRandom random) protected voidengineInit(Key key, AlgorithmParameterSpec params, SecureRandom random) protected abstract intgetOutputSize(T key) Returns the expected result length for the givenkey.
-
Constructor Details
-
OpenSSLBaseDHKeyAgreement
protected OpenSSLBaseDHKeyAgreement()
-
-
Method Details
-
engineDoPhase
- Specified by:
engineDoPhasein classKeyAgreementSpi- Throws:
InvalidKeyException
-
convertPublicKey
- Throws:
InvalidKeyException
-
convertPrivateKey
- Throws:
InvalidKeyException
-
computeKey
protected abstract int computeKey(byte[] buffer, T theirPublicKey, T ourPrivateKey) throws InvalidKeyException Given the public keytheirPublicKeyand the private keyourPrivateKeywrite the shared secret tobufferand return the actual output size.- Throws:
InvalidKeyException
-
engineGenerateSecret
- Specified by:
engineGenerateSecretin classKeyAgreementSpi- Throws:
ShortBufferException
-
engineGenerateSecret
protected byte[] engineGenerateSecret()- Specified by:
engineGenerateSecretin classKeyAgreementSpi
-
engineGenerateSecret
- Specified by:
engineGenerateSecretin classKeyAgreementSpi
-
engineInit
- Specified by:
engineInitin classKeyAgreementSpi- Throws:
InvalidKeyException
-
getOutputSize
Returns the expected result length for the givenkey. -
engineInit
protected void engineInit(Key key, AlgorithmParameterSpec params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException - Specified by:
engineInitin classKeyAgreementSpi- Throws:
InvalidKeyExceptionInvalidAlgorithmParameterException
-