X25519 Key Exchange (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
- Performing fast, constant-time elliptic-curve Diffie-Hellman key agreement using 32-byte Curve25519 keys from X25519 KeyGen or RFC 7748 test vectors.
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 Name | Port ID | Data Type | Required | Visibility Condition | Description |
|---|---|---|---|---|---|
My Private Key |
privateKey |
Bytes |
Required | Always visible | Local party's 32-byte X25519 private key. |
Peer Public Key |
peerPublicKey |
Bytes |
Required | Always visible | Remote peer's 32-byte X25519 public key. |
Output Ports
Port Nature: Fixed Output Ports (1 total).
| Port Name | Port ID | Data Type | Visibility Condition | Description |
|---|---|---|---|---|
Shared Secret |
sharedSecret |
Bytes |
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 Code | Default Engine Message | Trigger 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.
- Connect
My Private KeyandPeer Public Key(from two X25519 KeyGen nodes) to X25519 Key Exchange (ECDH). - Feed
Shared Secretinto HKDF Key Derivation and connectOKMto ChaCha20-Poly1305 Encrypt.