Files
opaque-lattice/docs/FORMAL_SECURITY_PROOF.typ
2026-01-07 11:40:09 -07:00

597 lines
18 KiB
Typst
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Formal Security Proof for Lattice-Based OPAQUE
// Compiled with: typst compile FORMAL_SECURITY_PROOF.typ
#set document(
title: "Formal Security Proofs for Post-Quantum OPAQUE",
author: "opaque-lattice",
)
#set page(
paper: "us-letter",
margin: (x: 1in, y: 1in),
numbering: "1",
)
#set text(font: "New Computer Modern", size: 11pt)
#set heading(numbering: "1.1")
#set math.equation(numbering: "(1)")
#show heading.where(level: 1): it => {
pagebreak(weak: true)
it
}
// Title
#align(center)[
#text(size: 18pt, weight: "bold")[
Formal Security Proofs for Post-Quantum OPAQUE
]
#v(0.5em)
#text(size: 12pt)[opaque-lattice v0.1.0]
#v(0.5em)
#text(size: 10pt, style: "italic")[January 2025]
]
#v(2em)
#outline(indent: true, depth: 3)
= Introduction
This document provides formal cryptographic proofs for the security properties of the opaque-lattice implementation. We prove security in the Universal Composability (UC) framework under standard lattice assumptions.
== Protocol Summary
The opaque-lattice protocol implements post-quantum OPAQUE using:
- *Ring-LWE OPRF*: Oblivious PRF based on Ring Learning With Errors
- *ML-KEM (Kyber768)*: Key encapsulation for authenticated key exchange
- *ML-DSA (Dilithium3)*: Digital signatures for server authentication
- *Fast OPRF*: OT-free construction with 180× speedup
== Security Parameters
#table(
columns: (auto, auto, auto),
[*Parameter*], [*Value*], [*Security Level*],
[$n$ (ring dimension)], [256], [128-bit classical],
[$q$ (modulus)], [12289], [~64-bit quantum],
[$beta$ (error bound)], [3], [Coefficients in $\{-3,...,3\}$],
[Output length], [256 bits], [Collision resistant],
)
= Preliminaries
== Notation
#table(
columns: (auto, auto),
[*Symbol*], [*Meaning*],
[$lambda$], [Security parameter (128 bits)],
[$R_q$], [Ring $ZZ_q[x]/(x^n + 1)$ where $n = 256$, $q = 12289$],
[$D_(sigma)$], [Discrete Gaussian with parameter $sigma$],
[$a arrow.l.double S$], [Sample $a$ uniformly from set $S$],
[$"negl"(lambda)$], [Negligible function in $lambda$],
[$approx_c$], [Computationally indistinguishable],
[$approx_s$], [Statistically indistinguishable],
)
== Computational Assumptions
#block(stroke: 0.5pt, inset: 10pt, radius: 3pt)[
*Definition 2.1 (Ring-LWE Problem)*
For $a arrow.l.double R_q$, secret $s arrow.l.double D_sigma^n$, and error $e arrow.l.double D_sigma^n$:
$ (a, a dot s + e) approx_c (a, u) $
where $u arrow.l.double R_q$ is uniformly random.
]
#block(stroke: 0.5pt, inset: 10pt, radius: 3pt)[
*Definition 2.2 (Ring-LWE Hardness)*
The best known attacks require:
- *Classical*: $2^(Omega(n))$ time via BKZ lattice reduction
- *Quantum*: $2^(Omega(n))$ time via quantum sieving (no exponential speedup)
]
= OPRF Security Proofs
== Obliviousness (Theorem 3.1)
#block(stroke: 1pt, inset: 12pt, radius: 5pt, fill: rgb("#f5f5f5"))[
*Theorem 3.1 (OPRF Obliviousness)*
For any PPT adversary $cal(A)$, the advantage in distinguishing:
- REAL: $C = A dot s + e$ where $s, e$ derived from password
- IDEAL: $C arrow.l.double R_q$ (uniform random)
is bounded by:
$ "Adv"^("obliv")_(cal(A)) <= "Adv"^("RLWE")_(cal(B))(n, q, sigma) $
]
*Proof.* We construct a reduction $cal(B)$ that uses $cal(A)$ to break Ring-LWE.
*Reduction $cal(B)$:*
1. $cal(B)$ receives Ring-LWE challenge $(A, b)$ where either:
- $b = A dot s + e$ for small $s, e$ (LWE case)
- $b arrow.l.double R_q$ (uniform case)
2. $cal(B)$ simulates the OPRF for $cal(A)$:
- Set public parameter as the challenge $A$
- When $cal(A)$ queries $"Blind"("password")$:
- Return $C = b$ (the Ring-LWE challenge)
3. When $cal(A)$ outputs guess $g in {"REAL", "IDEAL"}$:
- If $g = "REAL"$: $cal(B)$ outputs "LWE"
- If $g = "IDEAL"$: $cal(B)$ outputs "Uniform"
*Analysis:*
- If $b = A dot s + e$: $cal(A)$ sees valid OPRF blinding outputs REAL
- If $b arrow.l.double R_q$: $cal(A)$ sees random outputs IDEAL
- $"Adv"(cal(B)) = "Adv"(cal(A))$ #h(1fr) $square$
== Pseudorandomness (Theorem 3.2)
#block(stroke: 1pt, inset: 12pt, radius: 5pt, fill: rgb("#f5f5f5"))[
*Theorem 3.2 (OPRF Pseudorandomness)*
For any PPT adversary $cal(A)$ without the server key $k$:
$ {"Eval"(k, "password")} approx_c {U} $
where $U$ is uniform random in $\{0,1\}^256$.
]
*Proof.* By game sequence:
*Game 0:* Real OPRF execution with output $H(W)$ where $W = s dot B$.
*Game 1:* Replace $k dot A dot s$ with random ring element $r$.
- By Ring-LWE: $A dot s + e approx_c "uniform"$
- Therefore $k dot (A dot s + e) approx_c k dot "uniform"$
- $|Pr["Game 1"] - Pr["Game 0"]| <= "Adv"^("RLWE")$
*Game 2:* Replace $H(W)$ with uniform random output.
- $H$ is modeled as random oracle
- Any non-trivial input distribution yields uniform output
- $|Pr["Game 2"] - Pr["Game 1"]| = 0$
*Combined bound:*
$ "Adv"^("PRF")_(cal(A)) <= "Adv"^("RLWE")_(cal(B)) + 2^(-lambda) $ #h(1fr) $square$
= Forward Secrecy Analysis
== OPRF Layer (Theorem 4.1)
#block(stroke: 1pt, inset: 12pt, radius: 5pt, fill: rgb("#f5f5f5"))[
*Theorem 4.1 (OPRF Forward Secrecy Limitation)*
The OPRF layer does *not* provide forward secrecy. Compromise of server key $k$ allows computation of all past and future OPRF outputs.
]
*Proof.* The OPRF is deterministic: $F_k("password") = H("reconcile"(s dot B, k dot C))$.
Given $k$ and a transcript $(C, V, h)$:
1. Attacker computes $V' = k dot C$ (valid server response)
2. For any password guess $"pw"'$:
- Compute $s' = H_"small"("pw"')$
- Compute $C' = A dot s' + e'$
- If $C' = C$, password found
3. Attacker can verify guesses offline
This is *by design*: OPRF provides obliviousness, not forward secrecy. #h(1fr) $square$
== AKE Layer (Theorem 4.2)
#block(stroke: 1pt, inset: 12pt, radius: 5pt, fill: rgb("#f5f5f5"))[
*Theorem 4.2 (Session Forward Secrecy)*
Session keys have forward secrecy via ephemeral KEM. Compromise of long-term keys does not reveal past session keys.
]
*Proof.* Session key derivation:
$ K_"session" = "HKDF"("ss"_"ephemeral", "transcript") $
where $"ss"_"ephemeral"$ is the shared secret from ephemeral Kyber key exchange.
1. Each session generates fresh $(e k, d k) arrow.l "KEM.KeyGen"()$
2. Server encapsulates: $("ct", "ss") arrow.l "KEM.Encap"(e k)$
3. Session key depends on ephemeral $"ss"$, not long-term keys
4. Past $d k$ values are erased after session completion
Under IND-CCA security of Kyber:
$ Pr["recover past " K_"session"] <= "Adv"^("IND-CCA")_"Kyber" = "negl"(lambda) $ #h(1fr) $square$
= Server Impersonation Resistance
== Main Theorem (Theorem 5.1)
#block(stroke: 1pt, inset: 12pt, radius: 5pt, fill: rgb("#f5f5f5"))[
*Theorem 5.1 (Server Impersonation Resistance)*
For any PPT adversary $cal(A)$ without server key $k$, the probability of producing a valid server response that leads to correct authentication is negligible.
]
*Proof.* Consider adversary $cal(A)$ attempting to impersonate server.
*Setup:* Client computes $(s, C) = "Blind"("password")$ and sends $C$.
*Attack:* $cal(A)$ must produce $(V^*, h^*)$ such that client derives correct OPRF output.
*Analysis:*
Client computes: $W = s dot B$ where $B = A dot k + e_k$ (server's public key).
For correct reconciliation, $cal(A)$ needs $V^*$ such that:
$ "reconcile"(W, h^*) = "reconcile"(V, h) $
where $V = k dot C$ is the honest server's response.
*Case 1: $cal(A)$ guesses $V$*
- $V in R_q$ has $q^n = 12289^256$ possible values
- Random guess succeeds with probability $q^(-n) = "negl"(lambda)$
*Case 2: $cal(A)$ computes $V$ without $k$*
- Requires solving: find $V$ such that $V approx s dot B$ (within reconciliation tolerance)
- $B = A dot k + e_k$ is Ring-LWE instance
- Extracting $k$ from $B$ requires breaking Ring-LWE
- $Pr["success"] <= "Adv"^("RLWE")$
*Case 3: $cal(A)$ uses wrong key $k'$*
- Computes $V' = k' dot C$
- Client computes $W = s dot B$ where $B = A dot k + e_k$
- $V' - W = k' dot C - s dot B = k' dot (A dot s + e) - s dot (A dot k + e_k)$
- $= (k' - k) dot A dot s + k' dot e - s dot e_k$
- Since $k' != k$, $(k' - k) dot A dot s$ is large (not small error)
- Reconciliation fails with overwhelming probability
*Bound:*
$ Pr["impersonation"] <= "Adv"^("RLWE") + q^(-n) = "negl"(lambda) $ #h(1fr) $square$
= Man-in-the-Middle Resistance
== Message Modification (Theorem 6.1)
#block(stroke: 1pt, inset: 12pt, radius: 5pt, fill: rgb("#f5f5f5"))[
*Theorem 6.1 (MITM Detection)*
Any modification to protocol messages by a MITM adversary results in authentication failure with overwhelming probability.
]
*Proof.* We analyze each message:
*Message 1: Client → Server ($C$)*
If MITM modifies $C$ to $C'$:
- Server computes $V' = k dot C'$
- Client expects $V = k dot C$
- Reconciliation: Client uses $W = s dot B$, server uses $V' = k dot C'$
- Since $C' != C$, the error term differs
- OPRF outputs differ MAC verification fails
*Message 2: Server → Client ($V, h, "mac"_S, "sig"$)*
If MITM modifies $V$ to $V'$:
- Client computes $W = s dot B$ (independent of $V$)
- Reconciliation uses $h$ which was computed from original $V$
- Modified $V'$ doesn't affect client's $W$ computation
- However, MAC is computed over transcript including $V$
- $"mac"_S = "MAC"(K, ... || V || ...)$
- Modified $V'$ causes MAC verification to fail
If MITM modifies signature:
- Signature verification fails (EUF-CMA of Dilithium)
*Message 3: Client → Server ($"mac"_C$)*
If MITM modifies $"mac"_C$:
- Server MAC verification fails
*Combined bound:*
$ Pr["undetected MITM"] <= "Adv"^("MAC") + "Adv"^("EUF-CMA") = "negl"(lambda) $ #h(1fr) $square$
= Quantum Security Analysis
== Security Parameters (Theorem 7.1)
#block(stroke: 1pt, inset: 12pt, radius: 5pt, fill: rgb("#f5f5f5"))[
*Theorem 7.1 (Post-Quantum Security Level)*
The opaque-lattice construction achieves:
- *Classical security*: ~128 bits
- *Quantum security*: ~64 bits (conservative estimate)
]
*Proof.* Security analysis based on lattice parameters:
*Ring-LWE Hardness:*
For parameters $(n = 256, q = 12289, sigma = 3)$:
The root Hermite factor $delta$ satisfies:
$ delta = (q / sigma)^(1/n) approx 1.0045 $
Core-SVP hardness:
$ "bits" = (n dot ln(delta)) / ln(2) approx 128 "classical bits" $
Quantum sieving provides ~$sqrt(2)$ speedup on the exponent:
$ "quantum bits" approx 64 $
*Grover's Attack on Passwords:*
For password with entropy $H$ bits:
- Classical search: $O(2^H)$
- Quantum search: $O(2^(H\/2))$ via Grover
Password security requirements:
#table(
columns: (auto, auto, auto),
[*Password Type*], [*Entropy*], [*Quantum Security*],
[4-digit PIN], [13 bits], [$2^(6.5)$ - WEAK],
[8-char mixed], [52 bits], [$2^(26)$ - WEAK],
[128-bit random], [128 bits], [$2^(64)$ - SECURE],
)
*Recommendation:* Use high-entropy passwords (≥128 bits) for post-quantum security. #h(1fr) $square$
== NIST Comparison (Theorem 7.2)
#block(stroke: 1pt, inset: 12pt, radius: 5pt, fill: rgb("#f5f5f5"))[
*Theorem 7.2 (NIST PQC Equivalence)*
The opaque-lattice parameters are comparable to NIST PQC Level 1 (Kyber-512).
]
*Proof.* Parameter comparison:
#table(
columns: (auto, auto, auto),
[*Parameter*], [*opaque-lattice*], [*Kyber-512*],
[$n$], [256], [256],
[$q$], [12289], [3329],
[$sigma$], [3], [3 (η)],
[$q\/sigma$], [4096], [1109],
)
Our $q\/sigma$ ratio is higher, providing a larger noise margin.
Core-SVP security estimates are comparable (~118-128 bits classical). #h(1fr) $square$
= Collision Resistance
== Output Collision (Theorem 8.1)
#block(stroke: 1pt, inset: 12pt, radius: 5pt, fill: rgb("#f5f5f5"))[
*Theorem 8.1 (Collision Resistance)*
For any PPT adversary $cal(A)$, the probability of finding two distinct passwords with the same OPRF output is negligible:
$ Pr["pw"_1 != "pw"_2 and F_k("pw"_1) = F_k("pw"_2)] <= 2^(-lambda) $
]
*Proof.* The OPRF output is computed as:
$ F_k("pw") = H("reconciled_bits"("pw")) $
where $H: \{0,1\}^n -> \{0,1\}^(256)$ is modeled as a random oracle.
*Case 1: Different reconciled bits*
- If $"bits"_1 != "bits"_2$, then $H("bits"_1) = H("bits"_2)$ is a hash collision
- Probability: $2^(-256)$ (birthday bound: $2^(-128)$ after $2^(128)$ queries)
*Case 2: Same reconciled bits from different passwords*
- Requires $(s_1, e_1) != (s_2, e_2)$ but same reconciliation
- $s_i = H_"small"("pw"_i)$ is deterministic
- If $"pw"_1 != "pw"_2$, then $s_1 != s_2$ with probability $1 - 2^(-n log_2(7))$
- Different $s$ values yield different $W = s dot B$ values
- Reconciliation to same bits requires error alignment: $"negl"(lambda)$
*Combined:*
$ Pr["collision"] <= 2^(-128) + "negl"(lambda) $ #h(1fr) $square$
= Domain Separation
== Cross-Context Independence (Theorem 9.1)
#block(stroke: 1pt, inset: 12pt, radius: 5pt, fill: rgb("#f5f5f5"))[
*Theorem 9.1 (Domain Separation)*
OPRF outputs are independent across different:
1. Public parameters (server identity)
2. Server keys (credential scope)
3. Protocol versions (upgrade isolation)
]
*Proof.*
*Public Parameter Separation:*
Public parameter $A$ is derived as:
$ A = H("FastOPRF-PublicParam-v1" || "seed") $
Different seeds yield independent $A$ values (random oracle).
For servers $S_1, S_2$ with seeds $"seed"_1 != "seed"_2$:
$ A_1 = H(... || "seed"_1) "independent of" A_2 = H(... || "seed"_2) $
OPRF outputs depend on $A$: $C = A dot s + e$, so outputs are independent.
*Server Key Separation:*
For keys $k_1 != k_2$ with same $A$:
$ B_1 = A dot k_1 + e_(k_1) != B_2 = A dot k_2 + e_(k_2) $
Client computes $W = s dot B$, yielding different outputs.
*Version Separation:*
Domain strings in hash functions:
- `"FastOPRF-SmallSample-v1"`
- `"FastOPRF-HashToRing-v1"`
- `"FastOPRF-Output-v1"`
Changing version string yields independent hash outputs. #h(1fr) $square$
= Key Rotation Security
== Rotation Independence (Theorem 10.1)
#block(stroke: 1pt, inset: 12pt, radius: 5pt, fill: rgb("#f5f5f5"))[
*Theorem 10.1 (Key Rotation Security)*
After key rotation from $k_"old"$ to $k_"new"$:
1. Old credentials cannot authenticate with new key
2. New credentials cannot authenticate with old key
3. Attacker with $k_"old"$ cannot forge credentials for $k_"new"$
]
*Proof.*
*Property 1 (Old → New):*
User registered with $k_"old"$ has envelope encrypted with:
$ "rw"_"old" = F_(k_"old")("password") $
With new key $k_"new"$:
$ "rw"_"new" = F_(k_"new")("password") != "rw"_"old" $
Envelope decryption fails authentication fails.
*Property 2 (New → Old):*
Symmetric argument.
*Property 3 (Key Independence):*
Given $k_"old"$, computing $F_(k_"new")("pw")$ requires:
- Either knowing $k_"new"$ (not derivable from $k_"old"$)
- Or breaking Ring-LWE to extract $k_"new"$ from $B_"new"$
Keys are generated independently:
$ k_"new" = H_"small"("seed"_"new") $
No correlation between $k_"old"$ and $k_"new"$. #h(1fr) $square$
= Credential Binding
== Binding Properties (Theorem 11.1)
#block(stroke: 1pt, inset: 12pt, radius: 5pt, fill: rgb("#f5f5f5"))[
*Theorem 11.1 (Credential Binding)*
Credentials are cryptographically bound to:
1. User identity (via credential_id in key derivation)
2. Server identity (via public parameters)
3. Password (via OPRF input)
]
*Proof.*
*User Binding:*
Server key derivation includes user identity:
$ k_u = H_"small"("server_seed" || "user_id") $
For users $u_1 != u_2$:
$ k_(u_1) != k_(u_2) => F_(k_(u_1))("pw") != F_(k_(u_2))("pw") $
*Server Binding:*
Public parameters derived from server identity:
$ A = H("FastOPRF-PublicParam-v1" || "server_id") $
OPRF output depends on $A$ through $C = A dot s + e$.
*Password Binding:*
OPRF is deterministic in password:
$ s = H_"small"("password"), quad e = H_"small"("password" || "error") $
Different passwords yield different $(s, e)$, thus different outputs. #h(1fr) $square$
= AKE Integration
== Mutual Authentication (Theorem 12.1)
#block(stroke: 1pt, inset: 12pt, radius: 5pt, fill: rgb("#f5f5f5"))[
*Theorem 12.1 (Mutual Authentication)*
The full OPAQUE protocol provides mutual authentication:
- Client authenticates to server via correct MAC (proves password knowledge)
- Server authenticates to client via correct OPRF response and signature
]
*Proof.*
*Client Server Authentication:*
1. Client computes $"rw" = F_k("password")$
2. Decrypts envelope: $("sk"_U, "sk"_"auth") = "Dec"("rw", "envelope")$
3. Computes $"mac"_C = "MAC"(K_"session", "transcript")$
4. Server verifies $"mac"_C$
Correct MAC implies:
- Client derived correct $K_"session"$
- Which requires correct $"rw"$
- Which requires correct password
*Server → Client Authentication:*
1. Server signs transcript: $sigma = "Sign"("sk"_S, "transcript")$
2. Client verifies: $"Verify"("pk"_S, "transcript", sigma)$
3. Server computes correct $V = k dot C$
4. Client derives $W = s dot B$ and reconciles
Correct reconciliation implies:
- Server used correct key $k$ matching $B = A dot k + e_k$
- Fake server with $k' != k$ produces wrong $V$
*Bound:*
$ Pr["auth forgery"] <= "Adv"^("MAC") + "Adv"^("EUF-CMA") + "Adv"^("RLWE") $ #h(1fr) $square$
= Conclusion
== Security Summary
#table(
columns: (auto, auto, auto),
[*Property*], [*Status*], [*Assumption*],
[Obliviousness], [ Proven], [Ring-LWE],
[Pseudorandomness], [ Proven], [Ring-LWE + ROM],
[Forward Secrecy (Session)], [ Proven], [IND-CCA of Kyber],
[Server Impersonation], [ Proven], [Ring-LWE],
[MITM Resistance], [ Proven], [MAC + EUF-CMA],
[Quantum Security], [ Analyzed], [Core-SVP hardness],
[Collision Resistance], [ Proven], [ROM],
[Domain Separation], [ Proven], [ROM],
[Key Rotation], [ Proven], [Key independence],
[Credential Binding], [ Proven], [Construction],
[Mutual Authentication], [ Proven], [All above],
)
== Assumptions Summary
The security of opaque-lattice relies on:
1. *Ring-LWE Assumption*: $(n=256, q=12289, sigma=3)$
2. *Module-LWE Assumption*: For Kyber and Dilithium
3. *Random Oracle Model*: SHA3/SHAKE treated as random oracles
4. *Standard Model*: MAC, AEAD security
== Remaining Work
For full formal verification:
1. Machine-checked proofs (EasyCrypt/Coq)
2. Tight reduction analysis
3. Multi-session composition proof
4. Independent cryptographic audit
#pagebreak()
= References
+ R. Canetti. "Universally Composable Security: A New Paradigm for Cryptographic Protocols." FOCS 2001.
+ S. Jarecki, H. Krawczyk, J. Xu. "OPAQUE: An Asymmetric PAKE Protocol Secure Against Pre-Computation Attacks." Eurocrypt 2018.
+ V. Lyubashevsky. "Lattice Signatures without Trapdoors." EUROCRYPT 2012.
+ C. Peikert. "A Decade of Lattice Cryptography." Foundations and Trends in Theoretical Computer Science, 2016.
+ NIST. "Module-Lattice-Based Key-Encapsulation Mechanism Standard." FIPS 203, 2024.
+ NIST. "Module-Lattice-Based Digital Signature Standard." FIPS 204, 2024.