← Back to Articles
Applied Cryptography • Quantum Security

Post-Quantum Cryptography: ML-KEM & ML-DSA Migration for TLS and Infrastructure

Post-Quantum Cryptography: ML-KEM & ML-DSA Migration for TLS and Infrastructure
Lattice-Based Post-Quantum Cryptography: Module-LWE Key Encapsulation (ML-KEM)
Executive Summary & Key Security Takeaways
  • Harvest Now, Decrypt Later (HNDL): Adversaries are actively intercepting and storing encrypted traffic today to decrypt with future quantum computers (Shor Algorithm).
  • NIST FIPS Standardization: Understand FIPS 203 (ML-KEM / Crystals-Kyber) for key encapsulation and FIPS 204 (ML-DSA / Crystals-Dilithium) for digital signatures.
  • Lattice-Based Security (MLWE): Security rooted in the hardness of Module Learning with Errors (MLWE) over polynomial rings.
  • Hybrid TLS 1.3 Handshakes: Combine classical ECDH (X25519) with ML-KEM-768 (X25519MLKEM768) to protect against both classical implementation bugs and quantum attacks.

1. The Quantum Threat & Shor Algorithm Breakdown

Modern public-key cryptography—including RSA, Diffie-Hellman, and Elliptic Curve Cryptography (ECDSA / Ed25519)—relies on the computational difficulty of prime factorization and discrete logarithm problems. On sufficiently scaled fault-tolerant quantum computers, Shor Algorithm solves discrete logarithms in polynomial time ((\log N)^3)$, rendering all existing classical public-key algorithms insecure.

The immediate operational threat is Harvest Now, Decrypt Later (HNDL): state-sponsored adversaries and surveillance programs capture TLS traffic, VPN tunnels, and encrypted backups today, storing them until cryptanalytically relevant quantum computers (CRQCs) become operational.

// Mathematical Comparison: Classical vs Quantum Attack Complexity
// -------------------------------------------------------------------
// Algorithm    Hard Problem            Classical Security   Quantum (Shor)
// -------------------------------------------------------------------
// RSA-2048     Prime Factorization     112 bits             O(log N)^3 [BROKEN]
// ECDSA-256    Discrete Logarithm      128 bits             O(log N)^3 [BROKEN]
// ML-KEM-768   Module-LWE (Lattices)   192 bits (Cat 3)     > 128 bits [SECURE]
// ML-DSA-652   Module-LWE (Lattices)   192 bits (Cat 3)     > 128 bits [SECURE]

2. ML-KEM (FIPS 203) Key Encapsulation & Lattice Mathematics

Standardized by NIST as FIPS 203, ML-KEM (derived from Crystals-Kyber) is an IND-CCA2 secure Key Encapsulation Mechanism. Its cryptographic security is founded on the Module Learning with Errors (MLWE) problem over polynomial quotient rings = \mathbb{Z}_q[X]/(X^{256} + 1)$.

In ML-KEM, public keys are represented as polynomial matrices $\mathbf{A} \in R_q^{k imes k}$ multiplied by secret noise vectors $\mathbf{s}$, yielding $\mathbf{t} = \mathbf{A}\mathbf{s} + \mathbf{e} \pmod q$. Finding secret vector $\mathbf{s}$ from public parameters $ requires finding shortest vectors in high-dimensional lattices (SVP/CVP), which quantum algorithms cannot solve in polynomial time.

// Rust: ML-KEM-768 Key Encapsulation Pipeline (liboqs / rust-pqcrypto)
use pqcrypto_kyber::kyber768::*;

fn perform_quantum_resistant_key_exchange() {
    // Alice generates ML-KEM keypair
    let (public_key, secret_key) = keypair();
    println!("[PQC] Generated ML-KEM-768 Public Key ({} bytes)", public_key.as_bytes().len());
    
    // Bob encapsulates shared secret using Alice public key
    let (shared_secret_bob, ciphertext) = encapsulate(&public_key);
    
    // Alice decapsulates shared secret using her secret key
    let shared_secret_alice = decapsulate(&ciphertext, &secret_key);
    
    assert_eq!(shared_secret_bob.as_bytes(), shared_secret_alice.as_bytes());
    println!("[PQC] Quantum-safe shared secret established successfully!");
}

3. Hybrid TLS 1.3 Deployment: X25519MLKEM768 Handshake

Because pure post-quantum algorithms are relatively new, security best practices mandate Hybrid Key Exchange (such as X25519MLKEM768). In a hybrid TLS 1.3 handshake, client and server generate both an ECDH (X25519) key share and an ML-KEM-768 key share.

The resulting shared secrets are combined via HKDF-Extract to derive final session keys. If ML-KEM is later discovered to have unexpected mathematical flaws, classical X25519 still protects the traffic; if quantum computers break X25519, ML-KEM protects the traffic.

# Nginx / OpenSSL 3.4+ Configuration for Hybrid Post-Quantum TLS 1.3
ssl_protocols TLSv1.3;
ssl_ecdh_curve X25519MLKEM768:X25519:secp384r1;
ssl_ciphers TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256;
ssl_prefer_server_ciphers on;

4. ML-DSA (FIPS 204) Digital Signatures & Infrastructure Hardening

FIPS 204 standardizes ML-DSA (derived from Crystals-Dilithium) for quantum-resistant digital signatures. Unlike RSA or ECDSA where public keys are 32-256 bytes, ML-DSA-65 (NIST Level 3) has public keys of 1,952 bytes and signature sizes of 3,293 bytes.

Migrating enterprise Public Key Infrastructure (PKI), TLS certificates, and SSH authentication requires updating buffer sizes, MTU configurations, and network stack policies to handle larger signature payloads without packet fragmentation.

# OpenSSH 9.8+ Post-Quantum Key Exchange Configuration (/etc/ssh/sshd_config)
KexAlgorithms [email protected],mlkem768x25519-sha256
HostKey /etc/ssh/ssh_host_ed25519_key

Frequently Asked Questions (FAQ)

Why should companies deploy Post-Quantum Cryptography now if quantum computers do not exist yet?

Under the Harvest Now, Decrypt Later attack vector, adversaries are recording encrypted enterprise traffic today. If encrypted data retains confidentiality value 5-10 years into the future, it must be encrypted with post-quantum key exchange immediately.

What is the performance overhead of ML-KEM compared to classical ECDH?

ML-KEM is computationally faster in CPU clock cycles than elliptic curve ECDH (X25519). The primary overhead is network bandwidth: ML-KEM-768 public keys (1,184 bytes) and ciphertexts (1,088 bytes) are larger than 32-byte X25519 keys.

Does AES-256 require replacement in a post-quantum world?

No. Symmetric ciphers are only vulnerable to Grover Algorithm, which reduces brute-force search complexity from N to sqrt(N). AES-256 retains 128 bits of quantum security, which remains practically unbreakable.

Zyekh Abdul Qadir Jailani

Written by Zyekh Abdul Qadir Jailani

Digital Forensics & Incident Response (DFIR) Specialist & Security Researcher specializing in Linux kernel hardening, threat hunting, and system security research.

Utility Security Tools Related to this Article:

Gunakan Hash Generator dan HMAC Generator untuk membantu alur kerja konfigurasi keamanan Anda secara privasi di browser.