Class BcTlsDH
java.lang.Object
org.bouncycastle.tls.crypto.impl.bc.BcTlsDH
- All Implemented Interfaces:
TlsAgreement
Support class for ephemeral Diffie-Hellman using the BC light-weight library.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final BcTlsDHDomain
protected org.bouncycastle.crypto.AsymmetricCipherKeyPair
protected org.bouncycastle.crypto.params.DHPublicKeyParameters
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionCalculate the agreed secret based on the calculator's current state.byte[]
Generate an ephemeral key pair, returning the encoding of the public key.void
receivePeerValue
(byte[] peerValue) Pass in the public key for the peer to the agreement calculator.
-
Field Details
-
domain
-
localKeyPair
protected org.bouncycastle.crypto.AsymmetricCipherKeyPair localKeyPair -
peerPublicKey
protected org.bouncycastle.crypto.params.DHPublicKeyParameters peerPublicKey
-
-
Constructor Details
-
BcTlsDH
-
-
Method Details
-
generateEphemeral
Description copied from interface:TlsAgreement
Generate an ephemeral key pair, returning the encoding of the public key.- Specified by:
generateEphemeral
in interfaceTlsAgreement
- Returns:
- a byte encoding of the public key.
- Throws:
IOException
- in case of error.
-
receivePeerValue
Description copied from interface:TlsAgreement
Pass in the public key for the peer to the agreement calculator.- Specified by:
receivePeerValue
in interfaceTlsAgreement
- Parameters:
peerValue
- a byte encoding of the peer public key.- Throws:
IOException
- in case of error.
-
calculateSecret
Description copied from interface:TlsAgreement
Calculate the agreed secret based on the calculator's current state.- Specified by:
calculateSecret
in interfaceTlsAgreement
- Returns:
- the calculated secret.
- Throws:
IOException
- in case of error.
-