Standardizing Security for the Quantum Era
Classical Cryptography Foundation
The Two Types of Classical Crypto
Symmetric-Key Cryptography
- Alice and Bob share a secret key beforehand
- Example: AES, Chacha20
Public-Key Cryptography
- Alice can send a secure message without ever meeting Bob
- Example: RSA, ECC
Key Insight: Classical crypto security relies on math problems that are too hard for modern computers to solve quickly.
Analogy: Factoring is like being given a 300-digit number and being asked "which two prime numbers multiply to give this?" — computers would take longer than the age of the universe.
The Quantum Threat
What Makes Quantum Computers Different?
Classical Bit vs Qubit
- Classical bit: either
0OR1 - Qubit: can be
0AND1at the same time (superposition)- Mathematically:
Analogy: A classical coin is either Heads or Tails. A quantum coin, while spinning, is both at once — it only "picks a side" when you look at it (measurement collapses the superposition).
Why this matters: Quantum computers can explore many possibilities simultaneously, giving them exponential speedups on certain problems.

Quantum Algorithms That Break Crypto
Shor's Algorithm (1994)
- A polynomial-time quantum algorithm
- Solves integer factorization and discrete logarithm exponentially faster than classical computers
- Result: RSA, ECC, and Diffie-Hellman are all fundamentally vulnerable
- อาจารย์บอกว่า AES is still secure เลยนะ!!
- → Longer key size, more secure
Grover's Algorithm
- Gives a quadratic speedup in unstructured search
- Classical: → Quantum:
- Weakens symmetric crypto (but doesn't break it outright)
Analogy for Shor's: Imagine a huge combination lock with a billion combinations. Classically, you try them one by one. Shor's algorithm is like being able to try all combinations simultaneously and instantly identify the right one.
Quantum Computer Progress Timeline
| Year | Qubits |
|---|---|
| 1998 | 2 |
| 2000 | 4–7 |
| 2006 | 12 |
| 2011 | 14 |
| 2017 | 49 |
| 2019 | 53 (Google — First Quantum Supremacy for specific task) |
| 2023 | 433 |
| 2025 | 1000+ |
| 2030? | 1,000,000? |
| 
Impact on Current Algorithms
Vulnerable (Broken by Large-Scale Quantum)
- RSA (e.g., RSA-2048 broken by Shor's)
- ECDSA / Elliptic Curve Cryptography
- DSA / Finite Field Cryptography
- Diffie-Hellman Key Exchange
Impact: PKI ecosystem invalid, TLS/VPN compromised.
Adaptable (Usable with Adjustments)
- AES → Requires longer keys (use AES-256)
- Triple DES → Requires longer keys
- SHA-2 / SHA-3 → Use longer output
Why is AES okay? Grover's only gives a square-root speedup. AES-128 effectively becomes ~64-bit against quantum — not great. AES-256 becomes ~128-bit — still secure enough.
⚠️ The "Harvest Now, Decrypt Later" Attack
Adversaries can:
- Record encrypted traffic today
- Decrypt it later once quantum computers exist
This means data encrypted right now could be vulnerable in the future — including state secrets, medical records, financial data.
แม้ว่าตอนนี้ Attacker ได้ Ciphertext ไปก็ยังเอาไปทำอะไรไม่ได้ เพราะว่า Technology capabilities ยังไม่ถึง
- NIST (USA) เป็นคน regulate เรื่องพวกนี้
Mosca's Theorem — When Do We Need to Worry?
Let:
- = how long the encrypted data needs to stay secure
- = how long it takes to migrate infrastructure to quantum-safe solutions
- = how long until a large-scale quantum computer exists

Analogy: If your house needs to stay standing for 20 more years (), and it takes 5 years to rebuild (), but an earthquake is coming in 15 years () — you're already too late to start building.
Post-Quantum Cryptography (PQC)
What is PQC?
- Runs entirely on classical (normal) computers — no quantum hardware needed
- Can be deployed as a software upgrade
- Secure against both classical and quantum adversaries

Why PQC Takes Time
- Efficiency: New algorithms must be fast enough for real-world use
- Confidence: Needs years of cryptanalysis to trust
- Standardization: NIST has been running a competition since 2016
- Interoperability: Must work with TLS, IKE, VPNs, etc.
Families of Post-Quantum Cryptography
| Family | Hard Problem | Example | Status |
|---|---|---|---|
| Lattice-Based | LWE / RLWE | Kyber, Dilithium | NIST Standardized ⭐ |
| Code-Based | Syndrome Decoding | McEliece | Finalist |
| Hash-Based | Hash Trees | SPHINCS+ | NIST Standardized |
| Multivariate | MQ Problem | Rainbow | ❌ Broken |
| Isogeny-Based | Elliptic Curve Isogeny | SIKE | ❌ Broken |
NIST Standardization Progress
พวก Mathematicians อยากจะส่ง Algorithm เข้า NIST กันมาก คงเพราะอยากได้เงินเนี่ยแหละ5555
- 3rd Round → Selected for standardization:
- Public-key encryption: Kyber (Lattice-based)
- Signatures: Dilithium, FALCON (Lattice), SPHINCS+ (Hash-based)
- 4th Round → Selected 2025:
- Public-key encryption: HQC (Code-based)
Lattice-Based Cryptography — The Most Promising Family

What is a Lattice?
Analogy: Imagine floor tiles. The corners of all the tiles form a regular grid of points. That grid is a lattice.

What’s the difference between matrix and vector?
- A vector is a 1-dimensional list of numbers.
- A matrix is a 2-dimensional array of numbers arranged in rows and columns.
Formally, a lattice is all integer combinations of some basis vectors:
Where are linearly independent basis vectors.
Properties:
- Only integer coefficients (no fractions!)
- Infinite number of points
- Regular repeating structure
Simple Example
Let and
Some lattice points:
- —
- —
- —
- —
- —
- —
General form: for any integers .
Is in the lattice?
- ✅ (integer)
- ✅ (integer)
- Yes! ✅
Is in the lattice?
- ❌ (not integer)
- is NOT in the lattice ❌
Why Lattices Are Hard in High Dimensions
In Kyber (real PQC), the dimension is or .
We ask: can a target vector be written as
- We have
- 768 basis vectors ( → directions - basis vectors)
- 768 integer multipliers ( → integer multiples (how many steps))
- Points in 768-dimensional space ( → number of directions = dimension)
This becomes extremely difficult when:
- or dimensions
- Basis vectors are large and skewed
- Noise is added
Analogy: In 2D, finding the nearest point on a grid is easy — you can just look. In 768 dimensions, there is no "looking." Every direction looks almost the same distance away, and the number of nearby points grows exponentially.
The number of basis vectors () = the dimension of the lattice.
อย่าลืม Add section In Praise of LWE
→ No algorithm can break LWE right now!
Hard Lattice Problems
Shortest Vector Problem (SVP)
Definition: Given a lattice with basis , find the shortest non-zero lattice vector:
Intuition: "What is the shortest arrow you can make from the origin using the grid's directions?"
- Easy in 2D / 3D
- Exponentially hard in dimensions
- No efficient quantum algorithm known
Closest Vector Problem (CVP)

Definition: Given a lattice and a target point , find the lattice vector closest to :
Intuition: "Find the nearest grid point to a given off-grid point."
Why CVP is hard:
- Easy in 2D (you can visually see the nearest point)
- Extremely hard in because:
- Can't "see" the structure
- Number of nearby points explodes
- Distances behave counter-intuitively
- Everything looks almost equally far away
- Best known attacks are exponential-time
SVP vs CVP vs LWE Summary
| Problem | Given | Goal | Geometric Meaning | Role |
|---|---|---|---|---|
| SVP | Lattice | Find shortest non-zero vector | Smallest arrow from origin | Core worst-case hardness |
| CVP | Lattice + target | Find closest lattice point to | Nearest grid point to random point | Direct decoding problem |
| LWE | Recover secret | Noisy lattice decoding | Foundation of PQ crypto |

This shared hardness is why lattice-based crypto is post-quantum secure.
Learning With Errors (LWE)
The Core Idea
Where:
- → public matrix (known to everyone)
- → secret vector (what we want to hide)
- → small noise (random small error)
- → public output
- → modulus
Given: and
Goal: Recover secret — this is computationally hard!
Analogy: Imagine someone gives you 1000 equations like , but each equation has a tiny random rounding error added. Without knowing which errors were added, you cannot solve for — even with a quantum computer!
Why LWE is Hard — Two Cases
Case 1: No Noise ()
- This is just a linear system
- Solvable using Gaussian elimination
- Easy → polynomial time ✅
Case 2: With Noise ()
- is small but unknown
- Now , and there is no exact linear solution
- ===Must find such that is small===
- This becomes a Closest Vector Problem (CVP) in high dimension
- Exponentially hard → no efficient classical or quantum algorithm ✅
Why LWE is Secure
LWE = Hardness of SVP + CVP
LWE security is mathematically reduced to the worst-case hardness of SVP and CVP. This means:
- Breaking LWE = Breaking SVP/CVP
- Breaking SVP/CVP = exponential time
- Therefore LWE is exponentially hard to break
LWE won the Gödel Prize 2018 for revolutionizing cryptography in both theory and practice. It serves as the foundation for "nearly every kind of cryptographic object."
Module-LWE (MLWE)
พูดง่าย ๆ ก็คือ MLWE = LWE in Polynomial Form
LWE but over polynomial rings (structured generalization):
Instead of vectors of integers, we work with:
- Vectors of polynomials
- Over ring
The equation remains the same form:
But now is a matrix of polynomials, and are vectors of polynomials.
Why Module over Polynomial Ring?
- Highly structured → faster computation
- Uses NTT (Number Theoretic Transform) for fast polynomial multiplication modulo a prime
- Smaller keys than plain LWE
- Preserves lattice hardness
"MLWE is just LWE, but smarter and faster."
NIST Standardized MLWE Algorithms
- CRYSTALS-Kyber → Key Encapsulation (MLWE)
- CRYSTALS-Dilithium → Digital Signature (MLWE)
CRYSTALS-Kyber (Key Encapsulation)
What is Kyber?
- Based on MLWE
- Designed for Key Encapsulation Mechanism (KEM)
- Used in: TLS/SSL, VPN, Secure messaging
Analogy for KEM: Think of a KEM like a special lockbox. Bob puts a padlock on an empty box and sends it to Alice (public key). Alice puts a secret note inside, snaps the lock, and sends it back (encapsulation). Only Bob has the key to open it (decapsulation). They now both "know" the same secret note.
Step 1: KeyGen (Receiver — Bob)
Input: Security parameters
Output: Public key , Secret key
- Generate public polynomial matrix:
- Sample small secret vector:
- Sample small error vector:
- Compute public vector:
- Output:
Bob sends to Alice (the encryptor).
จะไม่เหมือน RSA นะที่ คน GenKey จะต้อง เป็นคนที่จะเริ่มสื่อสาร (Sender)
อันนี้ Receiver ต้องเป็นคน GenKey
Step 2: Encaps (Sender — Alice)
Input: Public key
Output: Ciphertext , Shared secret
- Choose random message/seed
- Derive shared secret: (Hash)
- Sample small random values:
- Compute ciphertext part 1:
- Compute ciphertext part 2:
- Output:
แล้วก็ส่ง ไปให้ Bob, not
Where:
- = public key vector
- = random vector chosen by sender
- = small noise
- = random message bits (used to derive key)
Encryption formula (detail):
Step 3: Decaps (Receiver — Bob)
Input: Ciphertext , Secret key
Output: Shared secret
- Compute estimate of message:
- Derive shared key:
- Output
Why does recover ?
The lattice components cancel out (since ), leaving approximately — and the small noise terms are small enough to round away.
Kyber
- ❌ Data Enc
- ✅ Secure Communication (based on Symmetric Encyption → เพราะว่า AES พวกนี้ ยังปลอดภัยสำหรับ Post Quantum Attack)
Full Kyber KEM Protocol (Alice–Bob)
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))
KEM Step 3: Turn Encryption into Key Exchange
Kyber does not encrypt data directly. Instead it encrypts a random value to establish a shared key.
Alice:
- Generate random message
- Encrypt it: ↔
- Derive shared key:
Final result:
This shared key is then used for symmetric encryption:
Full Hash Chain in Kyber
① Hash public key:
② Hash expansion:
③ Final key derivation:
อย่าลืมใส่ตรงนี้ missing heading
Exam, aj ask, hacker get PK, why Kyber is still safe.
Becasue the attacker do not have SK (how is SK computed?, since the first key gen by the receievr แล้ว)
Why Kyber is Quantum-Secure
- Security based on MLWE hardness
- High-dimensional lattice problems
- No efficient quantum attack is known
- If Kyber is secure → attacker cannot compute , even with a quantum computer
AES and Quantum
Grover's algorithm gives only a quadratic speedup on symmetric crypto:
| Algorithm | Classical Security | Quantum Security |
|---|---|---|
| AES-128 | 128-bit | ~64-bit ❌ |
| AES-256 | 256-bit | ~128-bit ✅ |
→ Symmetric crypto is still usable — just use longer keys.
CRYSTALS-Dilithium (Digital Signatures)
What is Dilithium?
- A Post-Quantum Digital Signature scheme
- Based on MLWE and structured lattice problems
- Designed to replace RSA and ECDSA
- All operations over polynomial ring:
Analogy: A digital signature is like a handwritten signature, but mathematical. Anyone can verify it was you who signed a document, but no one can forge your signature. Dilithium makes this quantum-resistant.
Dilithium KeyGen
- Generate matrix: (using a seed for compact storage)
- Sample small polynomials:
- Compute public vector:
- Split into high bits and low bits (reduces signature size)
Output:
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 message hash: |
| 3 | Recompute temporary vector: |
| 4 | Recompute challenge: |
| Decision: | |
Post-Quantum Access Control: Lattice CP-ABE
Pairing ก็ vulnerable ต่อ Post quantum attack อยู่ดี
What is Attribute-Based Encryption (ABE)?
Analogy: Imagine a hospital where a file is encrypted so that 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 is encrypted under an access policy. Users can only decrypt if their attributes logically satisfy the policy constraints.
Example policy: (Doctor AND Hospital-A) OR Emergency

The Outcome: Fine-grained access control embedded at the data level, not relying on perimeter security.
The Four Entities
| Entity | Role |
|---|---|
| Attribute Authority (AA) | Root of trust. Generates system parameters and issues attribute keys. |
| Data Owner | Encrypts the data with a specific access policy. |
| User | Holds attribute keys and attempts to decrypt. |
| Cloud Storage | Intermediary hosting the encrypted ciphertext. |
The Cryptographic Lifecycle
1. Setup → 2. Key Generation → 3. Encryption → 4. Decryption
- Setup: Authority generates master keys and public parameters
- Key Generation: User receives secret keys based on their attributes
- Encryption: Data owner encrypts the message, embedding the access policy
- Decryption: User decrypts only if their attributes satisfy the embedded policy
Phase 1: Setup
Generate random matrix using Trapdoor Generation:
Output:
- = Public Key (the matrix , known to everyone)
- = Master Key (the trapdoor , kept secret by Authority)
What is a trapdoor? A mathematical backdoor. Without , it's computationally infeasible to invert . With , it's easy. Like a one-way door — easy to go through one way, impossible the other way, unless you know the secret.
Phase 2: Key Generation
For user with attribute set :
Authority uses lattice trapdoor sampling:
Such that:

The vector is sampled from a discrete Gaussian distribution.
Output: Secret Key — tied exclusively to the user's attributes.
Phase 3: Encryption
Data owner picks policy, creates a Linear Secret Sharing Scheme (LSSS):
An LSSS is defined as where:
- = sharing matrix
- = maps row to an attribute
Example for policy (Doctor AND Hospital-A) OR Emergency:
| Row | Attribute |
|---|---|
| 1 | Doctor |
| 2 | Hospital-A |
| 3 | Emergency |
The secret is shared across attributes using the LSSS matrix:
Where is the share assigned to attribute .
Ciphertext components:
Choose random , then:
For each attribute row :
- contains the global secret vector
- Each hides the LSSS share inside an LWE ciphertext
- Noise vectors ensure LWE hardness
"LSSS embeds the access policy into encryption by splitting the encryption secret into linear shares associated with attributes; only attribute sets satisfying the policy can linearly reconstruct the secret and decrypt."
Phase 4: Decryption
If user's attributes satisfy the policy:
User combines their attribute keys:
To recover:
Why this works:
Because the noise is intentionally small, the errors gracefully cancel out during subtraction, revealing the pristine message .
Advantages vs Challenges
| Architectural Advantages ✅ | Engineering Challenges ⚠️ |
|---|---|
| Mathematically proven post-quantum security | Significantly larger key sizes vs ECC |
| Highly granular, fine-grained access control at data level | Higher computational overhead |
| Native support for AND / OR / Threshold / Role-based policies | Ciphertext expansion (encrypted output >> original payload) |
| Suitable for cloud and IoT data sharing |
Exercise - Manual Kyber Computation
Given:
Compute:
- Public key
- Ciphertext and
- Bob computes
- Recover
- Compute shared key
What’s the relationship between
and
is computed from , value of hashing over
Summary
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 size)
Access Control ──► All pubkey broken ──► Lattice CP-ABE
All classical public-key security assumptions (factoring, discrete log) are broken by Shor's. The quantum-safe replacements (LWE/MLWE) rely on high-dimensional lattice problems that no known quantum algorithm can solve efficiently.