Class BcTlsECDH

java.lang.Object
org.bouncycastle.tls.crypto.impl.bc.BcTlsECDH
All Implemented Interfaces:
TlsAgreement

public class BcTlsECDH extends Object implements TlsAgreement
Support class for ephemeral Elliptic Curve Diffie-Hellman using the BC light-weight library.
  • Field Details

    • domain

      protected final BcTlsECDomain domain
    • localKeyPair

      protected org.bouncycastle.crypto.AsymmetricCipherKeyPair localKeyPair
    • peerPublicKey

      protected org.bouncycastle.crypto.params.ECPublicKeyParameters peerPublicKey
  • Constructor Details

  • Method Details

    • generateEphemeral

      public byte[] generateEphemeral() throws IOException
      Description copied from interface: TlsAgreement
      Generate an ephemeral key pair, returning the encoding of the public key.
      Specified by:
      generateEphemeral in interface TlsAgreement
      Returns:
      a byte encoding of the public key.
      Throws:
      IOException - in case of error.
    • receivePeerValue

      public void receivePeerValue(byte[] peerValue) throws IOException
      Description copied from interface: TlsAgreement
      Pass in the public key for the peer to the agreement calculator.
      Specified by:
      receivePeerValue in interface TlsAgreement
      Parameters:
      peerValue - a byte encoding of the peer public key.
      Throws:
      IOException - in case of error.
    • calculateSecret

      public TlsSecret calculateSecret() throws IOException
      Description copied from interface: TlsAgreement
      Calculate the agreed secret based on the calculator's current state.
      Specified by:
      calculateSecret in interface TlsAgreement
      Returns:
      the calculated secret.
      Throws:
      IOException - in case of error.