Package org.conscrypt
Class OpenSSLECDHKeyAgreement
- java.lang.Object
-
- javax.crypto.KeyAgreementSpi
-
- org.conscrypt.OpenSSLECDHKeyAgreement
-
@Internal public final class OpenSSLECDHKeyAgreement extends javax.crypto.KeyAgreementSpi
Elliptic Curve Diffie-Hellman key agreement backed by the OpenSSL engine.
-
-
Field Summary
Fields Modifier and Type Field Description private int
mExpectedResultLength
Expected length (in bytes) of the agreed key (mResult
).private OpenSSLKey
mOpenSslPrivateKey
OpenSSL handle of the private key.private byte[]
mResult
Agreed key.
-
Constructor Summary
Constructors Constructor Description OpenSSLECDHKeyAgreement()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
checkCompleted()
java.security.Key
engineDoPhase(java.security.Key key, boolean lastPhase)
protected byte[]
engineGenerateSecret()
protected int
engineGenerateSecret(byte[] sharedSecret, int offset)
protected javax.crypto.SecretKey
engineGenerateSecret(java.lang.String algorithm)
protected void
engineInit(java.security.Key key, java.security.SecureRandom random)
protected void
engineInit(java.security.Key key, java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random)
-
-
-
Field Detail
-
mOpenSslPrivateKey
private OpenSSLKey mOpenSslPrivateKey
OpenSSL handle of the private key. Only available after the engine has been initialized.
-
mExpectedResultLength
private int mExpectedResultLength
Expected length (in bytes) of the agreed key (mResult
). Only available after the engine has been initialized.
-
mResult
private byte[] mResult
Agreed key. Only available afterengineDoPhase(Key, boolean)
completes.
-
-
Method Detail
-
engineDoPhase
public java.security.Key engineDoPhase(java.security.Key key, boolean lastPhase) throws java.security.InvalidKeyException
- Specified by:
engineDoPhase
in classjavax.crypto.KeyAgreementSpi
- Throws:
java.security.InvalidKeyException
-
engineGenerateSecret
protected int engineGenerateSecret(byte[] sharedSecret, int offset) throws javax.crypto.ShortBufferException
- Specified by:
engineGenerateSecret
in classjavax.crypto.KeyAgreementSpi
- Throws:
javax.crypto.ShortBufferException
-
engineGenerateSecret
protected byte[] engineGenerateSecret()
- Specified by:
engineGenerateSecret
in classjavax.crypto.KeyAgreementSpi
-
engineGenerateSecret
protected javax.crypto.SecretKey engineGenerateSecret(java.lang.String algorithm)
- Specified by:
engineGenerateSecret
in classjavax.crypto.KeyAgreementSpi
-
engineInit
protected void engineInit(java.security.Key key, java.security.SecureRandom random) throws java.security.InvalidKeyException
- Specified by:
engineInit
in classjavax.crypto.KeyAgreementSpi
- Throws:
java.security.InvalidKeyException
-
engineInit
protected void engineInit(java.security.Key key, java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException
- Specified by:
engineInit
in classjavax.crypto.KeyAgreementSpi
- Throws:
java.security.InvalidKeyException
java.security.InvalidAlgorithmParameterException
-
checkCompleted
private void checkCompleted()
-
-