← Back to section · Foundations of Cryptography

Key Confirmation and Key Derivation: The Two Steps After the Exchange

Finishing the DH computation is not the same as finishing the handshake: the secret must first be processed by a KDF into real session keys, and both sides must prove they derived the same thing. This article explains where key derivation (extract and expand) and key confirmation (explicit and implicit) sit in the exchange flow, and where implementations commonly slip.

Published 22 November 2026 · 5 min read · PQ Frontier

Key Confirmation and Key Derivation: The Two Steps After the Exchange
AI-generated site artwork
Video explainer · Key exchange: birth of a shared secret

In most people’s picture, key exchange ends the moment the DH computation finishes and both sides hold the shared secret. In real protocols, that moment is merely the arrival of raw material: the shared secret is not yet usable, and neither side has confirmed they hold the same thing. Between the shared secret and actual work stand key derivation and key confirmation — unglamorous steps that have historically been fertile ground for vulnerabilities.

Why the shared secret cannot be used as a key directly

A DH shared secret is a group element: a number modulo p in finite fields, or the x-coordinate of a point on an elliptic curve. Its distribution is not uniform — some bits carry structural bias, some values occur with higher probability. Session keys are required to be indistinguishable from uniform random, so truncating the group element and calling it an AES key hands that bias straight to the symmetric cipher, and the security proof breaks right there. A KEM’s shared secret, although defined by standards as a byte string, still goes through derivation for context binding and key separation.

Moreover, a session rarely needs just one key: two directions of traffic want separate keys, encryption and integrity protection should be separated, and different handshake phases need different keys. Slicing one secret into multiple mutually independent subkeys by purpose is the derivation function’s other job.

Key derivation: extract, expand, and bind the context

The standard shape of modern derivation is HKDF (RFC 5869), which splits derivation into two stages with crisp responsibilities:

  • Extract: run HMAC with a salt over the raw key material, “concentrating” input of arbitrary distribution into a short, uniform pseudorandom key (PRK). This stage solves the distribution problem.
  • Expand: starting from the PRK, iterate HMAC with different info labels to derive as many subkeys of arbitrary length as needed. Labels state the purpose — such as “client application traffic secret” — and outputs under different labels are mutually independent.

The info label should also bind in context: the protocol version, the negotiated algorithm suite, even a hash of the entire handshake transcript. Keys derived this way belong only to “this session, under this configuration”, and an attacker cannot transplant key material into another protocol or a downgraded session — cross-context reuse of exactly this kind is the core technique behind several real attacks.

TLS 1.3’s key schedule is the complete demonstration of the two-stage HKDF pattern: it takes the ephemeral DH secret as input and proceeds along the chain “early secret → handshake secret → master secret”, extracting and expanding stage by stage, each stage feeding the current handshake transcript hash in as label input, and finally derives separate traffic keys and IVs for client and server. The Noise framework and Signal’s ratchet follow the same “chained derivation plus transcript binding” structure.

Key confirmation: proving we derived the same key

Derivation settles whether the key is good; confirmation settles whether it is the same. In key confirmation, before real traffic begins, each side computes a MAC over agreed data under the newly derived key (or encrypts a known value with it) for the peer to verify. It provides two guarantees:

  • Consistency: both sides really did derive identical keys. If an implementation bug or a parameter misunderstanding exists, confirmation fails immediately instead of surfacing when application data refuses to decrypt.
  • Liveness and possession: whoever produces the correct MAC necessarily holds the key and is participating in this session right now. Explicit key confirmation turns “the peer exists and holds the key” into a hard precondition for handshake completion.

Confirmation comes in explicit and implicit forms. Explicit confirmation is a dedicated message (such as TLS’s Finished, essentially a MAC over the whole handshake transcript) visible in the handshake flow. Implicit confirmation has no dedicated message: the first AEAD tag on real data doubles as confirmation — if the first packet opens, the keys match. TLS 1.3’s Finished is the benchmark for explicit confirmation: it merges key confirmation with transcript integrity into one step, incidentally sealing off any tampering with handshake messages.

What happens without confirmation? In several historical protocols, key mismatches lurked until the application layer and were extremely costly to debug. More dangerously, a handshake without confirmation leaves room for the “half-way man in the middle”: an attacker completes an exchange with the victim while the victim believes the peer is the target server, and without a confirmation step the mismatch cannot be caught during the handshake. For implicitly authenticated schemes such as static DH, key confirmation often doubles as the final landing point of authentication itself: being able to confirm the key is equivalent to proving possession of the static private key.

Salts, labels, and the usual derivation mistakes

The failure modes of the derivation step follow a pattern regular enough to list. First, treating the salt as decoration: if the Extract-stage salt is fixed forever or omitted entirely, the concentration effect is discounted, and derivation outputs across sessions or deployments can acquire correlations they should never have. Second, label reuse: if two subkeys for different purposes share one info label, they become the same key, and key separation evaporates — there really have been protocols where ambiguous label strings made the encryption key and the integrity key derive to identical values. Third, incomplete derivation input: feeding only the shared secret into the KDF while omitting negotiated parameters and transcript information leaves the key detached from the session context it was supposed to bind. Fourth, over-truncation: taking far fewer bits from the derivation output than security requires, or using the same stretch of output as both key and initialisation vector. These mistakes share a trait: each step individually “uses a KDF”, yet together they leak away the derivation function’s security promises one by one. The most effective way to review a derivation design is to ask three questions of every derivation call — is the input complete, is the label unique and purpose-stating, and does the output length match the purpose?

Placed back into the flow: key exchange produces the raw material, the KDF processes it into a set of labelled, context-bound, mutually isolated working keys, and key confirmation cross-checks them once before work begins. Together the three constitute the full meaning of “exchange complete” — the DH computation is only the step that happened to be invented first.

Tags: KDFHKDFKey ConfirmationKey Derivation