Class BcTlsDHDomain

  • All Implemented Interfaces:
    TlsDHDomain

    public class BcTlsDHDomain
    extends java.lang.Object
    implements TlsDHDomain
    BC light-weight support class for Diffie-Hellman key pair generation and key agreement over a specified Diffie-Hellman configuration.
    • Field Detail

      • domainParameters

        protected final org.bouncycastle.crypto.params.DHParameters domainParameters
      • isPadded

        protected final boolean isPadded
    • Method Detail

      • calculateDHAgreement

        public static BcTlsSecret calculateDHAgreement​(BcTlsCrypto crypto,
                                                       org.bouncycastle.crypto.params.DHPrivateKeyParameters privateKey,
                                                       org.bouncycastle.crypto.params.DHPublicKeyParameters publicKey,
                                                       boolean padded)
      • getDomainParameters

        public static org.bouncycastle.crypto.params.DHParameters getDomainParameters​(TlsDHConfig dhConfig)
      • calculateDHAgreement

        public BcTlsSecret calculateDHAgreement​(org.bouncycastle.crypto.params.DHPrivateKeyParameters privateKey,
                                                org.bouncycastle.crypto.params.DHPublicKeyParameters publicKey)
      • createDH

        public TlsAgreement createDH()
        Description copied from interface: TlsDHDomain
        Return an agreement operator suitable for ephemeral Diffie-Hellman.
        Specified by:
        createDH in interface TlsDHDomain
        Returns:
        a key agreement operator.
      • decodeParameter

        public java.math.BigInteger decodeParameter​(byte[] encoding)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • decodePublicKey

        public org.bouncycastle.crypto.params.DHPublicKeyParameters decodePublicKey​(byte[] encoding)
                                                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • encodeParameter

        public byte[] encodeParameter​(java.math.BigInteger x)
      • encodePublicKey

        public byte[] encodePublicKey​(org.bouncycastle.crypto.params.DHPublicKeyParameters publicKey)
      • generateKeyPair

        public org.bouncycastle.crypto.AsymmetricCipherKeyPair generateKeyPair()