Class KeyPair


  • public class KeyPair
    extends java.lang.Object
    Represents a Curve25519 key pair as used by WireGuard.

    Instances of this class are immutable.

    • Constructor Summary

      Constructors 
      Constructor Description
      KeyPair()
      Creates a key pair using a newly-generated private key.
      KeyPair​(Key privateKey)
      Creates a key pair using an existing private key.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Key getPrivateKey()
      Returns the private key from the key pair.
      Key getPublicKey()
      Returns the public key from the key pair.
      • Methods inherited from class java.lang.Object

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

      • KeyPair

        public KeyPair()
        Creates a key pair using a newly-generated private key.
      • KeyPair

        public KeyPair​(Key privateKey)
        Creates a key pair using an existing private key.
        Parameters:
        privateKey - a private key, used to derive the public key
    • Method Detail

      • getPrivateKey

        public Key getPrivateKey()
        Returns the private key from the key pair.
        Returns:
        the private key
      • getPublicKey

        public Key getPublicKey()
        Returns the public key from the key pair.
        Returns:
        the public key