Class NoiseHandshakeBuilder

java.lang.Object
com.eatthepath.noise.NoiseHandshakeBuilder

public class NoiseHandshakeBuilder extends Object

A Noise handshake builder constructs NoiseHandshake instances with known handshake patterns and roles. In contrast to NamedProtocolHandshakeBuilder, this builder provides compile-time checks that all required keys are provided, but places the burden of selecting protocol components (key agreement algorithms, ciphers, and hash algorithms) on the caller.

Callers may specify the cryptographic components of a Noise protocol by providing a full Noise protocol name…

final NoiseHandshake ikInitiatorHandshake =
    NoiseHandshakeBuilder.forIKInitiator(initiatorLocalStaticKeyPair, initiatorRemoteStaticPublicKey)
        .setComponentsFromProtocolName("Noise_IK_25519_ChaChaPoly_SHA256")
        .build();

…or by specifying the name of each component individually:

final NoiseHandshake ikResponderHandshake =
    NoiseHandshakeBuilder.forIKResponder(responderLocalStaticKeyPair)
        .setKeyAgreement("25519")
        .setCipher("ChaChaPoly")
        .setHash("SHA256")
        .build();
See Also:
  • Method Details

    • setPrologue

      public NoiseHandshakeBuilder setPrologue(@Nullable byte[] prologue)
      Sets the prologue for this handshake.
      Parameters:
      prologue - the prologue for this handshake; may be null
      Returns:
      a reference to this handshake builder
    • setComponentsFromProtocolName

      public NoiseHandshakeBuilder setComponentsFromProtocolName(String protocolName) throws NoSuchAlgorithmException
      Sets the cryptographic components (key agreement, cipher, and hash algorithms) for this handshake from a full Noise protocol name.
      Parameters:
      protocolName - the Noise protocol name from which to choose cryptographic components for this handshake
      Returns:
      a reference to this handshake builder
      Throws:
      NoSuchAlgorithmException - if one or more of the components in the given protocol name is not supported by the current JVM
      IllegalArgumentException - if the given protocol name is not a valid Noise protocol name or if its handshake pattern does not match the handshake pattern selected for this handshake
      See Also:
    • setCipher

      public NoiseHandshakeBuilder setCipher(String cipherName) throws NoSuchAlgorithmException
      Sets the cipher to be used by this handshake.
      Parameters:
      cipherName - the name of the Noise cipher to be used by this handshake
      Returns:
      a reference to this handshake builder
      Throws:
      NoSuchAlgorithmException - if the named algorithm is not supported by the current JVM
      IllegalArgumentException - if the given name is not recognized as a Noise cipher name
      See Also:
    • setHash

      public NoiseHandshakeBuilder setHash(String hashName) throws NoSuchAlgorithmException
      Sets the hash algorithm to be used by this handshake.
      Parameters:
      hashName - the name of the Noise hash to be used by this handshake
      Returns:
      a reference to this handshake builder
      Throws:
      NoSuchAlgorithmException - if the named algorithm is not supported by the current JVM
      IllegalArgumentException - if the given name is not recognized as a Noise hash name
      See Also:
    • setKeyAgreement

      public NoiseHandshakeBuilder setKeyAgreement(String keyAgreementName) throws NoSuchAlgorithmException
      Sets the key agreement algorithm to be used by this handshake.
      Parameters:
      keyAgreementName - the name of the Noise key agreement to be used by this handshake
      Returns:
      a reference to this handshake builder
      Throws:
      NoSuchAlgorithmException - if the named algorithm is not supported by the current JVM
      IllegalArgumentException - if the given name is not recognized as a Noise key agreement algorithm name
      See Also:
    • build

      public NoiseHandshake build()
      Constructs a Noise handshake with the previously-specified handshake pattern, role key material and cryptographic components.
      Returns:
      a Noise handshake instance with the previously-specified handshake pattern, role key material and cryptographic components
      Throws:
      IllegalStateException - if one or more cryptographic components has not been specified
      See Also:
    • forNInitiator

      public static NoiseHandshakeBuilder forNInitiator(PublicKey remoteStaticPublicKey)
      Constructs a new Noise handshake builder for the initiator in an N handshake.
      Parameters:
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forNResponder

      public static NoiseHandshakeBuilder forNResponder(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the responder in an N handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forKInitiator

      public static NoiseHandshakeBuilder forKInitiator(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey)
      Constructs a new Noise handshake builder for the initiator in a K handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forKResponder

      public static NoiseHandshakeBuilder forKResponder(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey)
      Constructs a new Noise handshake builder for the responder in a K handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forXInitiator

      public static NoiseHandshakeBuilder forXInitiator(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey)
      Constructs a new Noise handshake builder for the initiator in an X handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forXResponder

      public static NoiseHandshakeBuilder forXResponder(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the responder in an X handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forNNInitiator

      public static NoiseHandshakeBuilder forNNInitiator()
      Constructs a new Noise handshake builder for the initiator in an NN handshake.
      Returns:
      a new Noise handshake builder
    • forNNResponder

      public static NoiseHandshakeBuilder forNNResponder()
      Constructs a new Noise handshake builder for the responder in an NN handshake.
      Returns:
      a new Noise handshake builder
    • forKNInitiator

      public static NoiseHandshakeBuilder forKNInitiator(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the initiator in a KN handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forKNResponder

      public static NoiseHandshakeBuilder forKNResponder(PublicKey remoteStaticPublicKey)
      Constructs a new Noise handshake builder for the responder in a KN handshake.
      Parameters:
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forNKInitiator

      public static NoiseHandshakeBuilder forNKInitiator(PublicKey remoteStaticPublicKey)
      Constructs a new Noise handshake builder for the initiator in an NK handshake.
      Parameters:
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forNKResponder

      public static NoiseHandshakeBuilder forNKResponder(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the responder in an NK handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forKKInitiator

      public static NoiseHandshakeBuilder forKKInitiator(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey)
      Constructs a new Noise handshake builder for the initiator in a KK handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forKKResponder

      public static NoiseHandshakeBuilder forKKResponder(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey)
      Constructs a new Noise handshake builder for the responder in a KK handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forNXInitiator

      public static NoiseHandshakeBuilder forNXInitiator()
      Constructs a new Noise handshake builder for the initiator in an NX handshake.
      Returns:
      a new Noise handshake builder
    • forNXResponder

      public static NoiseHandshakeBuilder forNXResponder(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the responder in an NX handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forKXInitiator

      public static NoiseHandshakeBuilder forKXInitiator(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the initiator in a KX handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forKXResponder

      public static NoiseHandshakeBuilder forKXResponder(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey)
      Constructs a new Noise handshake builder for the responder in a KX handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forXNInitiator

      public static NoiseHandshakeBuilder forXNInitiator(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the initiator in an XN handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forXNResponder

      public static NoiseHandshakeBuilder forXNResponder()
      Constructs a new Noise handshake builder for the responder in an XN handshake.
      Returns:
      a new Noise handshake builder
    • forINInitiator

      public static NoiseHandshakeBuilder forINInitiator(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the initiator in an IN handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forINResponder

      public static NoiseHandshakeBuilder forINResponder()
      Constructs a new Noise handshake builder for the responder in an IN handshake.
      Returns:
      a new Noise handshake builder
    • forXKInitiator

      public static NoiseHandshakeBuilder forXKInitiator(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey)
      Constructs a new Noise handshake builder for the initiator in an XK handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forXKResponder

      public static NoiseHandshakeBuilder forXKResponder(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the responder in an XK handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forIKInitiator

      public static NoiseHandshakeBuilder forIKInitiator(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey)
      Constructs a new Noise handshake builder for the initiator in an IK handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forIKResponder

      public static NoiseHandshakeBuilder forIKResponder(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the responder in an IK handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forXXInitiator

      public static NoiseHandshakeBuilder forXXInitiator(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the initiator in an XX handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forXXResponder

      public static NoiseHandshakeBuilder forXXResponder(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the responder in an XX handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forIXInitiator

      public static NoiseHandshakeBuilder forIXInitiator(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the initiator in an IX handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forIXResponder

      public static NoiseHandshakeBuilder forIXResponder(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the responder in an IX handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forNK1Initiator

      public static NoiseHandshakeBuilder forNK1Initiator(PublicKey remoteStaticPublicKey)
      Constructs a new Noise handshake builder for the initiator in an NK1 handshake.
      Parameters:
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forNK1Responder

      public static NoiseHandshakeBuilder forNK1Responder(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the responder in an NK1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forNX1Initiator

      public static NoiseHandshakeBuilder forNX1Initiator()
      Constructs a new Noise handshake builder for the initiator in an NX1 handshake.
      Returns:
      a new Noise handshake builder
    • forNX1Responder

      public static NoiseHandshakeBuilder forNX1Responder(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the responder in an NX1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forX1NInitiator

      public static NoiseHandshakeBuilder forX1NInitiator(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the initiator in an X1N handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forX1NResponder

      public static NoiseHandshakeBuilder forX1NResponder()
      Constructs a new Noise handshake builder for the responder in an X1N handshake.
      Returns:
      a new Noise handshake builder
    • forX1KInitiator

      public static NoiseHandshakeBuilder forX1KInitiator(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey)
      Constructs a new Noise handshake builder for the initiator in an X1K handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forX1KResponder

      public static NoiseHandshakeBuilder forX1KResponder(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the responder in an X1K handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forXK1Initiator

      public static NoiseHandshakeBuilder forXK1Initiator(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey)
      Constructs a new Noise handshake builder for the initiator in an XK1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forXK1Responder

      public static NoiseHandshakeBuilder forXK1Responder(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the responder in an XK1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forX1K1Initiator

      public static NoiseHandshakeBuilder forX1K1Initiator(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey)
      Constructs a new Noise handshake builder for the initiator in an X1K1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forX1K1Responder

      public static NoiseHandshakeBuilder forX1K1Responder(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the responder in an X1K1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forX1XInitiator

      public static NoiseHandshakeBuilder forX1XInitiator(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the initiator in an X1X handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forX1XResponder

      public static NoiseHandshakeBuilder forX1XResponder(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the responder in an X1X handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forXX1Initiator

      public static NoiseHandshakeBuilder forXX1Initiator(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the initiator in an XX1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forXX1Responder

      public static NoiseHandshakeBuilder forXX1Responder(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the responder in an XX1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forX1X1Initiator

      public static NoiseHandshakeBuilder forX1X1Initiator(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the initiator in an X1X1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forX1X1Responder

      public static NoiseHandshakeBuilder forX1X1Responder(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the responder in an X1X1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forK1NInitiator

      public static NoiseHandshakeBuilder forK1NInitiator(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the initiator in a K1N handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forK1NResponder

      public static NoiseHandshakeBuilder forK1NResponder(PublicKey remoteStaticPublicKey)
      Constructs a new Noise handshake builder for the responder in a K1N handshake.
      Parameters:
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forK1KInitiator

      public static NoiseHandshakeBuilder forK1KInitiator(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey)
      Constructs a new Noise handshake builder for the initiator in a K1K handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forK1KResponder

      public static NoiseHandshakeBuilder forK1KResponder(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey)
      Constructs a new Noise handshake builder for the responder in a K1K handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forKK1Initiator

      public static NoiseHandshakeBuilder forKK1Initiator(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey)
      Constructs a new Noise handshake builder for the initiator in a KK1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forKK1Responder

      public static NoiseHandshakeBuilder forKK1Responder(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey)
      Constructs a new Noise handshake builder for the responder in a KK1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forK1K1Initiator

      public static NoiseHandshakeBuilder forK1K1Initiator(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey)
      Constructs a new Noise handshake builder for the initiator in a K1K1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forK1K1Responder

      public static NoiseHandshakeBuilder forK1K1Responder(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey)
      Constructs a new Noise handshake builder for the responder in a K1K1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forK1XInitiator

      public static NoiseHandshakeBuilder forK1XInitiator(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the initiator in a K1X handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forK1XResponder

      public static NoiseHandshakeBuilder forK1XResponder(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey)
      Constructs a new Noise handshake builder for the responder in a K1X handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forKX1Initiator

      public static NoiseHandshakeBuilder forKX1Initiator(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the initiator in a KX1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forKX1Responder

      public static NoiseHandshakeBuilder forKX1Responder(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey)
      Constructs a new Noise handshake builder for the responder in a KX1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forK1X1Initiator

      public static NoiseHandshakeBuilder forK1X1Initiator(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the initiator in a K1X1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forK1X1Responder

      public static NoiseHandshakeBuilder forK1X1Responder(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey)
      Constructs a new Noise handshake builder for the responder in a K1X1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forI1NInitiator

      public static NoiseHandshakeBuilder forI1NInitiator(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the initiator in an I1N handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forI1NResponder

      public static NoiseHandshakeBuilder forI1NResponder()
      Constructs a new Noise handshake builder for the responder in an I1N handshake.
      Returns:
      a new Noise handshake builder
    • forI1KInitiator

      public static NoiseHandshakeBuilder forI1KInitiator(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey)
      Constructs a new Noise handshake builder for the initiator in an I1K handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forI1KResponder

      public static NoiseHandshakeBuilder forI1KResponder(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the responder in an I1K handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forIK1Initiator

      public static NoiseHandshakeBuilder forIK1Initiator(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey)
      Constructs a new Noise handshake builder for the initiator in an IK1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forIK1Responder

      public static NoiseHandshakeBuilder forIK1Responder(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the responder in an IK1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forI1K1Initiator

      public static NoiseHandshakeBuilder forI1K1Initiator(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey)
      Constructs a new Noise handshake builder for the initiator in an I1K1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forI1K1Responder

      public static NoiseHandshakeBuilder forI1K1Responder(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the responder in an I1K1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forI1XInitiator

      public static NoiseHandshakeBuilder forI1XInitiator(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the initiator in an I1X handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forI1XResponder

      public static NoiseHandshakeBuilder forI1XResponder(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the responder in an I1X handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forIX1Initiator

      public static NoiseHandshakeBuilder forIX1Initiator(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the initiator in an IX1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forIX1Responder

      public static NoiseHandshakeBuilder forIX1Responder(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the responder in an IX1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forI1X1Initiator

      public static NoiseHandshakeBuilder forI1X1Initiator(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the initiator in an I1X1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forI1X1Responder

      public static NoiseHandshakeBuilder forI1X1Responder(KeyPair localStaticKeyPair)
      Constructs a new Noise handshake builder for the responder in an I1X1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
    • forNPsk0Initiator

      public static NoiseHandshakeBuilder forNPsk0Initiator(PublicKey remoteStaticPublicKey, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the initiator in an Npsk0 handshake.
      Parameters:
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forNPsk0Responder

      public static NoiseHandshakeBuilder forNPsk0Responder(KeyPair localStaticKeyPair, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the responder in an Npsk0 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forKPsk0Initiator

      public static NoiseHandshakeBuilder forKPsk0Initiator(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the initiator in a Kpsk0 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forKPsk0Responder

      public static NoiseHandshakeBuilder forKPsk0Responder(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the responder in a Kpsk0 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forXPsk1Initiator

      public static NoiseHandshakeBuilder forXPsk1Initiator(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the initiator in an Xpsk1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forXPsk1Responder

      public static NoiseHandshakeBuilder forXPsk1Responder(KeyPair localStaticKeyPair, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the responder in an Xpsk1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forNNPsk0Initiator

      public static NoiseHandshakeBuilder forNNPsk0Initiator(byte[] preSharedKey)
      Constructs a new Noise handshake builder for the initiator in an NNpsk0 handshake.
      Parameters:
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forNNPsk0Responder

      public static NoiseHandshakeBuilder forNNPsk0Responder(byte[] preSharedKey)
      Constructs a new Noise handshake builder for the responder in an NNpsk0 handshake.
      Parameters:
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forNNPsk2Initiator

      public static NoiseHandshakeBuilder forNNPsk2Initiator(byte[] preSharedKey)
      Constructs a new Noise handshake builder for the initiator in an NNpsk2 handshake.
      Parameters:
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forNNPsk2Responder

      public static NoiseHandshakeBuilder forNNPsk2Responder(byte[] preSharedKey)
      Constructs a new Noise handshake builder for the responder in an NNpsk2 handshake.
      Parameters:
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forNKPsk0Initiator

      public static NoiseHandshakeBuilder forNKPsk0Initiator(PublicKey remoteStaticPublicKey, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the initiator in an NKpsk0 handshake.
      Parameters:
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forNKPsk0Responder

      public static NoiseHandshakeBuilder forNKPsk0Responder(KeyPair localStaticKeyPair, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the responder in an NKpsk0 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forNKPsk2Initiator

      public static NoiseHandshakeBuilder forNKPsk2Initiator(PublicKey remoteStaticPublicKey, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the initiator in an NKpsk2 handshake.
      Parameters:
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forNKPsk2Responder

      public static NoiseHandshakeBuilder forNKPsk2Responder(KeyPair localStaticKeyPair, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the responder in an NKpsk2 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forNXPsk2Initiator

      public static NoiseHandshakeBuilder forNXPsk2Initiator(byte[] preSharedKey)
      Constructs a new Noise handshake builder for the initiator in an NXpsk2 handshake.
      Parameters:
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forNXPsk2Responder

      public static NoiseHandshakeBuilder forNXPsk2Responder(KeyPair localStaticKeyPair, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the responder in an NXpsk2 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forXNPsk3Initiator

      public static NoiseHandshakeBuilder forXNPsk3Initiator(KeyPair localStaticKeyPair, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the initiator in an XNpsk3 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forXNPsk3Responder

      public static NoiseHandshakeBuilder forXNPsk3Responder(byte[] preSharedKey)
      Constructs a new Noise handshake builder for the responder in an XNpsk3 handshake.
      Parameters:
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forXKPsk3Initiator

      public static NoiseHandshakeBuilder forXKPsk3Initiator(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the initiator in an XKpsk3 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forXKPsk3Responder

      public static NoiseHandshakeBuilder forXKPsk3Responder(KeyPair localStaticKeyPair, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the responder in an XKpsk3 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forXXPsk3Initiator

      public static NoiseHandshakeBuilder forXXPsk3Initiator(KeyPair localStaticKeyPair, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the initiator in an XXpsk3 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forXXPsk3Responder

      public static NoiseHandshakeBuilder forXXPsk3Responder(KeyPair localStaticKeyPair, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the responder in an XXpsk3 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forKNPsk0Initiator

      public static NoiseHandshakeBuilder forKNPsk0Initiator(KeyPair localStaticKeyPair, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the initiator in a KNpsk0 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forKNPsk0Responder

      public static NoiseHandshakeBuilder forKNPsk0Responder(PublicKey remoteStaticPublicKey, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the responder in a KNpsk0 handshake.
      Parameters:
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forKNPsk2Initiator

      public static NoiseHandshakeBuilder forKNPsk2Initiator(KeyPair localStaticKeyPair, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the initiator in a KNpsk2 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forKNPsk2Responder

      public static NoiseHandshakeBuilder forKNPsk2Responder(PublicKey remoteStaticPublicKey, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the responder in a KNpsk2 handshake.
      Parameters:
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forKKPsk0Initiator

      public static NoiseHandshakeBuilder forKKPsk0Initiator(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the initiator in a KKpsk0 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forKKPsk0Responder

      public static NoiseHandshakeBuilder forKKPsk0Responder(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the responder in a KKpsk0 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forKKPsk2Initiator

      public static NoiseHandshakeBuilder forKKPsk2Initiator(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the initiator in a KKpsk2 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forKKPsk2Responder

      public static NoiseHandshakeBuilder forKKPsk2Responder(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the responder in a KKpsk2 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forKXPsk2Initiator

      public static NoiseHandshakeBuilder forKXPsk2Initiator(KeyPair localStaticKeyPair, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the initiator in a KXpsk2 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forKXPsk2Responder

      public static NoiseHandshakeBuilder forKXPsk2Responder(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the responder in a KXpsk2 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forINPsk1Initiator

      public static NoiseHandshakeBuilder forINPsk1Initiator(KeyPair localStaticKeyPair, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the initiator in an INpsk1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forINPsk1Responder

      public static NoiseHandshakeBuilder forINPsk1Responder(byte[] preSharedKey)
      Constructs a new Noise handshake builder for the responder in an INpsk1 handshake.
      Parameters:
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forINPsk2Initiator

      public static NoiseHandshakeBuilder forINPsk2Initiator(KeyPair localStaticKeyPair, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the initiator in an INpsk2 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forINPsk2Responder

      public static NoiseHandshakeBuilder forINPsk2Responder(byte[] preSharedKey)
      Constructs a new Noise handshake builder for the responder in an INpsk2 handshake.
      Parameters:
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forIKPsk1Initiator

      public static NoiseHandshakeBuilder forIKPsk1Initiator(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the initiator in an IKpsk1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forIKPsk1Responder

      public static NoiseHandshakeBuilder forIKPsk1Responder(KeyPair localStaticKeyPair, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the responder in an IKpsk1 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forIKPsk2Initiator

      public static NoiseHandshakeBuilder forIKPsk2Initiator(KeyPair localStaticKeyPair, PublicKey remoteStaticPublicKey, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the initiator in an IKpsk2 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      remoteStaticPublicKey - the remote static public key for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forIKPsk2Responder

      public static NoiseHandshakeBuilder forIKPsk2Responder(KeyPair localStaticKeyPair, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the responder in an IKpsk2 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forIXPsk2Initiator

      public static NoiseHandshakeBuilder forIXPsk2Initiator(KeyPair localStaticKeyPair, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the initiator in an IXpsk2 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long
    • forIXPsk2Responder

      public static NoiseHandshakeBuilder forIXPsk2Responder(KeyPair localStaticKeyPair, byte[] preSharedKey)
      Constructs a new Noise handshake builder for the responder in an IXpsk2 handshake.
      Parameters:
      localStaticKeyPair - the local static key pair for this handshake; must not be null
      preSharedKey - the pre-shared key for this handshake; must not be null
      Returns:
      a new Noise handshake builder
      Throws:
      NullPointerException - if any required key null
      IllegalArgumentException - if the given pre-shared key is not exactly 32 bytes long