Class Curve25519DH


  • public class Curve25519DH
    extends DHBase
    Key Exchange Method using Curve25519 as defined in RFC 8731
    • Constructor Summary

      Constructors 
      Constructor Description
      Curve25519DH()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) void computeK​(byte[] peerPublicKey)
      Compute Shared Secret Key using Diffie-Hellman Curve25519 known as X25519
      private java.security.spec.KeySpec getPeerPublicKeySpec​(byte[] peerPublicKey)  
      void init​(java.security.spec.AlgorithmParameterSpec params, Factory<Random> randomFactory)
      Initialize Key Agreement with generated Public and Private Key Pair
      private void setPublicKey​(java.security.PublicKey publicKey)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • ENCODED_ALGORITHM_ID_KEY_LENGTH

        private static final int ENCODED_ALGORITHM_ID_KEY_LENGTH
        See Also:
        Constant Field Values
      • algorithmId

        private final byte[] algorithmId
    • Constructor Detail

      • Curve25519DH

        public Curve25519DH()
    • Method Detail

      • computeK

        void computeK​(byte[] peerPublicKey)
               throws java.security.GeneralSecurityException
        Compute Shared Secret Key using Diffie-Hellman Curve25519 known as X25519
        Specified by:
        computeK in class DHBase
        Parameters:
        peerPublicKey - Peer public key bytes
        Throws:
        java.security.GeneralSecurityException - Thrown on key agreement failures
      • init

        public void init​(java.security.spec.AlgorithmParameterSpec params,
                         Factory<Random> randomFactory)
                  throws java.security.GeneralSecurityException
        Initialize Key Agreement with generated Public and Private Key Pair
        Specified by:
        init in class DHBase
        Parameters:
        params - Parameters not used
        randomFactory - Random Factory not used
        Throws:
        java.security.GeneralSecurityException - Thrown on key agreement initialization failures
      • setPublicKey

        private void setPublicKey​(java.security.PublicKey publicKey)
      • getPeerPublicKeySpec

        private java.security.spec.KeySpec getPeerPublicKeySpec​(byte[] peerPublicKey)