⚛️ Chapter 8 — Post-Quantum Cryptography (PQC) Cheat Sheet
🗺️ Big Picture
Classical Crypto Quantum Threat PQC Solution
──────────────────────────────────────────────────────────────────
RSA (factoring) ──► Shor's Algorithm ──► Kyber (MLWE)
ECDSA (DL problem) ──► Shor's Algorithm ──► Dilithium (MLWE)
AES (brute force) ──► Grover's Algorithm ──► AES-256 (double key)
Access Control ──► All pubkey broken ──► Lattice CP-ABE
1. Classical Cryptography — Foundation
Two Types of Classical Crypto
| Type | Key Setup | Examples | Hard Problem |
|---|---|---|---|
| Symmetric-Key | Alice & Bob share a secret key beforehand | AES, ChaCha20 | Brute force search |
| Public-Key | Alice can send securely without ever meeting Bob | RSA, ECC, DH | Factoring, Discrete Log |
🔢 Analogy: Factoring is like being given a 300-digit number and asked "which two primes multiply to give this?" — classical computers would take longer than the age of the universe.
2. The Quantum Threat
Classical Bit vs. Qubit
| Classical Bit | Qubit | |
|---|---|---|
| State | 0 OR 1 | 0 AND 1 simultaneously (superposition) |
| Math | — |
🪙 Analogy: A classical coin is either Heads or Tails. A quantum coin while spinning is both at once — it only picks a side the moment you look at it (measurement collapses superposition).
Quantum Computer Progress
| Year | Qubits |
|---|---|
| 1998 | 2 |
| 2006 | 12 |
| 2019 | 53 — Google First Quantum Supremacy |
| 2023 | 433 |
| 2025 | 1,000+ |
| 2030? | 1,000,000? |
Challenges: fragile quantum states, measurement collapses state, needs extreme isolation — still a long way to full fault-tolerant quantum computation.
Two Algorithms That Break Crypto
Shor's Algorithm (1994)
- Solves integer factorization AND discrete logarithm in polynomial time
- Breaks: RSA, ECDSA, DSA, Diffie-Hellman — exponentially faster than classical
- Result: Entire PKI ecosystem invalid. TLS/VPN compromised.
🔐 Analogy: A combination lock with a billion combinations. Classically, you try one-by-one. Shor's tries all combinations simultaneously and instantly identifies the right one.
Grover's Algorithm
- Gives a quadratic speedup in unstructured search
- Classical: → Quantum:
- Weakens symmetric crypto — does NOT break it outright
- Fix: just use longer keys
| Algorithm | Classical Security | Quantum Security (after Grover) |
|---|---|---|
| AES-128 | 128-bit | ~64-bit ❌ |
| AES-256 | 256-bit | ~128-bit ✅ |
🏫 Lecturer note: AES is still secure — just use AES-256!
Impact Summary
| Algorithm | Vulnerable to | Status |
|---|---|---|
| RSA-2048 | Shor's | ❌ Broken |
| ECDSA / ECC | Shor's | ❌ Broken |
| DSA / Finite Field DH | Shor's | ❌ Broken |
| AES-128 | Grover's | ⚠️ Weakened — upgrade to AES-256 |
| AES-256 | Grover's | ✅ Safe (~128-bit quantum security) |
| SHA-2 / SHA-3 | Grover's | ✅ Safe with longer output |
⚠️ The "Harvest Now, Decrypt Later" Attack
Today: Attacker records encrypted traffic ────► stores ciphertext
Future: Quantum computer exists ────────────────► decrypts stored data!
- State secrets, medical records, financial data encrypted today could be decrypted in the future
- NIST (USA) regulates and standardizes the response
- Even if attacker has ciphertext now → technology not yet capable → but they're waiting
Mosca's Theorem — When Must We Act?
Let:
- = how long the data needs to stay secure
- = how long it takes to migrate to quantum-safe solutions
- = how long until a large-scale quantum computer exists
🏠 Analogy: Your house needs to stand 20 more years (). Rebuilding takes 5 years (). Earthquake coming in 15 years (). Since — you're already too late to start.
3. Post-Quantum Cryptography (PQC)
- Runs on normal (classical) computers — no quantum hardware needed
- Can be deployed as a software upgrade
- Secure against both classical and quantum adversaries
Why PQC Takes Time to Deploy
| Challenge | Why |
|---|---|
| Efficiency | New algorithms must be fast enough for real-world use |
| Confidence | Needs years of cryptanalysis to build trust |
| Standardization | NIST competition running since 2016 |
| Interoperability | Must integrate with TLS, IKE, VPNs, existing infrastructure |
PQC Families
| Family | Hard Problem | Example | Status |
|---|---|---|---|
| Lattice-Based | LWE / RLWE | Kyber, Dilithium | ⭐ NIST Standardized |
| Code-Based | Syndrome Decoding | McEliece, HQC | HQC selected 2025 (4th round) |
| Hash-Based | Hash Trees | SPHINCS+ | ✅ NIST Standardized |
| Multivariate | MQ Problem | Rainbow | ❌ Broken |
| Isogeny-Based | Elliptic Curve Isogeny | SIKE | ❌ Broken |
NIST Standardization Results
| Round | Winners |
|---|---|
| 3rd Round | Kyber (KEM), Dilithium (sig), FALCON (sig), SPHINCS+ (sig) |
| 4th Round (2025) | HQC (Code-based KEM) |
4. Lattice-Based Cryptography — The Most Promising Family
What Is a Lattice?
🏠 Analogy: Think of floor tiles. The corners of all the tiles form a regular grid of points. That grid is a lattice.
Formally — all integer combinations of basis vectors:
\boxed{\Lambda = \left{ \sum_{i=1}^{n} a_i b_i ;\Big|; a_i \in \mathbb{Z} \right}}
Key properties:
- Only integer coefficients (no fractions!)
- Infinite number of lattice points
- Regular repeating structure
Simple 2D example: → Lattice =
- Is in the lattice? → , → ✅ Yes
- Is in the lattice? → → ❌ No (not integer)
In Kyber: dimension is or — exponentially harder than 2D!
🧊 High-dimension analogy: In 2D, you can visually see the nearest grid point. In 768 dimensions, there is no "looking" — every direction looks equally far away, and the number of nearby points grows exponentially.
Hard Lattice Problems
Shortest Vector Problem (SVP)
Find the shortest non-zero vector in the lattice.
- Easy in 2D/3D
- Exponentially hard in dimensions
- No efficient quantum algorithm known
Closest Vector Problem (CVP)
Given a target point off the grid, find the nearest lattice point.
- Easy in 2D (you can see it)
- Exponentially hard in : can't "see" structure, distances behave counter-intuitively, best known attacks are exponential-time
SVP vs CVP vs LWE Summary
| Problem | Given | Goal | Role in PQC |
|---|---|---|---|
| SVP | Lattice | Find shortest non-zero vector | Core worst-case hardness |
| CVP | Lattice + target | Find closest lattice point to | Direct decoding problem |
| LWE | Recover secret | Foundation of PQ crypto |
5. Learning With Errors (LWE)
Core Equation
| Symbol | Meaning |
|---|---|
| Public matrix (known to everyone) | |
| Secret vector (what we want to hide) | |
| Small noise (tiny random error) | |
| Public output | |
| Modulus |
Given: and → Goal: Recover — computationally hard!
📊 Analogy: 1000 equations like , but each has a tiny random rounding error added. Without knowing the errors, you cannot solve for — even with a quantum computer!
Why the Noise Makes It Hard
| Case | Equation | Solvable? |
|---|---|---|
| No noise () | Easy — Gaussian elimination | |
| With noise () | Exponentially hard — becomes CVP |
With noise → must find such that is small → Closest Vector Problem → exponential time.
Why LWE Is Quantum-Safe
LWE won the Gödel Prize 2018 — foundation for "nearly every kind of cryptographic object."
6. Module-LWE (MLWE)
Instead of integer vectors, work over polynomial rings:
- Ring:
- = matrix of polynomials; = vectors of polynomials
- Same equation: — but polynomials
Advantages over plain LWE:
- Uses NTT (Number Theoretic Transform) for fast polynomial multiplication
- Smaller key sizes than plain LWE
- Faster computation
- Preserves lattice hardness
"MLWE is just LWE, but smarter and faster."
NIST MLWE Algorithms
| Algorithm | Purpose |
|---|---|
| CRYSTALS-Kyber | Key Encapsulation Mechanism (KEM) |
| CRYSTALS-Dilithium | Digital Signature |
7. CRYSTALS-Kyber (Key Encapsulation Mechanism)
Based on MLWE. Used in TLS/SSL, VPN, secure messaging.
🔒 KEM Analogy: Bob puts a padlock on an empty box and sends it to Alice (public key). Alice puts a secret note inside, snaps the lock, sends it back (encapsulation). Only Bob has the key to open it (decapsulation). Now both know the same secret.
⚠️ Unlike RSA: In Kyber, the Receiver (Bob) generates the key, not the sender.
Kyber Step 1: KeyGen — Bob (Receiver)
| Step | Operation |
|---|---|
| 1 | Generate public matrix |
| 2 | Sample small secret: small in |
| 3 | Sample small error: small in |
| 4 | Compute: |
Bob sends to Alice.
Kyber Step 2: Encaps — Alice (Sender)
| Step | Operation |
|---|---|
| 1 | Choose random seed |
| 2 | Derive: (shared secret) |
| 3 | Sample small: |
| 4 | Compute: |
| 5 | Compute: |
Alice sends ciphertext to Bob — NOT .
Kyber Step 3: Decaps — Bob (Receiver)
| Step | Operation |
|---|---|
| 1 | Compute: |
| 2 | Derive: |
Why does decryption work?
The lattice components cancel (since ), leaving — small noise rounds away cleanly.
Full Kyber KEM Protocol
Bob (KeyGen) Alice (Encapsulate) Bob (Decapsulate)
─────────────────────────────────────────────────────────────────────────────
(pk, sk) ──pk──► m ← random m' = Dec(sk, c)
(K', r) = G(m ∥ H(pk)) (K'', r') = G(m' ∥ H(pk))
c = Enc(pk, m; r) if Enc(pk, m'; r') = c:
K = KDF(K' ∥ H(c)) ◄──c── K = KDF(K'' ∥ H(c))
else:
K = KDF(z ∥ H(c))
Kyber Hash Chain
Kyber's Role
- ❌ Does NOT encrypt data directly
- ✅ Establishes a shared symmetric key
- Then: — symmetric encryption takes over
This is why AES is still relevant post-quantum — Kyber securely negotiates the AES key!
⭐ Exam: Why Is Kyber Still Safe If Attacker Has the Public Key?
Because the attacker does not have . The secret key is never shared. Breaking to recover is the MLWE problem — exponentially hard even for quantum computers.
8. CRYSTALS-Dilithium (Digital Signature)
Replaces RSA and ECDSA. Based on MLWE. Operations over .
✍️ Analogy: A digital signature is a mathematical handwritten signature — anyone can verify it was you, but no one can forge it. Dilithium makes this quantum-resistant.
Dilithium KeyGen
| Step | Operation |
|---|---|
| 1 | Generate matrix: |
| 2 | Sample small: |
| 3 | Compute: |
| 4 | Split into high bits + low bits (reduces signature size) |
Dilithium Sign(sk, m)
| Step | Operation |
|---|---|
| 1 | Hash message: |
| 2 | Sample random vector |
| 3 | Compute temporary: |
| 4 | Compute challenge (binds sig to message): |
| 5 | Compute signature vector: |
Dilithium Verify(pk, m, σ)
| Step | Operation |
|---|---|
| 1 | Parse signature: extract |
| 2 | Recompute hash: |
| 3 | Recompute temp: |
| 4 | Recompute challenge: |
9. Manual Kyber Exercise (Small Example)
Given: , , , , , , ,
Step 1: Public Key
Step 2: Ciphertext
Step 3: Decrypt → result should be close to (since )
Step 4: Recover → if result → ; if →
Step 5: Shared Key — relationship: is the hash of
10. Lattice CP-ABE (Post-Quantum Access Control)
What Is Attribute-Based Encryption (ABE)?
🏥 Analogy: A hospital file encrypted so only someone who is both a Doctor AND from Hospital-A (or an Emergency worker) can decrypt it. The access rule is baked into the encryption itself — not enforced by a server.
Core idea: Data encrypted under an access policy. Users can only decrypt if their attributes satisfy the policy.
Result: Fine-grained access control embedded at the data level.
Four Entities
| Entity | Role |
|---|---|
| Attribute Authority (AA) | Root of trust — generates system params, issues attribute keys |
| Data Owner | Encrypts data with a specific access policy |
| User | Holds attribute keys, attempts to decrypt |
| Cloud Storage | Hosts the encrypted ciphertext |
Cryptographic Lifecycle
Setup → Key Generation → Encryption → Decryption
| Phase | What happens |
|---|---|
| Setup | Authority generates master keys + public parameters |
| Key Generation | User receives secret keys based on their attributes |
| Encryption | Data owner encrypts with embedded access policy |
| Decryption | User decrypts only if attributes satisfy policy |
Phase 1: Setup — Trapdoor Generation
— random matrix with trapdoor
- = public matrix (everyone knows it)
- = trapdoor (secret master key for Authority only)
🚪 Trapdoor = a mathematical backdoor. Without , impossible to invert . With , easy. One-way unless you know the secret.
Phase 2: Key Generation — Trapdoor Sampling
— sampled from a discrete Gaussian distribution
Output: Secret Key tied exclusively to the user's attributes.
Phase 3: Encryption — LSSS Policy
Policy encoded as Linear Secret Sharing Scheme (LSSS): where = sharing matrix, = attribute for row .
Example — policy (Doctor AND Hospital-A) OR Emergency:
| Row | Attribute |
|---|---|
| 1 | Doctor |
| 2 | Hospital-A |
| 3 | Emergency |
- = global secret vector
- Each = LSSS share for attribute hidden inside LWE ciphertext
- Noise ensures LWE hardness
"LSSS splits the encryption secret into linear shares associated with attributes; only attribute sets satisfying the policy can reconstruct the secret and decrypt."
Phase 4: Decryption
If user's attributes satisfy the policy → combine attribute keys:
To recover:
Noise gracefully cancels out during subtraction → reveals message .
ABE Advantages vs. Challenges
| Advantages ✅ | Challenges ⚠️ |
|---|---|
| Proven post-quantum security (MLWE) | Larger key sizes vs ECC |
| Fine-grained access at data level | Higher computational overhead |
| Native AND/OR/Threshold/Role policies | Ciphertext expansion (output >> payload) |
| Suitable for cloud and IoT data sharing | — |
⚡ Key Facts to Remember
| Fact | Detail |
|---|---|
| Shor's breaks | RSA, ECDSA, DSA, Diffie-Hellman — all public-key crypto |
| Grover's weakens | AES — fix with AES-256 |
| AES-256 quantum security | ~128-bit — still safe |
| "Harvest Now, Decrypt Later" | Attackers store ciphertext now, decrypt when QC exists |
| Mosca: worry if | |
| PQC runs on | Normal classical computers — software upgrade only |
| NIST winner (KEM) | Kyber (MLWE-based) |
| NIST winner (Sig) | Dilithium, FALCON, SPHINCS+ |
| NIST 4th round (2025) | HQC (code-based) |
| Broken PQC candidates | Rainbow (multivariate), SIKE (isogeny) |
| LWE security basis | Reduced to SVP/CVP hardness — exponential time |
| MLWE = | LWE over polynomial rings — faster, smaller keys |
| Kyber is for | Key Encapsulation — not direct data encryption |
| Kyber keygen: who does it? | Receiver (Bob) — unlike RSA where sender uses receiver's public key |
| Shared key usage | — Kyber negotiates key, AES encrypts data |
| Dilithium is for | Digital signatures — replaces RSA/ECDSA |
| Dilithium verify condition | Accept if |
| CP-ABE policy | Embedded in ciphertext; only satisfied attributes can decrypt |
| Trapdoor | Mathematical backdoor: easy one-way, impossible to invert without |
| Discrete Gaussian | Distribution used for sampling secret keys in lattice crypto |
| SVP | Shortest Vector Problem — find shortest arrow in lattice grid |
| CVP | Closest Vector Problem — find nearest grid point to off-grid target |
| No noise → easy | solvable by Gaussian elimination |
| With noise → hard | becomes CVP — exponentially hard |