Asymmetric · ECDH Curve25519 RFC 7748 §6.1 Verified

X25519 key agreement

Computes the shared secret from one side's private key and the peer's public key, checked against RFC 7748.

Open in app Download .ncw

Overview & Cryptographic Context

X25519 (specified in IETF RFC 7748) is an elliptic-curve Diffie-Hellman (ECDH) function built on the Montgomery curve Curve25519 (y2 = x3 + 486662x2 + x over the prime field 2255 - 19). Designed for constant-time Montgomery ladder execution and immunity to twist and invalid-curve attacks, X25519 uses compact 32-byte little-endian u-coordinates for public keys and 32-byte clamped scalars for private keys.

This workflow reproduces RFC 7748 §6.1, computing the 32-byte shared secret K = X25519(a, B) from Alice's 32-byte private key a and Bob's 32-byte public key B. In production protocols, this raw shared secret should always be passed through a key derivation function such as HKDF (see X25519 + HKDF).

Pipeline Architecture & Wiring Flow

Workflow Input (PrivateKey 32B, PeerPublicKey 32B) ──► X25519 Key Exchange (ECDH) ──► Workflow Output (SharedSecret 32B)
  1. Key Material Ingress (Workflow Input): Supplies Alice's 32-byte PrivateKey and Bob's 32-byte PeerPublicKey.
  2. Scalar Multiplication (X25519 Key Exchange (ECDH)): Clamps the private scalar (clearing bits 0, 1, 2, 255 and setting bit 254) and evaluates the Montgomery ladder over GF(2255-19). Rejects low-order points that produce an all-zero shared secret.
  3. Shared Secret Egress (Workflow Output): Outputs the 32-byte shared secret K.

Nodes & Configuration

NodeNode Role & Key ParametersCount
Workflow InputSupplies PrivateKey (32 B) and PeerPublicKey (32 B)1
X25519 Key Exchange (ECDH)Evaluates RFC 7748 Curve25519 scalar multiplication1
Workflow OutputCollects the 32-byte SharedSecret1

Node reference →

Inputs, Outputs & Test Vector Verification

Verification Source: RFC 7748 §6.1 (Alice private key, Bob public key)

Inputs

NameTypeValue (Hex)
PrivateKeybytes (32 B)77076d0a7318a57d3c16c17251b26645df4c2f87ebc0992ab177fba51db92c2a
PeerPublicKeybytes (32 B)de9edb7d7b7dc1b4d35b61c2ece435373f8343c85b78674dadfc7e146f882b4f

Expected Outputs

NameTypeValue (Hex)
SharedSecretbytes (32 B)4a5d9d5ba4ce2de1728e3bf480350f25e07e21c947d19e3376f09b3c1e161742