8

Updated 4 Oct 2026

⚛️ 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

The hard problems of the quantum era: LWE, MLWE, SVP, CVP\boxed{\text{The hard problems of the quantum era: LWE, MLWE, SVP, CVP}}


1. Classical Cryptography — Foundation

Two Types of Classical Crypto

TypeKey SetupExamplesHard Problem
Symmetric-KeyAlice & Bob share a secret key beforehandAES, ChaCha20Brute force search
Public-KeyAlice can send securely without ever meeting BobRSA, ECC, DHFactoring, Discrete Log

RSA←Integer FactorizationECC / DH←Discrete Logarithm\boxed{\text{RSA} \leftarrow \text{Integer Factorization} \qquad \text{ECC / DH} \leftarrow \text{Discrete Logarithm}}

🔢 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 BitQubit
State0 OR 10 AND 1 simultaneously (superposition)
Math—∥ψ⟩=α∥0⟩+β∥1⟩\|\psi\rangle = \alpha\|0\rangle + \beta\|1\rangle

🪙 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

YearQubits
19982
200612
201953 — Google First Quantum Supremacy
2023433
20251,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: O(N)O(N) → Quantum: O(N)O(\sqrt{N})
  • Weakens symmetric crypto — does NOT break it outright
  • Fix: just use longer keys
AlgorithmClassical SecurityQuantum Security (after Grover)
AES-128128-bit~64-bit ❌
AES-256256-bit~128-bit ✅

🏫 Lecturer note: AES is still secure — just use AES-256!


Impact Summary

AlgorithmVulnerable toStatus
RSA-2048Shor's❌ Broken
ECDSA / ECCShor's❌ Broken
DSA / Finite Field DHShor's❌ Broken
AES-128Grover's⚠️ Weakened — upgrade to AES-256
AES-256Grover's✅ Safe (~128-bit quantum security)
SHA-2 / SHA-3Grover'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:

  • xx = how long the data needs to stay secure
  • yy = how long it takes to migrate to quantum-safe solutions
  • zz = how long until a large-scale quantum computer exists

If x+y>z, then worry NOW\boxed{\text{If } x + y > z, \text{ then worry NOW}}

🏠 Analogy: Your house needs to stand 20 more years (x=20x=20). Rebuilding takes 5 years (y=5y=5). Earthquake coming in 15 years (z=15z=15). Since 20+5=25>1520 + 5 = 25 > 15 — you're already too late to start.


3. Post-Quantum Cryptography (PQC)

PQC=Classical algorithms secure against BOTH classical AND quantum attacks\boxed{\text{PQC} = \text{Classical algorithms secure against BOTH classical AND quantum attacks}}

  • 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

ChallengeWhy
EfficiencyNew algorithms must be fast enough for real-world use
ConfidenceNeeds years of cryptanalysis to build trust
StandardizationNIST competition running since 2016
InteroperabilityMust integrate with TLS, IKE, VPNs, existing infrastructure

PQC Families

FamilyHard ProblemExampleStatus
Lattice-BasedLWE / RLWEKyber, Dilithium⭐ NIST Standardized
Code-BasedSyndrome DecodingMcEliece, HQCHQC selected 2025 (4th round)
Hash-BasedHash TreesSPHINCS+✅ NIST Standardized
MultivariateMQ ProblemRainbow❌ Broken
Isogeny-BasedElliptic Curve IsogenySIKE❌ Broken

NIST Standardization Results

RoundWinners
3rd RoundKyber (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: b1=(2,0), b2=(0,3)b_1 = (2,0),\ b_2 = (0,3) → Lattice = (2a, 3c) ∣ a,c∈Z{(2a,\ 3c)\ |\ a,c \in \mathbb{Z}}

  • Is (12,0)(12, 0) in the lattice? → a=6a=6, c=0c=0 → ✅ Yes
  • Is (5,1)(5, 1) in the lattice? → a=2.5a=2.5 → ❌ No (not integer)

In Kyber: dimension is n=512n = 512 or 768768 — 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.

λ1(Λ)=min⁡v∈Λ∖0∣v∣\boxed{\lambda_1(\Lambda) = \min_{v \in \Lambda \setminus {0}} |v|}

  • Easy in 2D/3D
  • Exponentially hard in n=512+n = 512+ dimensions
  • No efficient quantum algorithm known

Closest Vector Problem (CVP)

Given a target point off the grid, find the nearest lattice point.

v∈Λ such that ∣t−v∣ is minimized\boxed{v \in \Lambda \text{ such that } |t - v| \text{ is minimized}}

  • Easy in 2D (you can see it)
  • Exponentially hard in n=512+n = 512+: can't "see" structure, distances behave counter-intuitively, best known attacks are exponential-time

SVP vs CVP vs LWE Summary

ProblemGivenGoalRole in PQC
SVPLattice Λ\LambdaFind shortest non-zero vectorCore worst-case hardness
CVPLattice + target ttFind closest lattice point to ttDirect decoding problem
LWEb=As+eb = As + eRecover secret ssFoundation of PQ crypto

All three become exponentially hard as dimension grows\boxed{\text{All three become exponentially hard as dimension grows}}


5. Learning With Errors (LWE)

Core Equation

b=As+e(modq)\boxed{b = As + e \pmod{q}}

SymbolMeaning
A∈Zqm×nA \in \mathbb{Z}_q^{m \times n}Public matrix (known to everyone)
s∈Zqns \in \mathbb{Z}_q^nSecret vector (what we want to hide)
e∈Zqme \in \mathbb{Z}_q^mSmall noise (tiny random error)
b∈Zqmb \in \mathbb{Z}_q^mPublic output
qqModulus

Given: AA and bb → Goal: Recover ss — computationally hard!

📊 Analogy: 1000 equations like 3x+5y+7z≈423x + 5y + 7z \approx 42, but each has a tiny random rounding error added. Without knowing the errors, you cannot solve for x,y,zx, y, z — even with a quantum computer!

Why the Noise Makes It Hard

CaseEquationSolvable?
No noise (e=0e = 0)b=Asb = AsEasy — Gaussian elimination
With noise (e≠0e \neq 0)b=As+eb = As + eExponentially hard — becomes CVP

With noise → must find ss such that ∣b−As∣|b - As| is small → Closest Vector Problem → exponential time.

Why LWE Is Quantum-Safe

Breaking LWE≡Breaking SVP/CVP≡Exponential Time\text{Breaking LWE} \equiv \text{Breaking SVP/CVP} \equiv \text{Exponential Time}

LWE won the Gödel Prize 2018 — foundation for "nearly every kind of cryptographic object."


6. Module-LWE (MLWE)

MLWE = LWE in Polynomial Form\boxed{\text{MLWE = LWE in Polynomial Form}}

Instead of integer vectors, work over polynomial rings:

  • Ring: Rq=Zq[x]/(xn+1)R_q = \mathbb{Z}_q[x]/(x^n + 1)
  • A\mathbf{A} = matrix of polynomials; s,e\mathbf{s}, \mathbf{e} = vectors of polynomials
  • Same equation: b=As+e\mathbf{b} = \mathbf{A}\mathbf{s} + \mathbf{e} — 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

AlgorithmPurpose
CRYSTALS-KyberKey Encapsulation Mechanism (KEM)
CRYSTALS-DilithiumDigital 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)

StepOperation
1Generate public matrix A∈Rqk×k\mathbf{A} \in R_q^{k \times k}
2Sample small secret: s←\mathbf{s} \leftarrow small in RqkR_q^k
3Sample small error: e←\mathbf{e} \leftarrow small in RqkR_q^k
4Compute: t=As+e\mathbf{t} = \mathbf{As} + \mathbf{e}

pk=(A, t),sk=s\boxed{pk = (\mathbf{A},\ \mathbf{t}), \quad sk = \mathbf{s}}

Bob sends pkpk to Alice.

Kyber Step 2: Encaps — Alice (Sender)

StepOperation
1Choose random seed mm
2Derive: K=H(m)K = H(m) (shared secret)
3Sample small: r, e1, e2\mathbf{r},\ \mathbf{e_1},\ e_2
4Compute: u=ATr+e1\mathbf{u} = \mathbf{A}^T\mathbf{r} + \mathbf{e_1}
5Compute: v=tTr+e2+⌊q/2⌋⋅mv = \mathbf{t}^T\mathbf{r} + e_2 + \lfloor q/2 \rfloor \cdot m

c=(u, v),K\boxed{c = (\mathbf{u},\ v), \quad K}

Alice sends ciphertext cc to Bob — NOT KK.

Kyber Step 3: Decaps — Bob (Receiver)

StepOperation
1Compute: m′=v−uTsm' = v - \mathbf{u}^T \mathbf{s}
2Derive: K=H(m′)K = H(m')

KAlice=KBob ✅\boxed{K_{Alice} = K_{Bob}}\ ✅

Why does decryption work? v−uTs=(tTr+e2+⌊q/2⌋m)−(ATr+e1)Tsv - \mathbf{u}^T \mathbf{s} = (t^T r + e_2 + \lfloor q/2 \rfloor m) - (A^T r + e_1)^T s

The lattice components cancel (since t=As+et = As + e), leaving ≈⌊q/2⌋m\approx \lfloor q/2 \rfloor m — 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

H(pk)=SHA3-256(pk)H(pk) = \text{SHA3-256}(pk) (K′,r)=SHA3-512(m∣H(pk))(K', r) = \text{SHA3-512}(m | H(pk)) K=SHAKE256(K′∣H(c))\boxed{K = \text{SHAKE256}(K' | H(c))}

Kyber's Role

  • ❌ Does NOT encrypt data directly
  • ✅ Establishes a shared symmetric key KK
  • Then: C=AES-GCM(K,M)C = \text{AES-GCM}(K, M) — 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 sk=ssk = \mathbf{s}. The secret key is never shared. Breaking t=As+e\mathbf{t} = \mathbf{As} + \mathbf{e} to recover s\mathbf{s} is the MLWE problem — exponentially hard even for quantum computers.


8. CRYSTALS-Dilithium (Digital Signature)

Replaces RSA and ECDSA. Based on MLWE. Operations over Rq=Zq[x]/(xn+1)R_q = \mathbb{Z}_q[x]/(x^n+1).

✍️ 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

StepOperation
1Generate matrix: A∈Rqk×l\mathbf{A} \in R_q^{k \times l}
2Sample small: s1∈Rql, s2∈Rqk\mathbf{s_1} \in R_q^l,\ \mathbf{s_2} \in R_q^k
3Compute: t=As1+s2\mathbf{t} = \mathbf{A}\mathbf{s_1} + \mathbf{s_2}
4Split t\mathbf{t} into high bits t1\mathbf{t_1} + low bits t0\mathbf{t_0} (reduces signature size)

pk=(A, t1),sk=(s1, s2, t0)\boxed{pk = (\mathbf{A},\ \mathbf{t_1}), \quad sk = (\mathbf{s_1},\ \mathbf{s_2},\ \mathbf{t_0})}

Dilithium Sign(sk, m)

StepOperation
1Hash message: μ=H(m)\mu = H(m)
2Sample random vector y\mathbf{y}
3Compute temporary: w=Ay\mathbf{w} = \mathbf{A}\mathbf{y}
4Compute challenge (binds sig to message): c=H(μ,w)c = H(\mu, \mathbf{w})
5Compute signature vector: z=y+cs1\mathbf{z} = \mathbf{y} + c\mathbf{s_1}

σ=(c, z)\boxed{\sigma = (c,\ \mathbf{z})}

Dilithium Verify(pk, m, σ)

StepOperation
1Parse signature: extract (c,z)(c, \mathbf{z})
2Recompute hash: μ=H(m)\mu = H(m)
3Recompute temp: w′=Az−ct\mathbf{w}' = \mathbf{A}\mathbf{z} - c\mathbf{t}
4Recompute challenge: c′=H(μ,w′)c' = H(\mu, \mathbf{w}')

Accept if c′=c, otherwise Reject\boxed{\text{Accept if } c' = c, \text{ otherwise Reject}}


9. Manual Kyber Exercise (Small Example)

Given: q=17q = 17, A=[3572]A = \begin{bmatrix} 3 & 5 \\ 7 & 2 \end{bmatrix}, s=[2,1]s = [2, 1], e=[1,1]e = [1, 1], r=[1,2]r = [1, 2], m=1m = 1, e1=[1,0]e_1 = [1, 0], e2=1e_2 = 1

Step 1: Public Key t=As+e(mod17)t = As + e \pmod{17} As=[3572][21]=[1116],t=[11+116+1]=[120](mod17)As = \begin{bmatrix}3&5\\7&2\end{bmatrix}\begin{bmatrix}2\\1\end{bmatrix} = \begin{bmatrix}11\\16\end{bmatrix}, \quad t = \begin{bmatrix}11+1\\16+1\end{bmatrix} = \begin{bmatrix}12\\0\end{bmatrix} \pmod{17}

Step 2: Ciphertext u=ATr+e1(mod17),v=tTr+e2+⌊17/2⌋⋅m(mod17)u = A^T r + e_1 \pmod{17}, \quad v = t^T r + e_2 + \lfloor 17/2 \rfloor \cdot m \pmod{17} ⌊17/2⌋=8,m=1⇒v=tTr+1+8(mod17)\lfloor 17/2 \rfloor = 8, \quad m=1 \Rightarrow v = t^T r + 1 + 8 \pmod{17}

Step 3: Decrypt v−sTu(mod17)v - s^T u \pmod{17} → result should be close to 88 (since ⌊q/2⌋=8\lfloor q/2 \rfloor = 8)

Step 4: Recover mm → if result ≈8\approx 8 → m=1m = 1; if ≈0\approx 0 → m=0m = 0

Step 5: Shared Key K=H(m)K = H(m) — relationship: KK is the hash of mm


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.

Policy example: (Doctor AND Hospital-A) OR Emergency\boxed{\text{Policy example: (Doctor AND Hospital-A) OR Emergency}}

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

EntityRole
Attribute Authority (AA)Root of trust — generates system params, issues attribute keys
Data OwnerEncrypts data with a specific access policy
UserHolds attribute keys, attempts to decrypt
Cloud StorageHosts the encrypted ciphertext

Cryptographic Lifecycle

Setup → Key Generation → Encryption → Decryption
PhaseWhat happens
SetupAuthority generates master keys + public parameters
Key GenerationUser receives secret keys based on their attributes
EncryptionData owner encrypts with embedded access policy
DecryptionUser decrypts only if attributes satisfy policy

Phase 1: Setup — Trapdoor Generation

PK=A,MK=TA\boxed{PK = A, \quad MK = T_A}

(A,TA)←TrapGen(n,m,q)(A, T_A) \leftarrow TrapGen(n, m, q) — random matrix with trapdoor

  • AA = public matrix (everyone knows it)
  • TAT_A = trapdoor (secret master key for Authority only)

🚪 Trapdoor = a mathematical backdoor. Without TAT_A, impossible to invert AA. With TAT_A, easy. One-way unless you know the secret.

Phase 2: Key Generation — Trapdoor Sampling

Ax=u(modq)and∣x∣ is small\boxed{Ax = u \pmod{q} \quad \text{and} \quad |x| \text{ is small}}

x←SampleD(A,TA,u)x \leftarrow SampleD(A, T_A, u) — sampled from a discrete Gaussian distribution

Output: Secret Key SKSSK_S tied exclusively to the user's attributes.

Phase 3: Encryption — LSSS Policy

Policy encoded as Linear Secret Sharing Scheme (LSSS): (M,ρ)(M, \rho) where MM = sharing matrix, ρ(i)\rho(i) = attribute for row ii.

Example — policy (Doctor AND Hospital-A) OR Emergency:

Row iiAttribute
1Doctor
2Hospital-A
3Emergency

C0=ATs+e,Ci=Aρ(i)Ts+ei+λi\boxed{C_0 = A^T\mathbf{s} + \mathbf{e}, \quad C_i = A_{\rho(i)}^T s + e_i + \lambda_i}

  • C0C_0 = global secret vector
  • Each CiC_i = LSSS share for attribute ii hidden inside LWE ciphertext
  • Noise e,eie, e_i 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: ∑iλiSKi\sum_i \lambda_i SK_i

To recover: M=C1−sTA\boxed{M = C_1 - s^T A}

Noise gracefully cancels out during subtraction → reveals message MM.

ABE Advantages vs. Challenges

Advantages ✅Challenges ⚠️
Proven post-quantum security (MLWE)Larger key sizes vs ECC
Fine-grained access at data levelHigher computational overhead
Native AND/OR/Threshold/Role policiesCiphertext expansion (output >> payload)
Suitable for cloud and IoT data sharing—

⚡ Key Facts to Remember

FactDetail
Shor's breaksRSA, ECDSA, DSA, Diffie-Hellman — all public-key crypto
Grover's weakensAES — 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 ifx+y>zx + y > z
PQC runs onNormal 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 candidatesRainbow (multivariate), SIKE (isogeny)
LWE security basisReduced to SVP/CVP hardness — exponential time
MLWE =LWE over polynomial rings — faster, smaller keys
Kyber is forKey Encapsulation — not direct data encryption
Kyber keygen: who does it?Receiver (Bob) — unlike RSA where sender uses receiver's public key
Shared key usageC=AES-GCM(K,M)C = \text{AES-GCM}(K, M) — Kyber negotiates key, AES encrypts data
Dilithium is forDigital signatures — replaces RSA/ECDSA
Dilithium verify conditionAccept if c′=cc' = c
CP-ABE policyEmbedded in ciphertext; only satisfied attributes can decrypt
TrapdoorMathematical backdoor: easy one-way, impossible to invert without TAT_A
Discrete GaussianDistribution used for sampling secret keys in lattice crypto
SVPShortest Vector Problem — find shortest arrow in lattice grid
CVPClosest Vector Problem — find nearest grid point to off-grid target
No noise → easyb=Asb = As solvable by Gaussian elimination
With noise → hardb=As+eb = As + e becomes CVP — exponentially hard