NodeCrypto Help

X25519 Key Exchange (ECDH)

Category: Asymmetric & Elliptic Curve ยท Node Type ID: asymmetric-x25519-ecdh

Montgomery-curve Diffie-Hellman shared secret (RFC 7748)

Overview

Computes a 32-byte shared secret using the X25519 Montgomery-curve Diffie-Hellman function standardized in RFC 7748. Pass the resulting 32-byte Shared Secret through HKDF Key Derivation before using it as a symmetric encryption key.

When to Use

Parameter Configuration

X25519 Key Exchange (ECDH) has no configurable parameters.

Port I/O Specification

See Ports & Connections for general wiring rules, data type colors, and dynamic port creation.

Input Ports

Port Nature: Fixed Input Ports (2 total).

Port NamePort IDData TypeRequiredVisibility ConditionDescription
My Private Key privateKey Bytes (32B) Required Always visible Local party's 32-byte X25519 private key.
Peer Public Key peerPublicKey Bytes (32B) Required Always visible Remote peer's 32-byte X25519 public key.

Output Ports

Port Nature: Fixed Output Ports (1 total).

Port NamePort IDData TypeVisibility ConditionDescription
Shared Secret sharedSecret Bytes (32B) Always visible Computed 32-byte X25519 shared secret.

Error Cases

When any of the following conditions occurs at runtime, this node transitions to an ERROR state and downstream nodes connected to its outputs do not execute.

Error CodeDefault Engine MessageTrigger Condition
INVALID_KEY_MATERIAL Invalid key length or format Raised when My Private Key or Peer Public Key is not 32 bytes or produces an all-zero low-order shared point.

Examples

Establishing an X25519 Shared Secret for ChaCha20-Poly1305

Compute an X25519 shared secret and derive a 32-byte AEAD key via HKDF.

  1. Connect My Private Key and Peer Public Key (from two X25519 KeyGen nodes) to X25519 Key Exchange (ECDH).
  2. Feed Shared Secret into HKDF Key Derivation and connect OKM to ChaCha20-Poly1305 Encrypt.