Class JceTlsDHDomain

  • All Implemented Interfaces:
    TlsDHDomain

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

      • dhParameterSpec

        protected final javax.crypto.spec.DHParameterSpec dhParameterSpec
    • Method Detail

      • calculateDHAgreement

        public static JceTlsSecret calculateDHAgreement​(JcaTlsCrypto crypto,
                                                        javax.crypto.interfaces.DHPrivateKey privateKey,
                                                        javax.crypto.interfaces.DHPublicKey publicKey,
                                                        boolean padded)
                                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • getParameters

        public static javax.crypto.spec.DHParameterSpec getParameters​(TlsDHConfig dhConfig)
      • calculateDHAgreement

        public JceTlsSecret calculateDHAgreement​(javax.crypto.interfaces.DHPrivateKey privateKey,
                                                 javax.crypto.interfaces.DHPublicKey publicKey)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • 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 javax.crypto.interfaces.DHPublicKey decodePublicKey​(byte[] encoding)
                                                            throws java.io.IOException
        Throws:
        java.io.IOException
      • encodeParameter

        public byte[] encodeParameter​(java.math.BigInteger x)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • encodePublicKey

        public byte[] encodePublicKey​(javax.crypto.interfaces.DHPublicKey publicKey)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • generateKeyPair

        public java.security.KeyPair generateKeyPair()
                                              throws java.io.IOException
        Throws:
        java.io.IOException