Advanced Cryptography
Most production systems still rely on two families of primitives â elliptic-curve key exchange and digital signatures â whose long-term security is now an open question, while a second wave of primitives promises properties that classical cryptography cannot offer at all: proving a statement without revealing it, computing over ciphertext, and combining secrets held by different parties without ever assembling them in one place. This lesson separates the cryptography that is becoming mandatory from the cryptography that remains specialized, and shows where each one changes an actual architecture rather than a research roadmap.
The problem that forces the migration
The urgency around post-quantum cryptography does not come from today's computers. It comes from harvest now, decrypt later: an adversary who records your TLS traffic, VPN tunnels and archived backups today can store them and wait for a cryptographically relevant quantum computer. For data whose confidentiality must hold for a decade â medical records, state communications, trade secrets, anything under long contractual obligations â the relevant threat model already includes an attacker with unlimited patience.
Symmetric ciphers are less exposed. Grover's algorithm halves the effective key length, which is why moving from AES-128 to AES-256 is treated as adequate insurance. Public-key cryptography is the exposed part: Shor's algorithm breaks RSA, finite-field Diffie-Hellman and elliptic-curve Diffie-Hellman outright, which removes both key agreement and signatures at once.
| Primitive family | Quantum threat | Practical response | Status |
|---|---|---|---|
| RSA, DSA, ECDSA signatures | Broken by Shor | Replace with a PQC signature | Migration required |
| ECDH, X25519 key agreement | Broken by Shor | Replace with a KEM such as ML-KEM | Migration required |
| AES-GCM | Weakened by Grover | Move to AES-256 or keep 128 with justification | Low urgency |
| SHA-2, SHA-3 | Halved output strength | No change needed at current lengths | Low urgency |
| Password hashing | Argon2, bcrypt unaffected by Shor | Keep as is | None |
What the standards actually say
NIST's first post-quantum standards, published in 2024, cover three algorithms, and knowing which is which prevents most of the confusion in vendor conversations. ML-KEM, derived from CRYSTALS-Kyber, handles key encapsulation: it produces a shared secret from a public key. ML-DSA, derived from CRYSTALS-Dilithium, is the primary signature scheme. SLH-DSA, derived from SPHINCS+, is the hash-based backup whose security rests on fewer assumptions at the cost of larger signatures and slower operations.
| Algorithm | Type | Derived from | Key sizes | Trade-off |
|---|---|---|---|---|
| ML-KEM 768 | Key encapsulation | CRYSTALS-Kyber | Small | Fast, widely deployed first |
| ML-DSA 65 | Signature | CRYSTALS-Dilithium | Moderate | Default choice for most systems |
| SLH-DSA 128s | Signature | SPHINCS+ | Large | Hash-only assumptions, slower |
| Classic McEliece | Key encapsulation | Coding theory | Very large public key | Conservative, rarely used in TLS |
Signatures dominate migration cost because they appear in certificates, code signing, firmware, document signing and long-lived credential chains. Key exchange is often a configuration change by comparison.
Migrating: hybrid mode and crypto agility
The deployment pattern that matters is hybrid mode: negotiate a classical shared secret and a post-quantum one, then combine them so that an attacker must break both. Hybrid mode protects against the possibility that a new algorithm contains a subtle flaw discovered after deployment, which is exactly how real cryptographic history has unfolded.
# crypto-agility configuration â the goal is swapping primitives without a rewrite
key_exchange:
classical: x25519
post_quantum: ml_kem_768
combination: hkdf_sha256(classical || pq) # both must be broken to recover the secret
preference: hybrid_first
signatures:
active: [ml_dsa_65, ecdsa_p256] # send both during the transition
acceptable: [ml_dsa_65] # target state for 2028
rotation_days: 90
rotation:
key_rotation_trigger: ["calendar", "compromise_suspicion", "algorithm_deprecation"]
inventory_source: "service_mesh_cert_registry"
inventory_max_age_days: 7
crypto_agility_requirements:
- "primitives referenced by name, never hard-coded in business logic"
- "algorithm identifiers stored with keys in the KMS metadata"
- "rollback tested quarterly against a staging endpoint"
Crypto agility is the property that makes the next migration cheaper than this one. If your services hard-code curve names in code paths, every change is a release; if primitives are referenced through configuration and key metadata, most of the migration becomes a rollout. The inventory matters just as much: teams routinely discover forgotten signing systems â firmware updaters, code-signing agents, internal certificate authorities â only during the migration itself.
Zero-knowledge proofs: proving without revealing
Zero-knowledge proofs let one party convince another that a statement is true without conveying anything beyond that truth. In practice they appear in three settings: proving that a credential was issued by a trusted party without revealing which one, proving membership in a set without disclosing identity, and proving that a computation was performed correctly without revealing its inputs â the basis of verifiable computation and private blockchains.
The mechanics are easiest to grasp through a Schnorr-style identification proof, where knowledge of a secret exponent is proven by committing to a randomized value and answering a challenge derived from that commitment.
"""A toy Schnorr identification proof: prove knowledge of x without revealing x."""
import hashlib
import random
P = 2 ** 127 - 1 # a small safe prime, for illustration only
G = 5 # generator
Q = (P - 1) // 2 # subgroup order
def challenge(commitment: int, nonce: int) -> int:
"""Fiat-Shamir: derive the challenge from the transcript, not from a live verifier."""
digest = hashlib.sha256(f"{commitment}|{nonce}".encode()).hexdigest()
return int(digest, 16) % Q
def prove(secret: int):
nonce = random.randrange(1, Q)
commitment = pow(G, nonce, P) # t = g^r
y = pow(G, secret, P) # public key y = g^x
c = challenge(commitment, nonce) # transcript-derived challenge
response = (nonce + c * secret) % Q # s = r + c*x
return {"commitment": commitment, "challenge": c, "response": response, "y": y}
def verify(proof) -> bool:
g_s = pow(G, proof["response"], P)
y_c = pow(proof["y"], proof["challenge"], P)
# Accept when g^s equals t * y^c
return g_s == (proof["commitment"] * y_c) % P
proof = prove(secret=random.randrange(1, Q))
print("verified:", verify(proof))
print("secret leaked:", "x" in str(proof))
Production systems use SNARKs and STARKs built from far more machinery, but the security argument is the same shape: a commitment, a challenge and a response that verify without exposing the witness. The engineering cost lives in circuit description, trusted setup for some SNARK variants, and proving time â parameters worth checking before committing to a design.
Computing on data you cannot see
Homomorphic encryption allows operations on ciphertext so that decrypting the result matches computing on the plaintext. Fully homomorphic schemes support arbitrary circuits but remain orders of magnitude slower than plaintext computation; leveled and partially homomorphic schemes support a bounded set of operations at usable cost. Secure multiparty computation takes a different route: secret-shared inputs are distributed across parties who jointly compute a result, never reconstructing the inputs themselves.
| Technique | What it enables | Cost profile | Realistic use today |
|---|---|---|---|
| Fully homomorphic encryption | Arbitrary computation on ciphertext | Very high, large keys | Voting, simple aggregations |
| Partially homomorphic schemes | Repeated addition or multiplication | Low | Averages, sums, threshold checks |
| Secure multiparty computation | Joint computation over shared secrets | Moderate, many rounds | Fraud scoring across banks, key ceremonies |
| Trusted execution environments | Isolated computation with attestation | Near-native | Enclave key handling, confidential containers |
The honest guidance: reach for these when the alternative is "we cannot compute at all because the data cannot be shared," and not when a well-designed access-controlled query would suffice. Privacy-preserving computation is insurance against an architectural impossibility, not a substitute for governance.
â ī¸Crypto-agility beats crypto-alarmism
The right response to uncertainty is not to swap algorithms this quarter in a panic, but to inventory every place a primitive appears, remove hard-coded curve names, and enable hybrid key exchange where the stack supports it. Teams that did that work in 2015 treat the post-quantum transition as a rollout; everyone else treats it as an incident.
Quantum key distribution and its limits
Quantum key distribution distributes symmetric keys using photon states, with eavesdropping detectable as error. It solves a narrow problem â key distribution with information-theoretic security â over dedicated fiber, and it does nothing for authentication, storage of the resulting keys, or the signature systems that actually break under Shor. For most organizations it is infrastructure-dependent and irrelevant compared with adopting ML-KEM in software, which is why national guidance treats PQC migration as the practical control and QKD as a specialized option for specific long-haul links.
Common Mistakes
Treating PQC as a symmetric-cipher problem
Fix: Prioritize key agreement and signatures; AES and SHA need far less attention.
Replacing primitives without an inventory
Fix: Discover signing and certificate systems first, including firmware and code signing.
Adopting a single new algorithm with no hybrid period
Fix: Combine classical and post-quantum exchanges so both must be broken.
Reaching for homomorphic encryption by default
Fix: Use it only where data genuinely cannot be shared under any governance model.
Confusing QKD with post-quantum readiness
Fix: QKD does not fix signatures; software migration to ML-KEM and ML-DSA does.
Best Practices
- Run hybrid key exchange wherever the protocol stack supports it.
- Reference primitives through configuration and KMS metadata, never in code.
- Test crypto-agility rollback quarterly, the way you test failover.
- Plan signature migration first; certificates and code signing are the long pole.
- Keep symmetric and hashing choices aligned with current key-length guidance.
Key Takeaways
- Harvest-now-decrypt-later makes the post-quantum migration urgent for long-lived secrets today.
- ML-KEM replaces key agreement, ML-DSA replaces signatures, SLH-DSA is the conservative fallback.
- Hybrid mode and a complete primitive inventory are the two controls that de-risk the transition.
- Zero-knowledge proofs, homomorphic encryption and MPC each solve a specific impossibility, at a specific cost.
- Crypto agility is the capability that makes the next cryptographic migration a rollout instead of an incident.