Asymmetric + KDF RFC 7748 + RFC 5869 Cross-Verified Pipeline

X25519 + HKDF

Key agreement followed by HKDF-SHA-256 with a salt and context info to derive a 32-byte session key.

Open in app Download .ncw

X25519 + HKDF

Overview & Cryptographic Context

A raw elliptic-curve Diffie-Hellman shared secret represents an algebraic curve coordinate in GF(2255-19), not a uniformly distributed bit string, and must never be wired directly as an AES or ChaCha20 key. Modern key exchange standards (TLS 1.3 RFC 8446, HPKE RFC 9180, Signal X3DH) always feed the ECDH shared secret into HKDF as Input Keying Material (IKM) alongside a protocol salt and domain-separation context string (info).

This two-stage workflow chains X25519 Key Exchange (ECDH) (using the RFC 7748 §6.1 Alice/Bob key pair) into HKDF Key Derivation with SHA-256, a 13-byte salt, and the ASCII context label "nodecrypto session key" (6e6f646563727970746f2073657373696f6e206b6579) to derive a 32-byte (256-bit) symmetric session key.

Pipeline Architecture & Wiring Flow

Workflow Input ──► X25519 ECDH (SharedSecret 32B) ──► HKDF-SHA-256 (IKM + Salt + Info → 32B) ──► Workflow Output (SessionKey)
  1. Stage 1 — Curve25519 Key Agreement (X25519 Key Exchange (ECDH)): Computes the 32-byte raw shared secret 4a5d9d5ba4ce2de1728e3bf480350f25e07e21c947d19e3376f09b3c1e161742 from PrivateKey and PeerPublicKey.
  2. Stage 2 — HKDF Extract & Expand (HKDF Key Derivation): Receives the raw shared secret on its ikm port, combines it with Salt and Info from Workflow Input, and expands a 32-byte SessionKey.

Nodes & Configuration

NodeNode Role & Key ParametersCount
Workflow InputSupplies PrivateKey, PeerPublicKey, Salt, and Info1
X25519 Key Exchange (ECDH)Computes 32-byte raw Curve25519 shared secret1
HKDF Key DerivationConfigured with hashAlgorithm = "SHA-256", keyLength = 321
Workflow OutputCollects the 32-byte SessionKey1

Node reference →

Inputs, Outputs & Test Vector Verification

Verification Source: RFC 7748 §6.1 shared secret; HKDF-SHA-256 output cross-checked with Node.js crypto.hkdfSync

Inputs

NameTypeValue (Hex)
PrivateKeybytes (32 B)77076d0a7318a57d3c16c17251b26645df4c2f87ebc0992ab177fba51db92c2a
PeerPublicKeybytes (32 B)de9edb7d7b7dc1b4d35b61c2ece435373f8343c85b78674dadfc7e146f882b4f
Saltbytes (13 B)000102030405060708090a0b0c
Infobytes (22 B, ASCII "nodecrypto session key")6e6f646563727970746f2073657373696f6e206b6579

Expected Outputs

NameTypeValue (Hex)
SessionKeybytes (32 B)7d87f69eef5eee6ad11c518723db4f5f8708a99c84e9a3589df85d62d7b14c9b