Skip to content
ecdsa.com

Illustrated

The Illustrated Post-Quantum TLS 1.3 Connection

This is one real TLS 1.3 handshake, captured on the wire and taken apart byte by byte. The two sides agree on a key with X25519MLKEM768, a hybrid of post-quantum ML-KEM-768 and classical X25519, so the session stays private even against an attacker who records it today and breaks elliptic curves later. Every number below is recomputed from the captured bytes and checked against what OpenSSL logged; nothing is illustrative.

The one-time keys of this session

A handshake is reproducible only if its secrets are known, so this demonstration publishes them. Every value here is a one-time secret of this single session, generated for the capture and never used again — publishing them reveals nothing about any other connection. They are what lets the page, and you, recompute every step below.

ML-KEM key-generation seed d ‖ z (64 bytes)
84745c7adf177dfb94e15c7cdef6f8006897b295bdafaadd090ef050c004b212921eb10b6b41e8f0221e0f7f164aadef44f4cba1139edd522c9f0860db6b0cde
client X25519 private key (hybrid share)
784edfa4400a57540a7cbd71957c8ab182ae801a5c519755abe69f553b9e8c5d
client X25519 private key (standalone share)
d81df8305a5f24f9077b3d669885d0d7b93ec55fe405ccde814bac62e778f656
ML-KEM encapsulation randomness m (32 bytes)
4888d955ca1924fb19e233b6d516249f84e945e1d8345e9816b7fbaa2c3632b7
server X25519 private key
c81c64cbae9dc5549313f148f09f00da5f8fde45be679697e02204a781796145
server certificate private scalar (P-256)
11aa8fac7486c821d6c57baa03c3a3e119a635f33aaa2043bba12d7f20a40a99

The hybrid key share, laid out

The whole cost of going post-quantum sits in two fields. X25519MLKEM768 concatenates an ML-KEM-768 value and an X25519 value, ML-KEM first in this group (RFC 10024 §4): the client offers both in one key share, the server answers with both, and the two 32-byte halves of the shared secret are joined the same way.

Client key share — 1216 bytes

ML-KEM-768 · 1184 bytes
X25519 · 32 bytes

Server key share — 1120 bytes

ML-KEM-768 · 1088 bytes
X25519 · 32 bytes

Shared secret — 64 bytes

ML-KEM-768 · 32 bytes
X25519 · 32 bytes

What post-quantum costs on the wire

The same client and server negotiated a second handshake with plain X25519, everything else equal. The hybrid key material is over a kilobyte larger in each direction, and it is the one real cost: it pushes the ClientHello past a single packet.

MeasurementX25519MLKEM768X25519Difference
ClientHello (whole record)1,483 bytes261 bytes+1,222 bytes
key_share extension (client)1,262 bytes42 bytes+1,220 bytes
supported_groups extension22 bytes20 bytes+2 bytes
ServerHello (whole record)1,215 bytes127 bytes+1,088 bytes
key_share extension (server)1,128 bytes40 bytes+1,088 bytes
Bytes the client sent1,620 bytes398 bytes+1,222 bytes
Bytes the server sent2,326 bytes1,236 bytes+1,090 bytes
TCP segments for the ClientHello2 packets1 packet+1 packet
Client → ServerRecord 1 · 1,483 bytes on the wire

ClientHello

The client opens the connection. It proposes TLS 1.3, offers three AES/ChaCha cipher suites, lists the key-exchange groups it supports with X25519MLKEM768 first, and sends a key share for each of its two preferred groups — including the 1216-byte hybrid share. It travels in the clear; nothing is secret yet.

On the wire · 1,483 bytes

  • The 1,478 bytes match what OpenSSL printed for this record with -msg.
How it is computedThe client's key shares

Before it says a word, the client generates the ephemeral keys it will offer. For the hybrid group that is an ML-KEM-768 key pair plus an X25519 key pair, concatenated public-first into one 1216-byte share; the standalone X25519 group gets its own, separate key.

Definition
d, z     ←$ B^32                                   FIPS 203 §7.1
(ek, dk) = ML-KEM-768.KeyGen_internal(d, z)        FIPS 203 §6.1
x_c      ←$ B^32,   X_c = X25519(x_c, 9)           RFC 7748 §5
share    = ek ‖ X_c                                1184 + 32 = 1216   RFC 10024 §4.1

y_c      ←$ B^32,   Y_c = X25519(y_c, 9)           key_share: x25519 (0x001d)
Values from this session
d (32 bytes) — expands into the secret vector
84745c7adf177dfb94e15c7cdef6f8006897b295bdafaadd090ef050c004b212
z (32 bytes) — the implicit-rejection secret
921eb10b6b41e8f0221e0f7f164aadef44f4cba1139edd522c9f0860db6b0cde
SHA-256 of the 1184-byte encapsulation key
4a2903bee32a7a18d3294d93a4d24d6ecc8c07bc098bab31899689f87a572be8
client X25519 private key (hybrid share)
784edfa4400a57540a7cbd71957c8ab182ae801a5c519755abe69f553b9e8c5d
client X25519 public key (hybrid share)
09e0802926363ed192b02f5261520f2056ba7af9a0acd1eee5bbe50181e0cf29
client X25519 private key (standalone share)
d81df8305a5f24f9077b3d669885d0d7b93ec55fe405ccde814bac62e778f656
client X25519 public key (standalone share)
67aab4deeec206fa89034014d772bdd47cedd7930610e81f634871565424f14d
What this proves
  • ML-KEM-768 key generation from the seed reproduces the encapsulation key in the client's share.
  • All 768 coefficients of the encapsulation key are below q = 3329 (largest 3326), so the server accepts it (FIPS 203 §7.2).
  • The X25519 private key reproduces the public value in the client's hybrid share.
  • The standalone X25519 share uses its own key, different from the one in the hybrid share.
Reproduce it yourself
printf '%s' 3054020100300b06096086480165030404020442804084745c7adf177dfb94e15c7cdef6f8006897b295bdafaadd090ef050c004b212921eb10b6b41e8f0221e0f7f164aadef44f4cba1139edd522c9f0860db6b0cde | unhex > client-mlkem.der
openssl pkey -inform DER -in client-mlkem.der -pubout -outform DER | tail -c 1184 | openssl dgst -sha256 -binary | tohex

prints 4a2903bee32a7a18d3294d93a4d24d6ecc8c07bc098bab31899689f87a572be8

printf '%s' 302e020100300506032b656e04220420784edfa4400a57540a7cbd71957c8ab182ae801a5c519755abe69f553b9e8c5d | unhex > x25519.der
openssl pkey -inform DER -in x25519.der -pubout -outform DER | tail -c 32 | tohex

prints 09e0802926363ed192b02f5261520f2056ba7af9a0acd1eee5bbe50181e0cf29

Server → ClientRecord 2 · 1,215 bytes on the wire

ServerHello

The server picks TLS 1.3, the cipher suite TLS_AES_128_GCM_SHA256 and the group X25519MLKEM768, and returns its own 1120-byte hybrid key share. This is the last message in the clear: from here both sides can compute the handshake keys, and everything that follows is encrypted.

On the wire · 1,215 bytes

  • The 1,210 bytes match what OpenSSL printed for this record with -msg.
  • OpenSSL's s_client reported the negotiated group X25519MLKEM768.
  • OpenSSL's s_client reported the cipher TLS_AES_128_GCM_SHA256.
How it is computedThe server's key share

The server does not have a matching private key to multiply — ML-KEM is a KEM, not Diffie-Hellman. It encapsulates a fresh secret to the client's ML-KEM key, producing a ciphertext and the post-quantum shared secret, and generates its own X25519 key. Its share is the ciphertext followed by its X25519 public value.

Definition
m      ←$ B^32
(K, c) = ML-KEM-768.Encaps_internal(ek, m)         FIPS 203 §6.2
x_s    ←$ B^32,   X_s = X25519(x_s, 9)             RFC 7748 §5
share  = c ‖ X_s                                   1088 + 32 = 1120   RFC 10024 §4.2
Values from this session
ML-KEM encapsulation randomness m (32 bytes)
4888d955ca1924fb19e233b6d516249f84e945e1d8345e9816b7fbaa2c3632b7
ML-KEM shared secret K (32 bytes)
dad26963f7510c64b7c7d9b80731d6b573abf15999f5bed3076173e3f8c0cbdb
SHA-256 of the 1088-byte ML-KEM ciphertext
30d5f4e26e8548b8796088ef0d56d307cab52802ab03e3cea966cb1391dbfc2a
server X25519 private key
c81c64cbae9dc5549313f148f09f00da5f8fde45be679697e02204a781796145
server X25519 public key
339fdc7e19b200cb062df86bdf0e022c949abacd7db8dbdae0a92a6d9ba8d530
What this proves
  • Encapsulating to the client's key with the recorded randomness reproduces the server's ciphertext.
  • The server's X25519 private key reproduces the public value in its share.
How it is computedThe shared secret

Now both sides can reach the same 64 bytes. The client decapsulates the ciphertext with its ML-KEM private key, both sides complete the X25519 exchange, and the two 32-byte results are concatenated — ML-KEM first. An attacker must break both halves to recover it, which is the whole point of a hybrid.

Definition
K  = ML-KEM-768.Decaps(dk, c)                      FIPS 203 §7.3
Z  = X25519(x_c, X_s) = X25519(x_s, X_c)           RFC 7748 §6.1
ss = K ‖ Z                                         32 + 32 = 64   RFC 10024 §4.3
Values from this session
ML-KEM shared secret K (32 bytes)
dad26963f7510c64b7c7d9b80731d6b573abf15999f5bed3076173e3f8c0cbdb
X25519 shared secret Z (32 bytes)
568c3055b3ac3516f0d780bbe022beb336ade7e7bae81752f2de6df09ebdc428
shared secret = K ‖ Z (64 bytes)
dad26963f7510c64b7c7d9b80731d6b573abf15999f5bed3076173e3f8c0cbdb568c3055b3ac3516f0d780bbe022beb336ade7e7bae81752f2de6df09ebdc428
What this proves
  • The client's decapsulation and the server's encapsulation yield the same ML-KEM secret.
  • Both sides compute the same X25519 secret.
  • The X25519 secret is not all-zero, as RFC 9846 §7.4.2 requires.
  • The first 32 bytes of the shared secret are the ML-KEM secret, the order RFC 10024 §4.3 fixes.
Reproduce it yourself
printf '%s' 3054020100300b06096086480165030404020442804084745c7adf177dfb94e15c7cdef6f8006897b295bdafaadd090ef050c004b212921eb10b6b41e8f0221e0f7f164aadef44f4cba1139edd522c9f0860db6b0cde | unhex > client-mlkem.der
unhex > ciphertext.bin <<'EOF'
5db0e57cb763af0d1678753192830257df14de0eb4dd0d9a2d7ee2a7c94f4aab
2526fd0957b0c1025efff1763488c3bff22007fdd19b33a0e5605fc2b50ed3aa
adee4643eaa746cc65882d54a49ce4cb208226f6c732dc39981d81de9b788740
f6361120dc130f814bf5dd41d4df8682468e8ec8e2b3d5056cf245df0e0febe7
cf7423f725533dc39210093d57134c0e86a716d6d62694c9548082a5cd9352f2
fb8254397df2921d3a48702df9f622a7a539ba6110bec4736b6d15e38c558105
d6954e5fe1aec5b5ae065222fe1df4b1639e001695dcfba2d0aa09d14f9fee31
201383e58a16709631cb7b182ffbae8dc4e1345afd1763e55bb0714e92470c53
805f05ace3ce45402563cfd08db5429ffe5eeb033a7695530ee01ab7c5a179b1
1e3cd17082f457a158861fda8a9c08e7987dc5e18a48955ddba38766e14e09c3
b6319dbb5cb7c6c8e4aad9d40c2ec2b69e8ab793f742765d2af2644afc87cc1f
add8e0dc76f9725dfb9063f116ef8b02c7dc949160e22d716cfe1bed9a7eccae
e26ebc9615fd2c6e53a93bf97db63bbcae24bff5082a83dd2128fec9297cf449
2811d09363a21e98ac4869512ede9300c3fe5f049d7348404c56c37e1329fbbe
90fa854ef8b4de86c67bd16c4263f5eb99a50939a80086c9a1c0d038343d8c9e
d8b9300a6556d950492925628fb281cd077c82681f75e7aae144617adf613f49
11ff6e8f4246039f2ace861f2b2ec1d0f555e3e1a7fce9c80c6c2a8a062d0a64
7be31fc4b42c8776cd4b6517c4aa939a398b110c052e30a8eb746c476ee0dfc8
8866fbd8fdc816d20add8dbfeabcac6e0dac0f41a4e4822ab1f51b54e4bc178f
4eb7c07670704e425fd99205b8efd2f3fbccb200760127b1188fab5d7be84b06
87d779bfbe63e3b1db13f34ab9205d9f06312046e77737a05c070f1b808b5c80
9aa9e9945c52e4bf46d5b328030b42dbfba641cc0a39e6ace09361371d25fb3e
e78507a6fadfc2b6cd4a06851488b001d8b40a1ceb647b7d9debcbff6c375a13
73540d114e9bca1377b83192209bdb70824784b23da425bc7c8cca3ba0845d14
45e732d4e2327348f3a1d1f2499753bd5786ef80ef9a47c7293eedeef64d21ef
4ec47e847303fb963deff2f873efc8f2cfef263bdc40c34cb9aa80584e1ffd03
efe811cd6e12e4e6cdbda8a1ddc2df5f8f86462311425bae494f087f28524721
43e8bf6f53fb68f6063961b07dd34b0a4ebb4aba6b0f989f5955c4fe10088cae
6f7531a6b699f9e9dd34b2fc3ae102409bc97775b7bdc1e0028042e7c27fb8ed
c43c611b3ffd91de6a08a44700dd9b2d241488710e7cfabf974db0fd8a8f9b68
fee885b69d2cac23f6531af4f69c6f58e0d1ce620c47578c0bf4d3f3435df6ba
67556efaa65ec7bb518c76e840747c8454d0538f36134ee8beb0bd24a616a42d
fc826926ff9608def9b1c433d6e9ad8fcf1e11543a9595795f69c6630b60f581
156d98ce7e53124ceb06ce7e6e8054c6849aa2039b96cde7f9eac19b036b44a7
EOF
openssl pkeyutl -decap -inkey client-mlkem.der -keyform DER -in ciphertext.bin -secret mlkem-secret.bin
tohex < mlkem-secret.bin

prints dad26963f7510c64b7c7d9b80731d6b573abf15999f5bed3076173e3f8c0cbdb

printf '%s' 302e020100300506032b656e04220420784edfa4400a57540a7cbd71957c8ab182ae801a5c519755abe69f553b9e8c5d | unhex > own.der
printf '%s' 302a300506032b656e032100339fdc7e19b200cb062df86bdf0e022c949abacd7db8dbdae0a92a6d9ba8d530 | unhex > peer.der
openssl pkeyutl -derive -inkey own.der -keyform DER -peerkey peer.der -peerform DER | tohex

prints 568c3055b3ac3516f0d780bbe022beb336ade7e7bae81752f2de6df09ebdc428

How it is computedThe handshake traffic secrets

The shared secret feeds the TLS 1.3 key schedule (RFC 9846 §7.1): a chain of HKDF-Extract and Derive-Secret steps. With no pre-shared key the early secret is HKDF-Extract of all zeros; mixing in the shared secret gives the handshake secret, from which the client and server handshake traffic secrets are derived against the ClientHello…ServerHello transcript.

Definition
early_secret     = HKDF-Extract(salt = 0, IKM = 0)            0 = 00 × 32
derived          = Derive-Secret(early_secret, "derived", "")
handshake_secret = HKDF-Extract(salt = derived, IKM = K ‖ Z)
c_hs_traffic     = Derive-Secret(handshake_secret, "c hs traffic", ClientHello ‖ ServerHello)
s_hs_traffic     = Derive-Secret(handshake_secret, "s hs traffic", ClientHello ‖ ServerHello)

Derive-Secret(S, label, M)        = HKDF-Expand-Label(S, label, SHA-256(M), 32)
HKDF-Expand-Label(S, label, C, n) = HKDF-Expand(S, HkdfLabel, n)
HkdfLabel = uint16(n) ‖ uint8(6 + |label|) ‖ "tls13 " ‖ label ‖ uint8(|C|) ‖ C
Values from this session
early_secret = HKDF-Extract(0, 0)
33ad0a1c607ec03b09e6cd9893680ce210adf300aa1f2660e1b22e10f170f92a
SHA-256("") — the empty-context hash
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
derived secret
6f2615a108c702c5678f54fc9dbab69716c076189c48250cebeac3576c3611ba
handshake_secret
06b849eff15c46a4401e154110a2e63a14f7333237260156f7f1b67ca3305198
SHA-256(ClientHello ‖ ServerHello)
0da9cb1015db6852c07fbdc2389ad83ee8b1898a147932620753ce82d3c0709c
HkdfLabel for "c hs traffic"
002012746c73313320632068732074726166666963200da9cb1015db6852c07fbdc2389ad83ee8b1898a147932620753ce82d3c0709c
client_handshake_traffic_secret
8b0beea15604895fd4408c32b82684d347fa5e2422644c1d93978db70666f623
server_handshake_traffic_secret
46925f99fa426e5dc105f5eaccfca048e1e89a93370b07cb9ab447518eb8f47f
What this proves
  • Equals the CLIENT_HANDSHAKE_TRAFFIC_SECRET line of both SSLKEYLOGFILEs.
  • Equals the SERVER_HANDSHAKE_TRAFFIC_SECRET line of both SSLKEYLOGFILEs.
Reproduce it yourself
openssl kdf -binary -keylen 32 -kdfopt digest:SHA256 -kdfopt mode:EXTRACT_ONLY \
  -kdfopt hexsalt:0000000000000000000000000000000000000000000000000000000000000000 \
  -kdfopt hexkey:0000000000000000000000000000000000000000000000000000000000000000 \
  HKDF | tohex

prints 33ad0a1c607ec03b09e6cd9893680ce210adf300aa1f2660e1b22e10f170f92a

openssl kdf -binary -keylen 32 -kdfopt digest:SHA256 -kdfopt mode:EXPAND_ONLY \
  -kdfopt hexkey:33ad0a1c607ec03b09e6cd9893680ce210adf300aa1f2660e1b22e10f170f92a \
  -kdfopt 'prefix:tls13 ' -kdfopt 'label:derived' \
  -kdfopt hexdata:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \
  TLS13-KDF | tohex

prints 6f2615a108c702c5678f54fc9dbab69716c076189c48250cebeac3576c3611ba

openssl kdf -binary -keylen 32 -kdfopt digest:SHA256 -kdfopt mode:EXTRACT_ONLY \
  -kdfopt hexsalt:6f2615a108c702c5678f54fc9dbab69716c076189c48250cebeac3576c3611ba \
  -kdfopt hexkey:dad26963f7510c64b7c7d9b80731d6b573abf15999f5bed3076173e3f8c0cbdb568c3055b3ac3516f0d780bbe022beb336ade7e7bae81752f2de6df09ebdc428 \
  HKDF | tohex

prints 06b849eff15c46a4401e154110a2e63a14f7333237260156f7f1b67ca3305198

unhex <<'EOF' | openssl dgst -sha256 -binary | tohex
010005c2030398fd30aaaf1617a1d20cc42c00c775d798dbaba001b1ae95ca6b
039f1e1fbbd7202bfbccd3b1cde003314afdea3e30508dd784674df104782760
5aeaca811f310d00061302130313010100057300000013001100000e70712d74
6c732e6578616d706c65000b000403000102000a0012001011ec001d0017001e
0018001901000101002300000016000000170000000d002a0028090509060904
04030503060308070808081a081b081c0809080a080b08040805080604010501
0601002b0003020304002d00020101003304ea04e811ec04c064180ac1469cd6
5bc990ebc8e4b7a5bf643e3a709d3f543a187c20c7aa082a02aecd74cb814452
7f8606b7a846953ca9f657ae6a7c7463f22ae0e44589139450d20b0311c7ca93
4a8898abde41c22c20b0367875bb8191d086a6a4141a6e4630d2588642d040c2
a73f8c82c8d6776a196c39f9066e9807a7b62b7745c12b6b04c2c2a0b235f889
8e16a1db48bdea02b66744b2e844b78a98a6796a10d2ab03143943f7d32286fc
8e78047854d555956c7db02079cbac0289cc60e345ceac998f7e4157b646c870
72627627076649b7b0ac7cc60294abe1229b42c4e8f9041d4b76268234550079
81ea36d3f62fc52382eec77f3796513b91a9a56ab1675466486475ebc287ac08
91185b37d1b36b31735a5d647b02481f0c1937dab04e3c956e15e69f89e83fb8
db43a428ab9d97a41e077e91a7b6ba26a350255c20b7a9791283aa5a181b8560
1b7971d993bcb698cd4dab1a92e8657b4329fad22705876904e2bd6ef5469cf8
a9c5674178d2b94d9065491b8fa530018bf15e0a1a17fefc67be14b07a755a80
5b650319025fc72c39b93141051ada437d154712647624b893be82f48ed0632d
a6317df11c56c14835b6d42b5a405f7eca9770675710b545e4f21cec18b139d7
b91a578a0416641f291950e5493cd170f7c8a4273a13bef81215bba72dc214d8
958db49a2004487aef97a672454758dc82f78704762c5264d596d9d38ce4589d
0f549710383924b16365596e2d6100cbc54e2eec665c572d13508b693c61445b
a7ea4b9a6a053c0c89ad955b43e8c035cb7130f6e85063d20e6f8652f592c069
02bedd0209ea14c79f9a902ee62a5a0b5f295779f1946a49b782bac2781b4922
354ca674a99b51d999e784659890acb2569dcc34aadcc51e52a637fea85dfc02
214d796fc64b424034cfa1e40cb114733e0c66fd4c990174c4dfe02d92e8b002
cc75d7597fb6ab5c27824c738c2bb3a239e2726ed9bc8cdecc944c992c9d3044
05493ff537a8d04632b3d3c0dca8ab98428cdd9184455455e7294d772c126e08
aa925c92c2660985b811ca041b7997646d909fe1671c83cccfbf2c49c7086587
d6beeb65a9596406bc95a88d7aa09ec58cc6c1b37366cd4d7c9ed49c90903995
f098412f1abfe1516ab63866b1a86d5f939691bb4dcff85c0cd62ada4c553c10
129e33b14f45a9794990f1501710c485b4c19370e1ca7d4326b092b12280316b
c76267957d5f48210a5baccb81a5d1fc985a77c8dc156fef1188d83616104623
1fe9352a16c8f2262946f3ca9015cb27e26e07052d19d7565e9623e1182cc2f0
67854708c921bd9f52852b810505b577146b31a2acb909440cfb2730e0ea520c
828b2b30c1d3c115700504a518ab05bac15c4a6fd634977748c6b0283b01784f
23179277199d1f399d66d5c2a3636d905a05b625a8e69686b43b166f635510e4
2dba6996bf10bdb0f2afea9ca9e9e8b1c41b012ed735d7646998d051f7124989
c29f3da18334ec22b5a47eea9c13fa9ac1d4e7bf9c1899abd96831f323bcd6ab
2d4caf33e86afeb475f7db256fd56da6c1367ce33a91260443e22573221f4295
3a4517046a2a951b9b41afdca2d156b5cb2c876ab032102392b02d7f437802dd
17ef543d6612ef4856f5558c2dddea2dde270fdab179bdb25309e0802926363e
d192b02f5261520f2056ba7af9a0acd1eee5bbe50181e0cf29001d002067aab4
deeec206fa89034014d772bdd47cedd7930610e81f634871565424f14d001b00
050400010003020004b60303498497776391725d59356de785c94cedb9c5def8
704f1426dfa548c1b589437f202bfbccd3b1cde003314afdea3e30508dd78467
4df1047827605aeaca811f310d130100046e002b000203040033046411ec0460
5db0e57cb763af0d1678753192830257df14de0eb4dd0d9a2d7ee2a7c94f4aab
2526fd0957b0c1025efff1763488c3bff22007fdd19b33a0e5605fc2b50ed3aa
adee4643eaa746cc65882d54a49ce4cb208226f6c732dc39981d81de9b788740
f6361120dc130f814bf5dd41d4df8682468e8ec8e2b3d5056cf245df0e0febe7
cf7423f725533dc39210093d57134c0e86a716d6d62694c9548082a5cd9352f2
fb8254397df2921d3a48702df9f622a7a539ba6110bec4736b6d15e38c558105
d6954e5fe1aec5b5ae065222fe1df4b1639e001695dcfba2d0aa09d14f9fee31
201383e58a16709631cb7b182ffbae8dc4e1345afd1763e55bb0714e92470c53
805f05ace3ce45402563cfd08db5429ffe5eeb033a7695530ee01ab7c5a179b1
1e3cd17082f457a158861fda8a9c08e7987dc5e18a48955ddba38766e14e09c3
b6319dbb5cb7c6c8e4aad9d40c2ec2b69e8ab793f742765d2af2644afc87cc1f
add8e0dc76f9725dfb9063f116ef8b02c7dc949160e22d716cfe1bed9a7eccae
e26ebc9615fd2c6e53a93bf97db63bbcae24bff5082a83dd2128fec9297cf449
2811d09363a21e98ac4869512ede9300c3fe5f049d7348404c56c37e1329fbbe
90fa854ef8b4de86c67bd16c4263f5eb99a50939a80086c9a1c0d038343d8c9e
d8b9300a6556d950492925628fb281cd077c82681f75e7aae144617adf613f49
11ff6e8f4246039f2ace861f2b2ec1d0f555e3e1a7fce9c80c6c2a8a062d0a64
7be31fc4b42c8776cd4b6517c4aa939a398b110c052e30a8eb746c476ee0dfc8
8866fbd8fdc816d20add8dbfeabcac6e0dac0f41a4e4822ab1f51b54e4bc178f
4eb7c07670704e425fd99205b8efd2f3fbccb200760127b1188fab5d7be84b06
87d779bfbe63e3b1db13f34ab9205d9f06312046e77737a05c070f1b808b5c80
9aa9e9945c52e4bf46d5b328030b42dbfba641cc0a39e6ace09361371d25fb3e
e78507a6fadfc2b6cd4a06851488b001d8b40a1ceb647b7d9debcbff6c375a13
73540d114e9bca1377b83192209bdb70824784b23da425bc7c8cca3ba0845d14
45e732d4e2327348f3a1d1f2499753bd5786ef80ef9a47c7293eedeef64d21ef
4ec47e847303fb963deff2f873efc8f2cfef263bdc40c34cb9aa80584e1ffd03
efe811cd6e12e4e6cdbda8a1ddc2df5f8f86462311425bae494f087f28524721
43e8bf6f53fb68f6063961b07dd34b0a4ebb4aba6b0f989f5955c4fe10088cae
6f7531a6b699f9e9dd34b2fc3ae102409bc97775b7bdc1e0028042e7c27fb8ed
c43c611b3ffd91de6a08a44700dd9b2d241488710e7cfabf974db0fd8a8f9b68
fee885b69d2cac23f6531af4f69c6f58e0d1ce620c47578c0bf4d3f3435df6ba
67556efaa65ec7bb518c76e840747c8454d0538f36134ee8beb0bd24a616a42d
fc826926ff9608def9b1c433d6e9ad8fcf1e11543a9595795f69c6630b60f581
156d98ce7e53124ceb06ce7e6e8054c6849aa2039b96cde7f9eac19b036b44a7
339fdc7e19b200cb062df86bdf0e022c949abacd7db8dbdae0a92a6d9ba8d530
EOF

prints 0da9cb1015db6852c07fbdc2389ad83ee8b1898a147932620753ce82d3c0709c

openssl kdf -binary -keylen 32 -kdfopt digest:SHA256 -kdfopt mode:EXPAND_ONLY \
  -kdfopt hexkey:06b849eff15c46a4401e154110a2e63a14f7333237260156f7f1b67ca3305198 \
  -kdfopt 'prefix:tls13 ' -kdfopt 'label:c hs traffic' \
  -kdfopt hexdata:0da9cb1015db6852c07fbdc2389ad83ee8b1898a147932620753ce82d3c0709c \
  TLS13-KDF | tohex

prints 8b0beea15604895fd4408c32b82684d347fa5e2422644c1d93978db70666f623

openssl kdf -binary -keylen 32 -kdfopt digest:SHA256 -kdfopt mode:EXPAND_ONLY \
  -kdfopt hexkey:06b849eff15c46a4401e154110a2e63a14f7333237260156f7f1b67ca3305198 \
  -kdfopt 'prefix:tls13 ' -kdfopt 'label:s hs traffic' \
  -kdfopt hexdata:0da9cb1015db6852c07fbdc2389ad83ee8b1898a147932620753ce82d3c0709c \
  TLS13-KDF | tohex

prints 46925f99fa426e5dc105f5eaccfca048e1e89a93370b07cb9ab447518eb8f47f

How it is computedThe handshake record keys

Each traffic secret expands into an AES-128-GCM key and a 12-byte write_iv through HKDF-Expand-Label. These decrypt every handshake record from EncryptedExtensions onward; the per-record nonce is the write_iv XOR-ed with the record's sequence number.

Definition
write_key = HKDF-Expand-Label(traffic_secret, "key", "", 16)     AES-128-GCM   RFC 9846 §7.3
write_iv  = HKDF-Expand-Label(traffic_secret, "iv",  "", 12)
nonce     = write_iv XOR uint96(seq)                             RFC 9846 §5.3
Values from this session
HkdfLabel for "key"
001009746c733133206b657900
server handshake key (AES-128)
5ed29e03b3495fd20354ed3f2421640a
server handshake write_iv
e465385b2d22f07ffc6a4079
client handshake key (AES-128)
96fa01469d090b2a8f4ef6b9fa5e0784
client handshake write_iv
9f45d2e464131048897a81c6
What this proves
    Reproduce it yourself
    openssl kdf -binary -keylen 16 -kdfopt digest:SHA256 -kdfopt mode:EXPAND_ONLY \
      -kdfopt hexkey:46925f99fa426e5dc105f5eaccfca048e1e89a93370b07cb9ab447518eb8f47f \
      -kdfopt 'prefix:tls13 ' -kdfopt 'label:key' \
      TLS13-KDF | tohex

    prints 5ed29e03b3495fd20354ed3f2421640a

    openssl kdf -binary -keylen 12 -kdfopt digest:SHA256 -kdfopt mode:EXPAND_ONLY \
      -kdfopt hexkey:46925f99fa426e5dc105f5eaccfca048e1e89a93370b07cb9ab447518eb8f47f \
      -kdfopt 'prefix:tls13 ' -kdfopt 'label:iv' \
      TLS13-KDF | tohex

    prints e465385b2d22f07ffc6a4079

    openssl kdf -binary -keylen 16 -kdfopt digest:SHA256 -kdfopt mode:EXPAND_ONLY \
      -kdfopt hexkey:8b0beea15604895fd4408c32b82684d347fa5e2422644c1d93978db70666f623 \
      -kdfopt 'prefix:tls13 ' -kdfopt 'label:key' \
      TLS13-KDF | tohex

    prints 96fa01469d090b2a8f4ef6b9fa5e0784

    openssl kdf -binary -keylen 12 -kdfopt digest:SHA256 -kdfopt mode:EXPAND_ONLY \
      -kdfopt hexkey:8b0beea15604895fd4408c32b82684d347fa5e2422644c1d93978db70666f623 \
      -kdfopt 'prefix:tls13 ' -kdfopt 'label:iv' \
      TLS13-KDF | tohex

    prints 9f45d2e464131048897a81c6

    Server → ClientRecord 3 · 6 bytes on the wire

    ChangeCipherSpec

    A single 0x01 byte that does nothing. TLS 1.3 keeps it only so the handshake looks like TLS 1.2 to middleboxes that would otherwise drop the connection (RFC 9846 Appendix E.4).

    On the wire · 6 bytes

    • The 1 byte match what OpenSSL printed for this record with -msg.
    Server → ClientRecord 4 · 28 bytes on the wire

    EncryptedExtensions

    The first encrypted message: the server's extensions that are not needed to set up keys. Here there are none, so the message is empty — but it is already protected under the server handshake key, which proves the key schedule works.

    Record protection

    This record is an application_data record carrying encrypted data. It is decrypted with AES-128-GCM under the server handshake traffic key, with the per-record nonce below; the 16-byte authentication tag is verified over the 5-byte record header as additional data (RFC 9846 §5.2).

    AES-128-GCM keywrite_key
    5ed29e03b3495fd20354ed3f2421640a
    Initialization vectorwrite_iv
    e465385b2d22f07ffc6a4079
    Nonce for sequence number 0nonce
    e465385b2d22f07ffc6a4079
    Additional data: the record headeradditional_data
    1703030017
    Authentication tagtag
    55c0c9b55b240c731db30884422ef691
    • The GCM tag verified: the record decrypts cleanly at sequence 0.
    • Re-encrypting the decrypted plaintext reproduces the captured record exactly.
    • The decrypted 6 bytes match what OpenSSL printed for this message with -msg.

    On the wire · 28 bytes

    Decrypted contents · 7 bytes

    Server → ClientRecord 5 · 524 bytes on the wire

    Certificate

    The server's certificate chain — one ECDSA P-256 certificate here — encrypted under the handshake key. The page parses it down to the two coordinates of the public key and checks the demo CA's signature over it.

    Record protection

    This record is an application_data record carrying encrypted data. It is decrypted with AES-128-GCM under the server handshake traffic key, with the per-record nonce below; the 16-byte authentication tag is verified over the 5-byte record header as additional data (RFC 9846 §5.2).

    AES-128-GCM keywrite_key
    5ed29e03b3495fd20354ed3f2421640a
    Initialization vectorwrite_iv
    e465385b2d22f07ffc6a4079
    Nonce for sequence number 1nonce
    e465385b2d22f07ffc6a4078
    Additional data: the record headeradditional_data
    1703030207
    Authentication tagtag
    01e58b85a9daa69fa78913be25313b55
    • The GCM tag verified: the record decrypts cleanly at sequence 1.
    • Re-encrypting the decrypted plaintext reproduces the captured record exactly.
    • The decrypted 502 bytes match what OpenSSL printed for this message with -msg.

    On the wire · 524 bytes

    Decrypted contents · 503 bytes

    How it is computedThe certificate chain

    The server's identity rests on an ordinary signature chain. The demo CA signed the server certificate's tbsCertificate bytes; verifying that signature with the CA's public key — and checking the name and validity — is what OpenSSL's "Verification: OK" stands for.

    Definition
    e     = SHA-256(tbsCertificate)
    valid = ECDSA-P256-Verify(Q_CA, e, (r, s))         ecdsa-with-SHA256   RFC 5758 §3.2
    Values from this session
    demo CA public key (uncompressed P-256 point)
    04136596262dfe32c00a117a326530235df0416dcfb8300ac1e76b4ceaa7c3417ab65dbcce2950dc2616c49bea9c842dcc4f7d2fe1a2157adc6e4900e72b78cf64
    SHA-256(tbsCertificate)
    68ec291c24ed1fc272a0439a31cd0d28307258ca08f3cc67bde7fa115516e293
    signature value r
    5f1c8dec01971b89bab6c887166550128ee211099c2ecbe17c0efd5d1c2d5e71
    signature value s
    323909f5ef7bb5a0743701eccfbe4ffbc7fdfefbd12d33733c05541d8d87c86b
    What this proves
    • The certificate's signature verifies against the CA (O=ecdsa.com, CN=Illustrated PQ TLS Demo CA).
    • The CA certificate is self-signed by O=ecdsa.com, CN=Illustrated PQ TLS Demo CA.
    • The certificate in the Certificate message is byte-for-byte the one the capture recorded.
    • The certificate's subjectAltName covers pq-tls.example.
    • The capture time 2026-10-20T11:32:29Z falls within the certificate's validity.
    • OpenSSL's s_client reported "Verification: OK" and the verified peer name.
    Reproduce it yourself
    cat > ca.pem <<'EOF'
    -----BEGIN CERTIFICATE-----
    MIIBtjCCAVygAwIBAgIUPfq2HpUguo3lvTcCMSTFcL+tV1swCgYIKoZIzj0EAwIw
    OTESMBAGA1UECgwJZWNkc2EuY29tMSMwIQYDVQQDDBpJbGx1c3RyYXRlZCBQUSBU
    TFMgRGVtbyBDQTAeFw0yNjEwMjAxMTMyMjlaFw0yNzEwMjAxMTMyMjlaMDkxEjAQ
    BgNVBAoMCWVjZHNhLmNvbTEjMCEGA1UEAwwaSWxsdXN0cmF0ZWQgUFEgVExTIERl
    bW8gQ0EwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQTZZYmLf4ywAoRejJlMCNd
    8EFtz7gwCsHna0zqp8NBerZdvM4pUNwmFsSb6pyELcxPfS/hohV63G5JAOcreM9k
    o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU
    1K3Yjw1jXxL5EZzxdBQ4jybTtAcwCgYIKoZIzj0EAwIDSAAwRQIgYKgqZkMtJeI9
    K8K7qZ2tdO5RPkRq7VYFUSdJZZxMNKACIQDs0idPxo5cjXaIzPUz3GNZeZGlQ0s9
    vjbIEmIss3iqJw==
    -----END CERTIFICATE-----
    EOF
    cat > server.pem <<'EOF'
    -----BEGIN CERTIFICATE-----
    MIIB5TCCAYygAwIBAgIUGfvagR77OCskKbwCCGme9dcUymUwCgYIKoZIzj0EAwIw
    OTESMBAGA1UECgwJZWNkc2EuY29tMSMwIQYDVQQDDBpJbGx1c3RyYXRlZCBQUSBU
    TFMgRGVtbyBDQTAeFw0yNjEwMjAxMTMyMjlaFw0yNjEyMDYxMTMyMjlaMBkxFzAV
    BgNVBAMMDnBxLXRscy5leGFtcGxlMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE
    vkyKek8iRLRJMhTwPtyzIi6agRiN4WF05FHlTfFE91h7RW5dsCsVIaxyYsvRhUQ/
    dZJrO8Vm3mzr9OWSBf4rz6OBkTCBjjAMBgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQE
    AwIHgDATBgNVHSUEDDAKBggrBgEFBQcDATAZBgNVHREEEjAQgg5wcS10bHMuZXhh
    bXBsZTAdBgNVHQ4EFgQUQsmdGy/ZbmpLy3vpYLmOhLcQs/4wHwYDVR0jBBgwFoAU
    1K3Yjw1jXxL5EZzxdBQ4jybTtAcwCgYIKoZIzj0EAwIDRwAwRAIgXxyN7AGXG4m6
    tsiHFmVQEo7iEQmcLsvhfA79XRwtXnECIDI5CfXve7WgdDcB7M++T/vH/f770S0z
    czwFVB2Nh8hr
    -----END CERTIFICATE-----
    EOF
    openssl verify -attime 1792495949 -CAfile ca.pem -verify_hostname pq-tls.example server.pem

    prints server.pem: OK

    Server → ClientRecord 6 · 102 bytes on the wire

    CertificateVerify

    The server signs the whole transcript so far with the private key of its certificate, proving it holds that key. The signature is verified against the public key from the Certificate message.

    Record protection

    This record is an application_data record carrying encrypted data. It is decrypted with AES-128-GCM under the server handshake traffic key, with the per-record nonce below; the 16-byte authentication tag is verified over the 5-byte record header as additional data (RFC 9846 §5.2).

    AES-128-GCM keywrite_key
    5ed29e03b3495fd20354ed3f2421640a
    Initialization vectorwrite_iv
    e465385b2d22f07ffc6a4079
    Nonce for sequence number 2nonce
    e465385b2d22f07ffc6a407b
    Additional data: the record headeradditional_data
    1703030061
    Authentication tagtag
    a7d50cfc2454b60756d83834baef0ca7
    • The GCM tag verified: the record decrypts cleanly at sequence 2.
    • Re-encrypting the decrypted plaintext reproduces the captured record exactly.
    • The decrypted 80 bytes match what OpenSSL printed for this message with -msg.

    On the wire · 102 bytes

    Decrypted contents · 81 bytes

    How it is computedThe CertificateVerify signature

    A valid certificate is not enough; the server must prove it holds the matching private key, right now, for this transcript. It signs a fixed context string plus the hash of everything through the Certificate message, and the client verifies the signature with the public key it just received.

    Definition
    content = 0x20 × 64 ‖ "TLS 1.3, server CertificateVerify" ‖ 0x00 ‖ SHA-256(ClientHello … Certificate)
    valid   = ECDSA-P256-Verify(Q_server, SHA-256(content), (r, s))      ecdsa_secp256r1_sha256
    Values from this session
    SHA-256(ClientHello … Certificate)
    af76fc7ac4f19eb2af3f584874eb0cd0429a06a15cf60faefa739b3fa4eb8aad
    signed content (130 bytes)
    20202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020544c5320312e332c2073657276657220436572746966696361746556657269667900af76fc7ac4f19eb2af3f584874eb0cd0429a06a15cf60faefa739b3fa4eb8aad
    server certificate public key (P-256 point)
    04be4c8a7a4f2244b4493214f03edcb3222e9a81188de16174e451e54df144f7587b456e5db02b1521ac7262cbd185443f75926b3bc566de6cebf4e59205fe2bcf
    signature value r
    e2a43fd0b309c60cd461d2e842bf89926c1d271a3f6e79ee5776cb8cc4f8ddbc
    signature value s
    a9667486294b49473c7bc82723f305694cdd7e8f591b587e2b75b909da995827
    What this proves
    • ecdsa_secp256r1_sha256 is a scheme the client offered in signature_algorithms.
    • The CertificateVerify signature verifies against the certificate's public key over the signed content.
    • The published demonstration signing key is the private key of the certificate.
    • OpenSSL's s_client reported the peer signature type ecdsa_secp256r1_sha256.
    Reproduce it yourself
    unhex > server.der <<'EOF'
    308201e53082018ca003020102021419fbda811efb382b2429bc0208699ef5d7
    14ca65300a06082a8648ce3d040302303931123010060355040a0c0965636473
    612e636f6d3123302106035504030c1a496c6c75737472617465642050512054
    4c532044656d6f204341301e170d3236313032303131333232395a170d323631
    3230363131333232395a30193117301506035504030c0e70712d746c732e6578
    616d706c653059301306072a8648ce3d020106082a8648ce3d03010703420004
    be4c8a7a4f2244b4493214f03edcb3222e9a81188de16174e451e54df144f758
    7b456e5db02b1521ac7262cbd185443f75926b3bc566de6cebf4e59205fe2bcf
    a3819130818e300c0603551d130101ff04023000300e0603551d0f0101ff0404
    0302078030130603551d25040c300a06082b0601050507030130190603551d11
    04123010820e70712d746c732e6578616d706c65301d0603551d0e0416041442
    c99d1b2fd96e6a4bcb7be960b98e84b710b3fe301f0603551d23041830168014
    d4add88f0d635f12f9119cf17414388f26d3b407300a06082a8648ce3d040302
    034700304402205f1c8dec01971b89bab6c887166550128ee211099c2ecbe17c
    0efd5d1c2d5e710220323909f5ef7bb5a0743701eccfbe4ffbc7fdfefbd12d33
    733c05541d8d87c86b
    EOF
    openssl x509 -inform DER -in server.der -pubkey -noout > server-pub.pem
    { printf '%64s' ''; printf 'TLS 1.3, server CertificateVerify\000'; printf '%s' af76fc7ac4f19eb2af3f584874eb0cd0429a06a15cf60faefa739b3fa4eb8aad | unhex; } > signed.bin
    printf '%s' 3046022100e2a43fd0b309c60cd461d2e842bf89926c1d271a3f6e79ee5776cb8cc4f8ddbc022100a9667486294b49473c7bc82723f305694cdd7e8f591b587e2b75b909da995827 | unhex > signature.der
    openssl dgst -sha256 -verify server-pub.pem -signature signature.der signed.bin

    prints Verified OK

    printf '%s' 3031020101042011aa8fac7486c821d6c57baa03c3a3e119a635f33aaa2043bba12d7f20a40a99a00a06082a8648ce3d030107 | unhex > server-key.der
    openssl ec -inform DER -in server-key.der -pubout -outform DER 2>/dev/null | tail -c 65 | tohex

    prints 04be4c8a7a4f2244b4493214f03edcb3222e9a81188de16174e451e54df144f7587b456e5db02b1521ac7262cbd185443f75926b3bc566de6cebf4e59205fe2bcf

    Server → ClientRecord 7 · 58 bytes on the wire

    Finished (server)

    An HMAC over the entire handshake transcript, keyed by a secret only someone with the handshake keys could have. It seals the server's half of the handshake; once the client checks it, the server is authenticated and the keys are confirmed.

    Record protection

    This record is an application_data record carrying encrypted data. It is decrypted with AES-128-GCM under the server handshake traffic key, with the per-record nonce below; the 16-byte authentication tag is verified over the 5-byte record header as additional data (RFC 9846 §5.2).

    AES-128-GCM keywrite_key
    5ed29e03b3495fd20354ed3f2421640a
    Initialization vectorwrite_iv
    e465385b2d22f07ffc6a4079
    Nonce for sequence number 3nonce
    e465385b2d22f07ffc6a407a
    Additional data: the record headeradditional_data
    1703030035
    Authentication tagtag
    19198cc6e0426e75d2b219994f1a0467
    • The GCM tag verified: the record decrypts cleanly at sequence 3.
    • Re-encrypting the decrypted plaintext reproduces the captured record exactly.
    • The decrypted 36 bytes match what OpenSSL printed for this message with -msg.

    On the wire · 58 bytes

    Decrypted contents · 37 bytes

    How it is computedThe server's Finished

    The server's Finished is an HMAC over the whole transcript so far, keyed by a secret derived from the handshake traffic secret. Only a party that computed the same keys can produce it, so checking it confirms both the server's keys and that the transcript was not tampered with.

    Definition
    finished_key = HKDF-Expand-Label(s_hs_traffic, "finished", "", 32)
    verify_data  = HMAC-SHA256(finished_key, SHA-256(ClientHello … CertificateVerify))
    Values from this session
    server finished_key
    0506725331e4fe72ae23212deef946f34556d38825410fb427bf071ee67951a1
    SHA-256(ClientHello … CertificateVerify)
    9e49537a2a313824d7825cbef2384d2a12ae91c8e09dcf3ac42fcd2393dae658
    verify_data = HMAC(finished_key, transcript)
    37187ea7e2a1e27e9d42e736edaac65dccc6dc9d03e7b862019dac0212000280
    What this proves
    • The recomputed verify_data equals the one in the Finished message.
    Reproduce it yourself
    openssl kdf -binary -keylen 32 -kdfopt digest:SHA256 -kdfopt mode:EXPAND_ONLY \
      -kdfopt hexkey:46925f99fa426e5dc105f5eaccfca048e1e89a93370b07cb9ab447518eb8f47f \
      -kdfopt 'prefix:tls13 ' -kdfopt 'label:finished' \
      TLS13-KDF | tohex

    prints 0506725331e4fe72ae23212deef946f34556d38825410fb427bf071ee67951a1

    printf '%s' 9e49537a2a313824d7825cbef2384d2a12ae91c8e09dcf3ac42fcd2393dae658 | unhex | openssl mac -binary -digest SHA256 -macopt hexkey:0506725331e4fe72ae23212deef946f34556d38825410fb427bf071ee67951a1 HMAC | tohex

    prints 37187ea7e2a1e27e9d42e736edaac65dccc6dc9d03e7b862019dac0212000280

    How it is computedThe application traffic secrets

    Once the server's half is done, the schedule advances to the main secret and derives the application traffic secrets against the transcript through the server Finished, plus the exporter secret. Their keys protect all application data; OpenSSL logged all three, which the page matches.

    Definition
    derived         = Derive-Secret(handshake_secret, "derived", "")
    main_secret     = HKDF-Extract(salt = derived, IKM = 0)          RFC 8446: master_secret
    c_ap_traffic    = Derive-Secret(main_secret, "c ap traffic", ClientHello … server Finished)
    s_ap_traffic    = Derive-Secret(main_secret, "s ap traffic", ClientHello … server Finished)
    exporter_secret = Derive-Secret(main_secret, "exp master",   ClientHello … server Finished)
    
    write_key = HKDF-Expand-Label(c_ap_traffic | s_ap_traffic, "key", "", 16)
    write_iv  = HKDF-Expand-Label(c_ap_traffic | s_ap_traffic, "iv",  "", 12)
    Values from this session
    derived secret
    cf180a268bf009d2b86962078fe3a21b7946acf2bf393b3a1672276547e88a81
    main_secret (master_secret in RFC 8446)
    535beb1d564ea9c45dce195f453307900f8548a29f3889d55aea446547724e1b
    SHA-256(ClientHello … server Finished)
    5a0c617c785aacf18760a5272a8424b31be9504bf266939c6d0c7a008ca49adb
    client_application_traffic_secret_0
    822f761f7f0218c1566132cf545c5f7b632ec3c9e5c454254c1ab051f2a92dec
    server_application_traffic_secret_0
    556780cd0561751359abc293e490bbdff13dee06fe016160961add756502e56d
    exporter_master_secret
    fdf77404b2ef159adf31a636a7efb2a693ed0491d0362d0eb270ad93bd96592e
    server application key (AES-128)
    f2c6df22d8075b76928d37545f335a64
    server application write_iv
    d3bd0df90c48d9fbb108cffb
    client application key (AES-128)
    58391c840aa46afae3552c38ad15b95b
    client application write_iv
    68020e323a5ac9a9f0a4d49c
    What this proves
    • Equals the CLIENT_TRAFFIC_SECRET_0 line of both SSLKEYLOGFILEs.
    • Equals the SERVER_TRAFFIC_SECRET_0 line of both SSLKEYLOGFILEs.
    • Equals the EXPORTER_SECRET line of both SSLKEYLOGFILEs.
    Reproduce it yourself
    openssl kdf -binary -keylen 32 -kdfopt digest:SHA256 -kdfopt mode:EXPAND_ONLY \
      -kdfopt hexkey:06b849eff15c46a4401e154110a2e63a14f7333237260156f7f1b67ca3305198 \
      -kdfopt 'prefix:tls13 ' -kdfopt 'label:derived' \
      -kdfopt hexdata:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \
      TLS13-KDF | tohex

    prints cf180a268bf009d2b86962078fe3a21b7946acf2bf393b3a1672276547e88a81

    openssl kdf -binary -keylen 32 -kdfopt digest:SHA256 -kdfopt mode:EXTRACT_ONLY \
      -kdfopt hexsalt:cf180a268bf009d2b86962078fe3a21b7946acf2bf393b3a1672276547e88a81 \
      -kdfopt hexkey:0000000000000000000000000000000000000000000000000000000000000000 \
      HKDF | tohex

    prints 535beb1d564ea9c45dce195f453307900f8548a29f3889d55aea446547724e1b

    openssl kdf -binary -keylen 32 -kdfopt digest:SHA256 -kdfopt mode:EXPAND_ONLY \
      -kdfopt hexkey:535beb1d564ea9c45dce195f453307900f8548a29f3889d55aea446547724e1b \
      -kdfopt 'prefix:tls13 ' -kdfopt 'label:c ap traffic' \
      -kdfopt hexdata:5a0c617c785aacf18760a5272a8424b31be9504bf266939c6d0c7a008ca49adb \
      TLS13-KDF | tohex

    prints 822f761f7f0218c1566132cf545c5f7b632ec3c9e5c454254c1ab051f2a92dec

    openssl kdf -binary -keylen 32 -kdfopt digest:SHA256 -kdfopt mode:EXPAND_ONLY \
      -kdfopt hexkey:535beb1d564ea9c45dce195f453307900f8548a29f3889d55aea446547724e1b \
      -kdfopt 'prefix:tls13 ' -kdfopt 'label:s ap traffic' \
      -kdfopt hexdata:5a0c617c785aacf18760a5272a8424b31be9504bf266939c6d0c7a008ca49adb \
      TLS13-KDF | tohex

    prints 556780cd0561751359abc293e490bbdff13dee06fe016160961add756502e56d

    Client → ServerRecord 8 · 6 bytes on the wire

    ChangeCipherSpec

    The client's matching dummy record, for the same middlebox reason.

    On the wire · 6 bytes

    • The 1 byte match what OpenSSL printed for this record with -msg.
    Client → ServerRecord 9 · 58 bytes on the wire

    Finished (client)

    The client's HMAC over the transcript through the server's Finished. It completes the handshake: both sides are now authenticated and switch to the application keys.

    Record protection

    This record is an application_data record carrying encrypted data. It is decrypted with AES-128-GCM under the client handshake traffic key, with the per-record nonce below; the 16-byte authentication tag is verified over the 5-byte record header as additional data (RFC 9846 §5.2).

    AES-128-GCM keywrite_key
    96fa01469d090b2a8f4ef6b9fa5e0784
    Initialization vectorwrite_iv
    9f45d2e464131048897a81c6
    Nonce for sequence number 0nonce
    9f45d2e464131048897a81c6
    Additional data: the record headeradditional_data
    1703030035
    Authentication tagtag
    f3a8eac5bf26a9ac3aaca3a4afebd656
    • The GCM tag verified: the record decrypts cleanly at sequence 0.
    • Re-encrypting the decrypted plaintext reproduces the captured record exactly.
    • The decrypted 36 bytes match what OpenSSL printed for this message with -msg.

    On the wire · 58 bytes

    Decrypted contents · 37 bytes

    How it is computedThe client's Finished

    The client answers with its own Finished — an HMAC over the transcript through the server's Finished, keyed from the client handshake traffic secret. When the server checks it, the handshake is complete and authenticated in both directions.

    Definition
    finished_key = HKDF-Expand-Label(c_hs_traffic, "finished", "", 32)
    verify_data  = HMAC-SHA256(finished_key, SHA-256(ClientHello … server Finished))
    Values from this session
    client finished_key
    780c2e56af642c22fc8ae057276cd0d8bde149879a68ccb28064b4cf6b677a73
    SHA-256(ClientHello … server Finished)
    5a0c617c785aacf18760a5272a8424b31be9504bf266939c6d0c7a008ca49adb
    verify_data = HMAC(finished_key, transcript)
    e1c250d75d6df181b0df677983ec692a146f428d982a0b4281cca28607ac7fb1
    What this proves
    • The recomputed verify_data equals the one in the Finished message.
    Reproduce it yourself
    openssl kdf -binary -keylen 32 -kdfopt digest:SHA256 -kdfopt mode:EXPAND_ONLY \
      -kdfopt hexkey:8b0beea15604895fd4408c32b82684d347fa5e2422644c1d93978db70666f623 \
      -kdfopt 'prefix:tls13 ' -kdfopt 'label:finished' \
      TLS13-KDF | tohex

    prints 780c2e56af642c22fc8ae057276cd0d8bde149879a68ccb28064b4cf6b677a73

    printf '%s' 5a0c617c785aacf18760a5272a8424b31be9504bf266939c6d0c7a008ca49adb | unhex | openssl mac -binary -digest SHA256 -macopt hexkey:780c2e56af642c22fc8ae057276cd0d8bde149879a68ccb28064b4cf6b677a73 HMAC | tohex

    prints e1c250d75d6df181b0df677983ec692a146f428d982a0b4281cca28607ac7fb1

    Server → ClientRecord 10 · 239 bytes on the wire

    NewSessionTicket

    A post-handshake gift from the server: a ticket the client can present next time to resume without a full key exchange. The pre-shared key it stands for is derived from the resumption secret and the ticket's nonce.

    Record protection

    This record is an application_data record carrying encrypted data. It is decrypted with AES-128-GCM under the server application traffic key, with the per-record nonce below; the 16-byte authentication tag is verified over the 5-byte record header as additional data (RFC 9846 §5.2).

    AES-128-GCM keywrite_key
    f2c6df22d8075b76928d37545f335a64
    Initialization vectorwrite_iv
    d3bd0df90c48d9fbb108cffb
    Nonce for sequence number 0nonce
    d3bd0df90c48d9fbb108cffb
    Additional data: the record headeradditional_data
    17030300ea
    Authentication tagtag
    da58bb9fa9790e3f945cd811785d9ab3
    • The GCM tag verified: the record decrypts cleanly at sequence 0.
    • Re-encrypting the decrypted plaintext reproduces the captured record exactly.
    • The decrypted 217 bytes match what OpenSSL printed for this message with -msg.

    On the wire · 239 bytes

    Decrypted contents · 218 bytes

    How it is computedThe resumption pre-shared key

    The ticket is useless without the secret it names. That pre-shared key is derived from the resumption secret (itself from the transcript through the client Finished) and the ticket's nonce. OpenSSL printed both the PSK and the ticket; the page recomputes the PSK and matches them.

    Definition
    resumption_secret = Derive-Secret(main_secret, "res master", ClientHello … client Finished)
    PSK               = HKDF-Expand-Label(resumption_secret, "resumption", ticket_nonce, 32)
    Values from this session
    SHA-256(ClientHello … client Finished)
    b014275674636844d99285ea448e9c45e92acb5bc9bf249fa8d94b7796eb1211
    resumption_master_secret
    d013100d5c7e78c4d128a445969ce4ed1ddc3cd63a7f63bddcd82728d5129f8a
    ticket_nonce from the NewSessionTicket
    0000000000000000
    resumption PSK
    d1039d8e602a12c21ed17aa291499d5f1ef30eda117144c3591d5fccd74f7c0d
    What this proves
    • The recomputed resumption PSK equals the one s_client printed.
    • The 192 ticket bytes match the ticket s_client printed.
    Reproduce it yourself
    openssl kdf -binary -keylen 32 -kdfopt digest:SHA256 -kdfopt mode:EXPAND_ONLY \
      -kdfopt hexkey:535beb1d564ea9c45dce195f453307900f8548a29f3889d55aea446547724e1b \
      -kdfopt 'prefix:tls13 ' -kdfopt 'label:res master' \
      -kdfopt hexdata:b014275674636844d99285ea448e9c45e92acb5bc9bf249fa8d94b7796eb1211 \
      TLS13-KDF | tohex

    prints d013100d5c7e78c4d128a445969ce4ed1ddc3cd63a7f63bddcd82728d5129f8a

    openssl kdf -binary -keylen 32 -kdfopt digest:SHA256 -kdfopt mode:EXPAND_ONLY \
      -kdfopt hexkey:d013100d5c7e78c4d128a445969ce4ed1ddc3cd63a7f63bddcd82728d5129f8a \
      -kdfopt 'prefix:tls13 ' -kdfopt 'label:resumption' \
      -kdfopt hexdata:0000000000000000 \
      TLS13-KDF | tohex

    prints d1039d8e602a12c21ed17aa291499d5f1ef30eda117144c3591d5fccd74f7c0d

    Client → ServerRecord 11 · 49 bytes on the wire

    Application data (request)

    The first real payload, under the client application key: a one-line HTTP request. From here the record content type is hidden inside the encryption.

    Record protection

    This record is an application_data record carrying encrypted data. It is decrypted with AES-128-GCM under the client application traffic key, with the per-record nonce below; the 16-byte authentication tag is verified over the 5-byte record header as additional data (RFC 9846 §5.2).

    AES-128-GCM keywrite_key
    58391c840aa46afae3552c38ad15b95b
    Initialization vectorwrite_iv
    68020e323a5ac9a9f0a4d49c
    Nonce for sequence number 0nonce
    68020e323a5ac9a9f0a4d49c
    Additional data: the record headeradditional_data
    170303002c
    Authentication tagtag
    44f8869fbc72bc4a095024412310f30e
    • The GCM tag verified: the record decrypts cleanly at sequence 0.
    • Re-encrypting the decrypted plaintext reproduces the captured record exactly.
    • The decrypted content type and bytes match OpenSSL's -msg trace.

    On the wire · 49 bytes

    Decrypted contents · 28 bytes

    Server → ClientRecord 12 · 130 bytes on the wire

    Application data (response)

    The server's answer under its application key: the HTTP response with the file the client asked for.

    Record protection

    This record is an application_data record carrying encrypted data. It is decrypted with AES-128-GCM under the server application traffic key, with the per-record nonce below; the 16-byte authentication tag is verified over the 5-byte record header as additional data (RFC 9846 §5.2).

    AES-128-GCM keywrite_key
    f2c6df22d8075b76928d37545f335a64
    Initialization vectorwrite_iv
    d3bd0df90c48d9fbb108cffb
    Nonce for sequence number 1nonce
    d3bd0df90c48d9fbb108cffa
    Additional data: the record headeradditional_data
    170303007d
    Authentication tagtag
    152ee3122b64d6188a96491377f3ba2d
    • The GCM tag verified: the record decrypts cleanly at sequence 1.
    • Re-encrypting the decrypted plaintext reproduces the captured record exactly.
    • The decrypted content type and bytes match OpenSSL's -msg trace.

    On the wire · 130 bytes

    Decrypted contents · 109 bytes

    Server → ClientRecord 13 · 24 bytes on the wire

    Alert (close_notify)

    The server signals a clean close. Alerts are encrypted too, so even the shutdown is confidential.

    Record protection

    This record is an application_data record carrying encrypted data. It is decrypted with AES-128-GCM under the server application traffic key, with the per-record nonce below; the 16-byte authentication tag is verified over the 5-byte record header as additional data (RFC 9846 §5.2).

    AES-128-GCM keywrite_key
    f2c6df22d8075b76928d37545f335a64
    Initialization vectorwrite_iv
    d3bd0df90c48d9fbb108cffb
    Nonce for sequence number 2nonce
    d3bd0df90c48d9fbb108cff9
    Additional data: the record headeradditional_data
    1703030013
    Authentication tagtag
    d1a180f9a2947d57978b590f4ea3faa8
    • The GCM tag verified: the record decrypts cleanly at sequence 2.
    • Re-encrypting the decrypted plaintext reproduces the captured record exactly.
    • The decrypted 2 bytes match what OpenSSL printed for this message with -msg.

    On the wire · 24 bytes

    Decrypted contents · 3 bytes

    Client → ServerRecord 14 · 24 bytes on the wire

    Alert (close_notify)

    The client acknowledges the close and the connection ends.

    Record protection

    This record is an application_data record carrying encrypted data. It is decrypted with AES-128-GCM under the client application traffic key, with the per-record nonce below; the 16-byte authentication tag is verified over the 5-byte record header as additional data (RFC 9846 §5.2).

    AES-128-GCM keywrite_key
    58391c840aa46afae3552c38ad15b95b
    Initialization vectorwrite_iv
    68020e323a5ac9a9f0a4d49c
    Nonce for sequence number 1nonce
    68020e323a5ac9a9f0a4d49d
    Additional data: the record headeradditional_data
    1703030013
    Authentication tagtag
    daf6ae55a253a373f23464e913920d47
    • The GCM tag verified: the record decrypts cleanly at sequence 1.
    • Re-encrypting the decrypted plaintext reproduces the captured record exactly.
    • The decrypted 2 bytes match what OpenSSL printed for this message with -msg.

    On the wire · 24 bytes

    Decrypted contents · 3 bytes

    Checked against OpenSSL's key log

    OpenSSL wrote an SSLKEYLOGFILE on each side — the format Wireshark reads to decrypt a capture. Each of its five secrets is one of the traffic secrets computed above, so matching them end to end is the proof that the key schedule on this page is the one the real connection used.

    SSLKEYLOGFILE labelSecret (hex)Derived on this page as
    SERVER_HANDSHAKE_TRAFFIC_SECRET46925f99fa426e5dc105f5eaccfca048e1e89a93370b07cb9ab447518eb8f47fserver_handshake_traffic_secret
    EXPORTER_SECRETfdf77404b2ef159adf31a636a7efb2a693ed0491d0362d0eb270ad93bd96592eexporter_master_secret
    SERVER_TRAFFIC_SECRET_0556780cd0561751359abc293e490bbdff13dee06fe016160961add756502e56dserver_application_traffic_secret_0
    CLIENT_HANDSHAKE_TRAFFIC_SECRET8b0beea15604895fd4408c32b82684d347fa5e2422644c1d93978db70666f623client_handshake_traffic_secret
    CLIENT_TRAFFIC_SECRET_0822f761f7f0218c1566132cf545c5f7b632ec3c9e5c454254c1ab051f2a92decclient_application_traffic_secret_0

    How this was captured

    The handshake is a real one, not a mock: two OpenSSL processes talking TLS 1.3 over loopback inside one pinned container, with the packets recorded off the wire. Re-running the capture produces a new session with the same structure.

    Container image
    node:24.22.0-trixie@sha256:ff054b356ab93ed540518ca23cfcd9840e5256dd04db5a8d8afc43f4ecc7c9f8
    OpenSSL
    OpenSSL 3.5.7 9 Jun 2026 (Library: OpenSSL 3.5.7 9 Jun 2026)
    Captured
    2026-10-20T11:32:29Z
    Server
    openssl s_server -accept 4433 -naccept 1 -WWW -cert server.crt -key server.key -tls1_3 -ciphersuites TLS_AES_128_GCM_SHA256 -groups X25519MLKEM768 -num_tickets 1 -keylogfile server-keylog.txt
    Client
    openssl s_client -connect 127.0.0.1:4433 -servername pq-tls.example -verify_hostname pq-tls.example -CAfile ca.crt -verify_return_error -tls1_3 -keylogfile client-keylog.txt -ign_eof -msg -msgfile client-msg.txt

    Each command is self-contained apart from these two helpers; paste them first (OpenSSL 3.5, with Perl and od, both present on Linux and macOS):

    unhex() { perl -0777 -ne 's/\s+//g; print pack("H*", $_)'; }
    tohex() { od -An -v -tx1 | tr -d ' \n'; echo; }

    Specifications

    The hybrid key exchange is RFC 10024 (X25519MLKEM768), combining ML-KEM-768 from NIST FIPS 203 with X25519 from RFC 7748; the hybrid construction and share order follow RFC 9954; everything else is TLS 1.3 as specified in RFC 9846 (which obsoletes RFC 8446), with the key-schedule trace cross-checked against RFC 8448. Codepoint and algorithm names come from the IANA TLS and the object-identifier registries.

    The format of this page — a real connection, every byte explained — follows The Illustrated TLS 1.3 Connection, by Michael Driscoll (MIT-licensed). The capture, the explanations and the code here are our own; this page adds the post-quantum key exchange.