Applied Cryptography and Key Management Questions
Selecting and applying cryptographic primitives correctly: symmetric and asymmetric encryption, hashing, digital signatures, key derivation, secure random number generation, and public key infrastructure. Covers key lifecycle management, key exchange and distribution, choosing appropriate algorithms for a given constraint set including resource-constrained environments, and the forward-looking side of algorithm lifecycle: cryptographic agility and algorithm-migration strategy, forward secrecy, and the post-quantum cryptography transition and planning upgrades without breaking existing data or interoperability. The applied-crypto engineering layer, distinct from compliance-driven crypto standards.
Summarize NIST's post-quantum cryptography standardization effort: which algorithm families and specific algorithms has NIST selected for KEMs and signatures, and how should an organization use that activity when planning a migration? Explain why production deployments favor hybrid classical-plus-PQ patterns (parallel key encapsulation, dual signatures) rather than switching outright, and the main pitfalls to avoid when implementing a hybrid.
Sample Answer
Direct answer: NIST finalized three post-quantum cryptography (PQC) standards in August 2024: FIPS 203 (ML-KEM, a key encapsulation mechanism, meaning an algorithm two parties use to agree on a shared secret), FIPS 204 (ML-DSA, the primary general-purpose signature scheme), and FIPS 205 (SLH-DSA, a hash-based signature kept as a conservative backup built on different mathematical assumptions). A fourth, FIPS 206 (FN-DSA, offering smaller signatures), is still in draft as of 2026, not yet finalized, so organizations should plan around the first three now and treat FN-DSA as directional rather than a firm dependency. Production deployments favor hybrid classical-plus-PQ constructions rather than switching outright, because the new lattice-based math has roughly a decade of serious cryptanalysis behind it versus elliptic-curve cryptography's three-plus decades, and a properly combined hybrid is only as weak as its strongest component.
What this means for migration planning. The "we're waiting for NIST to decide" excuse is over for key exchange and general-purpose signing. Cryptographic inventory work (knowing exactly where every algorithm is actually used) and algorithm-agility groundwork, versioned ciphertext and certificate formats, a documented decision record for each choice, should start now, targeting these three finalized families. Do not architect a hard dependency on FN-DSA yet since its parameters and even its finalization timeline could still shift.
Why hybrid, not a straight switch
- Defense against implementation immaturity of the new math. If a properly designed hybrid combiner is used, breaking the hybrid requires breaking both the classical and the post-quantum component. If lattice cryptography turns out to have an unforeseen flaw, the classical component alone still protects you; the reverse is also true against a future quantum computer.
- Compliance transition. Many existing compliance regimes still mandate specific classical, FIPS-approved algorithms; a hybrid can satisfy that mandate while also adding post-quantum protection, whereas a pure PQ-only deployment might not yet satisfy an unmodified compliance requirement.
- Interoperability during rollout. Not every peer supports the new algorithms yet; a hybrid degrades gracefully where a hard switch would simply fail to connect.
Main pitfalls implementing a hybrid
- Getting the combiner wrong. Naively concatenating two shared secrets is not automatically secure on its own; the combiner needs to be a proven construction. For TLS 1.3, RFC 9954 specifies exactly how the classical and post-quantum shared secrets are combined via the existing key schedule's HKDF step; do not invent your own combining function.
- Bandwidth and fragmentation. ML-KEM-768 alone adds roughly 2.2 KB of key-exchange material to a handshake (see the worked arithmetic below); combined with a hybrid signature too, a TLS ClientHello or ServerHello can exceed a single network packet's typical size and trigger fragmentation issues on middleboxes that mishandle unusually large TLS handshake records, a real, documented rollout pain point.
- Downgrade risk. If negotiation is not done carefully, an active attacker could try to strip the post-quantum component and force a classical-only connection. TLS 1.3's transcript binding already protects against this when the hybrid group is negotiated through the standard mechanism; do not build a separate, unprotected negotiation path.
- Assuming "hybrid" automatically doubles security. A coding bug, such as reusing the same randomness source for both key-generation operations, can quietly defeat the whole point.
Worked example. FIPS 204's ML-DSA-65 signature is roughly 3,309 bytes; a classical ECDSA P-256 signature is roughly 70 bytes (DER-encoded). Combining them for a hybrid signature:
3,309 + 70 = 3,379 bytes combined signature
3,379 / 70 = ~48.3x the size of the classical signature alone
That is not a rounding error, it is nearly a fiftyfold increase, which is exactly why hybrid signatures (as opposed to hybrid key exchange, which adds a comparatively modest amount of overhead) are the harder piece to fit into size-constrained protocols like DNSSEC or small IoT payloads.
Trade-offs and pitfalls, restated. The single most important framing for planning purposes: symmetric algorithms (AES, HMAC) do not need to change for post-quantum readiness, only key exchange and signatures do, since Shor's algorithm targets the number-theoretic structure those two rely on, not symmetric primitives.
Describe the purpose of a salt in password-based key derivation: what properties it needs (uniqueness, length, randomness), where it should be stored relative to the derived hash, and the operational risks of reusing or omitting it at scale. Then explain the difference between a salt and a pepper: how does adding a server-side secret pepper change the threat model for offline attacks, and what controls does protecting a pepper actually require?
Sample Answer
Direct answer
A salt is a unique, random, non-secret value stored alongside each password hash so identical passwords never produce identical stored hashes and precomputed lookup tables (rainbow tables) become useless. A pepper is a separate, secret value, shared across all users and stored outside the database, that adds a layer an attacker who only stole the database, and not the pepper's separate storage, cannot reproduce at all.
Salt properties
- Uniqueness: every stored hash gets its own salt, so no two hashes can ever be compared or looked up in a shared precomputed table, even if two users chose the same password.
- Length and randomness: generated fresh with a cryptographically secure random number generator, long enough (16 bytes is a common minimum) that collisions across an entire user base are effectively impossible.
- Storage: the salt is not secret and is stored right alongside the derived hash, often concatenated into the same stored string as most KDF libraries' output format does, because verification needs it: a login attempt cannot be checked without knowing which salt was used.
Operational risks of reusing or omitting a salt at scale
Reusing one salt across many users collapses back to the pre-salt world for that group: identical passwords produce identical hashes again, so one cracked hash cracks every account sharing that password. Omitting a salt entirely makes precomputed rainbow-table attacks viable against an entire user base at once, and is the single most common real-world password-storage mistake salting exists to prevent.
Salt vs pepper
A pepper adds an ingredient a salt deliberately lacks: it is the same value for every user, unlike a salt, and it is never stored in the same place as the password hashes, typically in application configuration, a secrets manager, or a hardware security module (HSM), specifically so that a database breach alone, a SQL injection or a stolen backup, does not hand an attacker everything needed to attempt offline cracking.
How a pepper changes the threat model
Without a pepper, stealing the password-hash database is sufficient to start an offline brute-force or dictionary attack immediately. With a pepper, the attacker also needs to compromise wherever the pepper is stored, a genuinely separate system with its own access controls, before offline attacks become possible at all; a database-only breach becomes far less immediately damaging.
Controls a pepper actually requires
A pepper only helps if it is genuinely harder to steal than the database: its own access control (ideally an HSM/KMS-backed secret, not an environment variable sitting next to application code that also has database access), its own rotation plan (rotating a pepper means re-verifying and re-deriving every stored hash, a real migration, not a config change), and monitoring, since a pepper stored in the same place, or reachable via the same compromise path, as the database it protects provides no real additional security at all.
Explain how HSM attestation works in practice: the available primitives (attestation certificates, quotes, TPM PCRs), how you'd remotely validate an HSM's firmware and configuration, and how you'd incorporate attestation results into an automated key-provisioning pipeline so keys are only released to hosts that pass attestation.
Sample Answer
Direct answer
Hardware Security Module (HSM) attestation works by having the hardware sign a "quote", a statement
of its current measured state, using a key that only genuine, unmodified hardware from that vendor
could hold. A relying party checks two things before releasing a key: that the hardware is genuine
(via a manufacturer-issued attestation certificate chain) and that it is running the expected
firmware and configuration (via the measurement values inside the quote), and only releases key
material once both checks pass.
Structured elaboration
- Attestation certificate. Issued by the hardware manufacturer at production time, forming a chain
from the manufacturer's root down to a certificate embedded in the specific device. This proves
genuine, non-cloned hardware, similar in spirit to how a Trusted Platform Module (TPM) carries a
manufacturer-issued Endorsement Key certificate. - Quote. A signed structure containing current measurements (such as a firmware hash or boot
state) plus a nonce the verifier supplied fresh for this check, signed by an attestation key that is
itself certified by the manufacturer chain above. The nonce exists specifically to stop an old,
previously valid quote from being replayed to fool the verifier about the device's current state. - TPM Platform Configuration Registers (PCRs). A small set of registers that accumulate
measurements of boot components in order, using a one-way "extend" operation. A TPM quote reports
current PCR values, and the verifier compares them against a known-good baseline for the expected
firmware, bootloader, and operating system state. - Remote validation process, end to end. The verifier sends a fresh nonce; the device produces a
quote covering its current measurements plus that nonce; the verifier checks that the attestation
certificate chains to a trusted manufacturer root, that the quote's signature is valid, that the
nonce matches (proving freshness), and that the reported measurements match an approved set of
known-good hashes. - Incorporating attestation into an automated key-provisioning pipeline. Gate key release behind a
passing attestation check as a hard precondition: a provisioning service calls the
attestation-verification step before returning a key or an unwrap result to a requesting host. The
strongest version of this does not merely refuse on failure by policy, it seals the key specifically
to the expected measured state, so an altered host is cryptographically unable to unseal it at all,
not just refused by a check that a bug could bypass. Because legitimate firmware updates change
measurement values, the pipeline needs a signed, versioned baseline of known-good measurements that
updates in lockstep with approved firmware rollouts, otherwise attestation starts failing for
healthy, freshly patched hosts.
Worked example
A host boots, and its TPM extends PCRs 0 through 7 with measurements of firmware, bootloader, and
operating system components in order. The provisioning service sends a random nonce. The TPM produces
a quote over PCRs 0 through 7 plus that nonce, signed by its Attestation Identity Key. The service
verifies the Attestation Identity Key's certificate chains to the vendor's root, checks the signature
and the nonce, and compares PCRs 0 through 7 against today's approved baseline. Only on a full match
does the service release a wrapped disk-encryption key for that host to unseal locally. If an attacker
modifies the bootloader, the register that measures the bootloader (commonly PCR 4) changes value, the
quote no longer matches the baseline, and the key is withheld: this is a concrete cryptographic
mechanism, not merely a policy decision that could be talked around.
Extending to heterogeneous hardware roots of trust (rarely asked, and only relevant once a fleet is genuinely mixed).
The same pattern generalizes beyond TPMs. Intel Software Guard Extensions (SGX) enclaves produce
their own remote-attestation quotes proving code identity and genuine enclave execution, and ARM
TrustZone's trusted execution environment has its own vendor-specific attestation mechanisms. A fleet
mixing TPM-based servers, SGX-based confidential-compute nodes, and TrustZone-based mobile or embedded
devices needs a verification layer that can speak all three attestation formats and normalize them
into one pass-or-fail, measured-state decision for the provisioning pipeline, since none of the three
are wire-compatible with each other. Most teams do not need this heterogeneous layer day one; it is
worth building only once a real mixed fleet exists.
Trade-offs & pitfalls
- A stale, unmaintained baseline of known-good measurements is the most common real-world failure: it
either blocks legitimately updated hosts (and operations teams then disable attestation entirely "as
a temporary fix" that becomes permanent) or nobody updates it and it silently keeps accepting old,
unpatched firmware. Tie baseline updates directly into the firmware release pipeline itself. - Attestation proves state at boot time, not at runtime; code can still be exploited after a clean
boot, so attestation should be one layer alongside runtime protections, not treated as a complete
security boundary on its own. - Skipping nonce freshness under implementation time pressure is an easy mistake with a real
consequence: without it, a captured quote from a healthy host can be replayed long after that host's
actual state changed.
Write clear pseudocode showing how to implement a hybrid key exchange in the TLS handshake that combines an X25519 ECDH exchange with a post-quantum KEM (for example Kyber). Show both the client and server side, how you encapsulate/decapsulate, and how you derive the final symmetric key with HKDF. Beyond the handshake itself, how should key derivation and key management more broadly evolve for a hybrid classical-plus-PQ world: KDF and key-wrapping choices, parameter selection, and what changes for an existing KMS/protocol that needs to keep forward secrecy and resist a quantum-capable adversary?
Sample Answer
Part 1: Hybrid key exchange in the TLS handshake
The mechanism combines an X25519 Diffie-Hellman exchange with a post-quantum key encapsulation mechanism (KEM), here ML-KEM (the finalized NIST standard the "Kyber" submission became). The client generates both an ephemeral X25519 keypair and an ML-KEM keypair, and sends both public parts in its ClientHello. The server, on receiving them, completes its own X25519 exchange and additionally encapsulates against the client's ML-KEM public key, which produces a ciphertext and a shared secret without ever needing the client's private key. The server sends its X25519 public value plus the KEM ciphertext back. The client then decapsulates that ciphertext with its own ML-KEM private key to recover the same shared secret the server derived. Both sides now hold an ECDH shared secret and a KEM shared secret independently; each side concatenates them into a single combined secret and feeds that into the existing TLS 1.3 key schedule's HKDF step. RFC 9954 specifies this concatenate-then-KDF construction, but the concatenation order is not universally ECDH-first: it is fixed per hybrid group by that group's own definition. For X25519MLKEM768, the most widely deployed hybrid group today, the ML-KEM shared secret is placed first, followed by the X25519 secret, whereas SecP256r1MLKEM768 places the ECDHE secret first. Both peers must use the exact group-specified order or they derive different key material.
Client: Server:
(x_pk, x_sk) = X25519.keygen() (received x_pk, kem_pk)
(kem_pk, kem_sk) = MLKEM.keygen()
send(x_pk, kem_pk) ------------------>
y_sk, y_pk = X25519.keygen()
ecdh_ss = X25519.dh(y_sk, x_pk)
kem_ct, kem_ss = MLKEM.encaps(kem_pk)
<----------------------------------- send(y_pk, kem_ct)
ecdh_ss = X25519.dh(x_sk, y_pk)
kem_ss = MLKEM.decaps(kem_sk, kem_ct)
Both sides:
shared_secret = kem_ss || ecdh_ss # X25519MLKEM768 order: ML-KEM secret first, then X25519 (order is group-defined)
handshake_key = HKDF(shared_secret, ...) # feeds the normal TLS 1.3 key schedule
(This is illustrative pseudocode following the real IETF-specified hybrid design, not a runnable library call; a production implementation would use whatever your TLS library or PQC library exposes for keygen/encaps/decaps.)
Part 2: how key derivation and key management evolve for a hybrid classical-plus-PQ world
This handshake mechanism is one instance of a broader shift, and it is worth being explicit about what changes and what does not.
- The KDF layer itself barely changes. HKDF (RFC 5869), built on HMAC (a keyed hash used as a message authentication code), remains the standard combiner and expander. Its security depends on the underlying hash function (SHA-256, SHA-3), not on the number-theoretic hardness assumptions that Shor's algorithm threatens. Grover's algorithm gives only a quadratic speedup against a hash function, so a well-chosen output length (SHA-384 or a SHA-3 variant) keeps a large margin without needing a redesigned construction. What changes is the input: the shared secret now includes a KEM-derived component alongside, or instead of, a pure Diffie-Hellman one, and downstream key material may need to be longer.
- Key-wrapping constructions do not need to change either. AES-KW or an AEAD-based wrap (standard symmetric ways to encrypt one key under another) were never built on number theory, so they are unaffected by the classical-to-PQ transition. What changes is what feeds the master key being wrapped: previously an RSA- or ECC-wrapped root key, now potentially a hybrid-KEM-derived one. This is the single most important framing point for the migration: symmetric primitives do not need to change for PQC, only the asymmetric layer does.
- Parameter selection follows the same logic as choosing an AES key size. Pick the ML-KEM parameter set (512, 768, or 1024) matching your target security category the way you would pick AES-128 versus AES-256; ML-KEM-768, paired with X25519 as X25519MLKEM768, is the combination most widely deployed today by major browsers and CDNs.
- What an existing KMS or protocol needs to change. First, it needs an algorithm identifier for the new scheme carried end to end with the protected data, the same idea as a versioned algorithm tag rather than a global environment switch, so old and new material can coexist safely during rollout. Second, and more subtly: forward secrecy (the property that stealing a long-term key later must not let an attacker decrypt past recorded sessions) in a hybrid world still requires generating a fresh KEM keypair on every session, exactly as a static Diffie-Hellman key would forfeit forward secrecy classically; a long-lived, reused ML-KEM keypair gives up the post-quantum component's forward secrecy even though the mechanism looks superficially "post-quantum." Third, resisting a quantum-capable adversary means completing two genuinely separate migrations: the ephemeral exchange keys need this hybrid KEM, and the long-term identity and signing keys need a hybrid signature migration; doing only one leaves a real, exploitable gap in the other.
Trade-offs and pitfalls. The concatenate-then-KDF combiner looks almost too simple, which is exactly why it must come from a vetted specification (RFC 9954, together with the registration that defines each hybrid group's exact concatenation order) rather than an ad hoc implementation: subtle ordering or domain-separation (making sure two different uses of the same key or hash can never produce colliding inputs, so mixing them up cannot weaken the result) mistakes in a home-grown combiner can silently weaken the result below either individual component. The other recurring mistake is treating the KEM keypair as a long-term identity key purely because generating it is more expensive than an ECDH keypair; doing so quietly reintroduces the exact forward-secrecy weakness this whole exercise was meant to close.
Compare symmetric and asymmetric key-management lifecycles in an enterprise. For each class, describe typical key sizes, storage requirements, rotation/retirement frequency, common uses (DEK, KEK, signing, key exchange), and how distribution and backup differ operationally and from a threat-model perspective.
Sample Answer
Direct answer
Symmetric and asymmetric keys diverge most sharply in how many places the "sensitive half" has to
exist: a symmetric key must be available, identically, to every party that needs to encrypt or
decrypt, which multiplies its exposure surface, while an asymmetric private key needs to exist in
exactly one place (or a tightly controlled few for high availability), with its public half designed
to be freely and widely distributed. That single difference cascades into everything else, storage,
rotation cadence, and how you back each one up.
Structured elaboration
| Dimension | Symmetric keys | Asymmetric keys |
|---|---|---|
| Typical size | 128 or 256-bit (AES-128/256) | Roughly 2048 to 4096-bit RSA, or 256-bit elliptic-curve keys for comparable strength |
| Storage requirement | Same secret must exist everywhere it is used, or be centrally brokered as a Data Encryption Key wrapped by a Key Encryption Key | Private half in exactly one place (or a small controlled set); public half distributed freely and openly |
| Rotation and retirement | Data Encryption Keys often rotated frequently, per object or session; Key Encryption Keys rotated on a much slower, deliberate cadence; retirement is crypto-erasure | Signing keys often rotated slowly (yearly, tied to certificate lifetimes) since rotation requires re-establishing trust with every relying party; retirement means revoking the certificate and destroying the private key |
| Common uses | Data Encryption Key (bulk data), Key Encryption Key (wraps other keys) | Digital signatures (non-repudiation, authenticity), key-exchange key pairs (often ephemeral, used once per session) |
| Distribution requirement | Needs a secure, confidentiality-preserving channel to get the SAME secret to every party | Needs only INTEGRITY protection for the public half, tampering must be detectable, secrecy is unnecessary, which is exactly the problem a Public Key Infrastructure solves |
| Backup stakes | A backup copy is functionally identical to the live key; anyone with the backup can decrypt, so it needs the same protection as the primary | Losing a private key entirely (not leaking it) means permanent loss of decrypt or sign capability for anything protected under it, pulling backup strategy toward availability, sometimes via secret-sharing across custodians, in tension with confidentiality |
Worked example
A commonly cited equivalence, from National Institute of Standards and Technology (NIST) guidance on
comparable cryptographic strength, is that a 128-bit symmetric key is roughly as hard to break as a
3072-bit RSA key or a 256-bit elliptic-curve key. This is worth internalizing precisely because it
explains why elliptic-curve keys look so much smaller in bit count than RSA keys for the same real
security level, comparing raw bit counts across the two families directly is meaningless; you have to
compare within the equivalence classes established for each algorithm family.
Trade-offs & pitfalls
- A common mistake is rotating a Key Encryption Key on the same aggressive cadence as the Data
Encryption Keys it wraps. Rotate Data Encryption Keys frequently and cheaply, since each protects a
smaller amount of data, and rotate the Key Encryption Key on a much slower, deliberate cadence, since
re-wrapping many Data Encryption Keys under a new Key Encryption Key, while cheap per key, is still
not something you want to run constantly. - Assuming asymmetric is "always more secure" because its keys have a larger raw bit count is a
category error; security has to be compared using the equivalence classes above, not raw numbers
across different algorithm families. - Treating public-key distribution as needing no protection at all is a real trap: it needs INTEGRITY
protection, not secrecy. Trusting a public key fetched over plain, unauthenticated HTTP opens the
door to a substitution or interception attack even though nothing was technically "leaked."
Unlock Full Question Bank
Get access to all Applied Cryptography and Key Management interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.