Post-Quantum · KEM NIST FIPS 203 End-to-End Round-Trip Check

ML-KEM-768 round trip

Key generation, encapsulation and decapsulation in one graph. The result is true when both sides derive the same shared secret.

Open in app Download .ncw

Overview & Cryptographic Context

In a Key Encapsulation Mechanism (KEM) such as NIST FIPS 203 ML-KEM-768, key establishment proceeds in three operations across two parties: Alice runs ML-KEM.KeyGen() to generate a 1,184-byte encapsulation (public) key ek and a 2,400-byte decapsulation (secret) key dk, sending ek to Bob. Bob runs ML-KEM.Encaps(ek) with fresh CSPRNG randomness to produce a 1,088-byte ciphertext c and his 32-byte shared secret KBob. Finally, Alice runs ML-KEM.Decaps(dk, c) to recover her 32-byte shared secret KAlice.

This workflow wires all three post-quantum nodes together on a single canvas and connects both 32-byte shared secrets into a Value Comparator (==), proving that every randomized execution derives KBob = KAlice (SharedSecretsMatch = true).

Pipeline Architecture & Wiring Flow

ML-KEM KeyGen (ek 1184B, dk 2400B) ──► ML-KEM Encaps (c 1088B, K_enc 32B) ──► ML-KEM Decaps (K_dec 32B) ──► Value Comparator (== → true)
  1. Keypair Generation (ML-KEM KeyGen (FIPS 203)): Generates a fresh ML-KEM-768 key pair on each run. Routes publicKey (ek) to ML-KEM Encapsulate and secretKey (dk) to ML-KEM Decapsulate.
  2. Encapsulation (ML-KEM Encapsulate): Encapsulates a fresh 32-byte shared secret against publicKey, sending ciphertext (c) to ML-KEM Decapsulate and sharedSecret to port a of Value Comparator.
  3. Decapsulation & Equality Check (ML-KEM Decapsulate → Value Comparator): Decapsulates ciphertext using secretKey and feeds the recovered sharedSecret to port b of Value Comparator, which outputs true to Workflow Output.

Nodes & Configuration

NodeNode Role & Key ParametersCount
Workflow InputWorkflow ingress node (no external arguments required)1
ML-KEM KeyGen (FIPS 203)Configured with variant = 768; generates fresh ek (1,184 B) and dk (2,400 B)1
ML-KEM EncapsulateConfigured with variant = 768; produces 1,088-byte ciphertext and 32-byte shared secret1
ML-KEM DecapsulateConfigured with variant = 768; recovers 32-byte shared secret from ciphertext and dk1
Value ComparatorConfigured with operator = "=="; compares encapsulated and decapsulated secrets1
Workflow OutputEmits boolean verdict SharedSecretsMatch1

Node reference →

Inputs, Outputs & Test Vector Verification

Verification Source: Randomized (FIPS 203 ML-KEM-768 round trip); only the boolean verdict is compared

Expected Outputs

NameTypeValue
SharedSecretsMatchbooltrue