03 - Zero Knowledge
03 - Zero Knowledge
Zero-Knowledge
How can I prove that I know / can do sth. without revealing any other information?
2
Structure of Today’s Lecture
- Introduction
- Zero-knowledge Proofs of Languages in NP
- Sigma-Protocols
- Composition of Sigma-Protocols
- ZK and Non-Interactive ZK from Sigma-Protocols
3
INTRODUCTION
4
Motivation: Examples for Proofs
Proof Proof
The two roots are 𝑥1 = 1 and 𝑥2 = – 5. No proof exists as the statement is false.
Verification Verification
12 + 4 – 5 = 0 and – 5 2 + 4 ⋅ (−5) – 5 = 0. All „fake“ proofs will be rejected.
5
Proof Systems
Properties:
6
Zero-Knowledge Proof Example 1: Poisonous Liquids
7
Zero-Knowledge Proof Example 2: Opening Door
8
Zero-Knowledge Proof Example 3: Sudoku
9
Zero-Knowledge Proofs
V learns that the statement is true and nothing else beyond that.
V could generate a protocol view indistinguishable from a real protocol execution with P.
Zero-Knowledge (ZK) Property: For a true statement, there exists a simulator S interacting with
V that can generate a protocol view that looks like a valid protocol execution between P and V.
• Perfect ZK: Distributions of simulated view and real execution are exactly the same.
• Statistical ZK: Distributions of simulated view and real execution are statistically close.
Distinguishing them is possible with less than a certain probability (chosen to be negligible).
• Computational ZK: Distributions of simulated view and real execution are computationally
indistinguishable.
10
Zero-Knowledge Proof Paradox?
V cannot prove to a third party T that P knows the secret just by presenting its view.
T will not be convinced, since V could have generated the view on his own using the simulator,
or P and V could collude.
V only accepts the proof due to the interaction with P in the ZK proof.
11
ZERO-KNOWLEDGE PROOFS
OF LANGUAGES IN NP
12
Map 3-Coloring from Abel Prize announcement 2021 for Avi Wigderson
Ø Four color theorem (conjectured in 1852, proven with Coq proof assistant in 2005):
Each 2D map can be colored with at most 4 colors.
Ø Deciding if an arbitrary 2D map can be colored with only 3 colors is NP-complete.
Sources: https://youtu.be/0_NK_OkpmUY 15
Graph 3-Coloring
2 3 8
4 7
9
5
3-coloring is NP-complete
⇒ Given a ZK proof for 3-coloring, every language in NP can be proven in ZK!
16
Graph 3-Coloring (2)
P wants to prove in zero-knowledge to V that she knows a valid 3-coloring 𝜙 for graph 𝐺.
P V
𝐺, 𝜙 𝐺
Soundness: If 𝜙 is not a valid 3-coloring, then there is at least one edge 𝑒′ = 𝑖, 𝑗 ∈ 𝐸 such
that 𝜙 𝑖 = 𝜙 𝑗 . V chooses the edge in step 2 at random, so he will detect 𝑒 + with probability
!
≥ . If such an edge is chosen, it is impossible for P’s decommitted values to pass V’s
|,|
verification. If the protocol is repeated 𝑛|𝐸| times, the probability that P can cheat and remain
! $|,|
undetected is negligible: 1 − |,|
≈ 𝑒 -$ ≈ 2.718-$ .
ZK (intuition): Simulator S randomly assigns colors with coloring 𝜙 ∗ to a given graph 𝐺 and
creates commitments: For all 𝑣 ∈ 𝑉: 𝑐𝑜𝑚% = commit 𝜋 𝜙 ∗ 𝑣 , 𝑟% .
S chooses random edge 𝑒 ∗ = (𝑖, 𝑗). If 𝜙 ∗ 𝑖 = 𝜙 ∗ 𝑗 , S rewinds and starts again.
Otherwise, S sets o/ = 𝜋 𝜙 ∗ 𝑖 , 𝑟' and o0 = 𝜋 𝜙 ∗ 𝑗 , 𝑟* and outputs (𝑐𝑜𝑚!, … , 𝑐𝑜𝑚$ , 𝑒 ∗ , 𝑜' , 𝑜* ).
18
SIGMA-PROTOCOLS
19
Camenisch-Stadler Notation
Example: PK 𝜔 ∶ ℎ = 𝑔1
20
Sigma-Protocols
P V
𝑥, 𝜔 𝑎 𝑥
𝑧
21
Definition of Sigma-Protocols
Definition [Damgård10, Definition 1]: A protocol Π is said to be a Sigma-protocol for relation 𝑅 if:
1) Π is of the above 3-move form; and we have
2) Completeness: If P,V follow the protocol on public input 𝑥 and private input ω to P, where
𝑥, 𝜔 ∈ 𝑅, the verifier always accepts; and
3) Special soundness: From any 𝑥 and any pair of accepting conversations on input 𝑥,
(𝑎, 𝑐, 𝑧), (𝑎, 𝑐′, 𝑧′) where 𝑐 ≠ 𝑐′, one can efficiently compute 𝜔 such that 𝑥, 𝜔 ∈ 𝑅; and
4) Special honest-verifier zero-knowledge: There exists a polynomial-time simulator S, which
on input 𝑥 and a random 𝑐 outputs an accepting conversation of the form (𝑎, 𝑐, 𝑧), with the
same probability distribution as conversations between the honest P,V on input 𝑥.
22
Schnorr’s DLOG Protocol [Schnorr89]
Public input: 𝐺, 𝑞, 𝑔 is a cyclic group of prime order 𝑞 generated by 𝑔 in which the DLOG
problem is hard; statistical security parameter 𝜎 ≤ |𝑞|; public key ℎ.
Goal: Prove knowledge of private key 𝜔: PK 𝜔 ∶ ℎ = 𝑔1 .
P V
𝐺, 𝑞, 𝑔 , ℎ = 𝑔& , 𝜔 (𝐺, 𝑞, 𝑔), ℎ
𝑟 ∈ $ ℤ' 𝑎 = 𝑔#
%
𝑐 ∈$ 0,1
𝑧 = 𝑟 + 𝜔𝑐 mod 𝑞 ?
𝑔 ( = 𝑎 ⋅ ℎ)
Proof of knowledge:
• Assume P can answer two different challenges 𝑐 ≠ 𝑐 + with 𝑧 and 𝑧′ for the same 𝑎
" "
• Then, 𝑔 2 = 𝑎 ⋅ ℎ3 and 𝑔 2 = 𝑎 ⋅ ℎ3 .
" " " "
• Thus, 𝑎 = 𝑔 2 ⋅ ℎ-3 = 𝑔 2 ⋅ ℎ-3 and 𝑔 2-2 = ℎ3-3 .
• 𝑐, 𝑧, 𝑐 + , 𝑧 + are known from the protocol
• DLOG4 ℎ = 𝜔 = 𝑧 − 𝑧 + /(𝑐 − 𝑐 + ) mod 𝑞
Conclusion: If P can answer with probability greater than 2-5 then P must know DLOG 𝜔.
This also means: In practice P should make sure to choose a different 𝑎 every time!
24
Schnorr’s DLOG Protocol is a Sigma-Protocol
Completeness: as before.
Special soundness: There exists a knowledge extractor E that given any 𝑥 and pair of
𝑎, 𝑐, 𝑧 and (𝑎, 𝑐′, 𝑧 + ) with 𝑐 ≠ 𝑐 + outputs 𝜔 such that 𝑥, 𝜔 ∈ 𝑅.
Knowledge extractor E for Schnorr’s DLOG protocol:
• Input: x = ((𝐺, 𝑞, 𝑔), ℎ), 𝑎, 𝑐, 𝑧 , (𝑎, 𝑐′, 𝑧′) with 𝑐 ≠ 𝑐′
• Output: 𝜔 = 𝑧 − 𝑧 + /(𝑐 − 𝑐 + ) mod 𝑞
Special honest-verifier ZK: There exists a simulator S that on input 𝑥 and 𝑐 ∈& 0,1 5 outputs an
accepting conversation (𝑎, 𝑐, 𝑧) with the same distribution as a real execution where V sends 𝑐.
Simulator S for Schnorr’s DLOG protocol:
• Input: x = ((𝐺, 𝑞, 𝑔), ℎ), 𝑐
• Choose random last message 𝑧 ∈& ℤ6
• Compute first message 𝑎 = 𝑔 2 /ℎ3
• Output (𝑎, 𝑐, 𝑧)
25
COMPOSITION OF SIGMA-PROTOCOLS
26
Parallel Composition and Adjusting Challenge Lengths in 𝚺-Protocols
Lemma 1 from [Damgård10]: The properties of Sigma-protocols are invariant under parallel
composition, for instance repeating a Sigma-protocol for relation 𝑅 twice in parallel produces a
new Sigma-protocol for 𝑅 with challenge length 2𝜎.
Lemma 2 from [Damgård10]: If a Sigma-protocol for 𝑅 exists, then there exists a Sigma-protocol
for 𝑅 with arbitrary challenge length 𝜎.
27
AND Proofs
28
Example for AND Proof
PK 𝜔 ∶ ℎ7 = 𝑔71 ∧ ℎ! = 𝑔!1 (This can be used to prove Diffie-Hellman Tuples, see exercise.)
𝐺 = 𝑔 is a group of prime order 𝑞 where the DDH problem is hard.
This particular AND proof is sometimes called EQ, since both statements use the same 𝜔.
P V
𝐺, 𝑞, 𝑔 , 𝑔7, 𝑔!, ℎ7 = 𝑔71 , ℎ! = 𝑔!1 , 𝜔 𝐺, 𝑞, 𝑔 , 𝑔7, 𝑔!, ℎ7, ℎ!
𝑐 ∈& 0,1 5
𝑧 = 𝑟 + 𝜔𝑐 mod 𝑞 ?
𝑔'2 = 𝑎' ⋅ ℎ'3 for 𝑖 ∈ {0,1}
Completeness: as before.
29
OR Proofs
P V
𝑥, 𝜔 𝑥
run simulator for statement
where witness is not known 𝑎7, 𝑎!
𝑐 ∈& 0,1 5
𝑐7 ⊕ 𝑐! = 𝑐
complete Sigma-protocols
𝑐7, 𝑐!, 𝑧7, 𝑧! ?
for statement where 𝑐 = 𝑐7 ⊕ 𝑐!
witness is known check 𝑎' , 𝑐' , 𝑧' for 𝑖 ∈ {0,1} 30
OR Proofs (cont.)
31
𝒕-out-of-𝒏 Proofs [CramerDS94]
𝑛
Prove 𝒕-out-of-𝒏 statements 𝑆' without revealing which ones are true: PK 𝜔 ∶ (𝑆!, … , 𝑆$ ) .
𝑡
Let 𝐴 be the set of indices of statements that P knows and 𝐴̅ the ones she does not know.
P V
𝑥, 𝜔 𝑥
• for every 𝑖 ∈ 𝐴,̅ generate 𝑎' , 𝑐' , 𝑧'
using simulator S.
• for every 𝑗 ∈ 𝐴, generate 𝑎* as first
message from the corresponding
𝑎+ , … , 𝑎,
Σ-protocol.
𝑐 ∈$ ℱ
• Interpolate polynomial 𝑓 of degree
𝑛 − 𝑡 through points 𝑖, 𝑐' for 𝑖 ∈ 𝐴̅
and (0, 𝑐).
• For 𝑗 ∈ 𝐴:
• 𝑐* = 𝑓(𝑗) check that 𝑓 has degree 𝑛 − 𝑡
𝑓, 𝑧+ , … , 𝑧,
• compute 𝑧* from the and 𝑓 0 = 𝑐; For 𝑖 ∈ 1, … , 𝑛 :
corresponding Σ-protocol with 𝑐* . check (𝑎' , 𝑐' = 𝑓(𝑖), 𝑧' ). 32
ZK AND NON-INTERACTIVE ZK
FROM SIGMA-PROTOCOLS
33
ZK from Sigma-Protocols
Sigma-protocols assume an honest verifier, i.e., V must choose the challenge 𝑐 independent of
P’s first message 𝑎.
To turn a Sigma-protocol into a ZK proof, V first commits to the challenge 𝑐 before seeing 𝑎.
P V
com=commit(𝑐)
𝑎
open com
34
Non-Interactive ZK for Sigma-Protocols [FiatShamir86, BernhardPW12]
The Fiat-Shamir heuristic turns a Sigma-protocol into a non-interactive ZK proof in the ROM.
For this, we use a random oracle 𝐻 (instantiated with a cryptographic hash function in practice) to
generate the challenge from the first message 𝑎 in the Sigma-protocol.
Example: PK 𝜔 ∶ ℎ = 𝑔1 , where 𝐺 = 𝑔 is a group of prime order 𝑞 where DLOG is hard.
P V
𝐺, 𝑞, 𝑔 , ℎ = 𝑔1 , 𝜔 (𝐺, 𝑞, 𝑔), ℎ
𝑟 ∈& ℤ6
𝑎 = 𝑔8
𝒄 = 𝑯 𝒈, 𝒂, 𝒉
𝑧 = 𝑟 + 𝜔𝑐 mod 𝑞 𝑎, 𝑧 𝒄 = 𝑯 𝒈, 𝒂, 𝒉
?
𝑔 2 = 𝑎 ⋅ ℎ3
• In contrast to the interactive ZK protocols shown before, this one allows for public verification.
• Additionally, a message can be concatenated to the input of 𝐻 to yield a signature scheme. 35
Bibliography
[BernhardPW12] D. Bernhard, O. Pereira, B. Warinschi. How not to prove yourself: pitfalls of the
Fiat-Shamir heuristic and applications to Helios. In ASIACRYPT’12.
[CramerDS94] R. Cramer, I. Damgård, B. Schoenmakers. Proofs of partial knowledge and
simplified design of witness hiding protocols. In CRYPTO‘94.
[CamenischStadler97] Efficient group signature schemes for large groups. In CRYPTO‘97.
[Damgård10] I. Damgård. On Σ-protocols. http://www.cs.au.dk/~ivan/Sigma.pdf
[FiatShamir86] A. Fiat, A. Shamir. How to prove yourself: practical solutions to identification and
signature problems. In CRYPTO‘86.
[Schnorr89] C. P. Schnorr. Efficient identification and signatures for smart cards. In CRYPTO‘89.
36
THANKS FOR YOUR ATTENTION!
37
BONUS MATERIAL
38
Graph Isomorphism
Let 𝐺 = (𝑉9 , 𝐸9 ) and 𝐻 = (𝑉: , 𝐸: ) be two graphs with sets of vertices 𝑉9 and 𝑉: ( V; = V< ) and
sets of edges 𝐸9 and 𝐸: ( E; = E< ).
0 1 A 0 A A
1 D
B C B C
2 C
2 3
D 3 B D
GIP Î NP: Given only 𝐺 and 𝐻, existence of 𝜑 is „hard“ to decide. But, given 𝜑, „easy“ to verify.
Hence, 𝜑 is a proof that G and H are isomorphic.
P V
if 𝑝 = 𝑣: 𝜑 ++ = 𝜑′
𝜑′′
if 𝑝 = 0, 𝑣 = 1: 𝜑 ++ = 𝜑 + • 𝜑 -! ?
if 𝑝 = 1, 𝑣 = 0: 𝜑 ++ = 𝜑 + • 𝜑 𝜑 ++ (𝐺% ) =𝐶
Soundness: If 𝐺7 and 𝐺! are not isomorphic, then 𝐶 = 𝜑′(𝐺= ) is isomorphic to 𝐺= , but not to 𝐺=̅ .
V will accept for 𝑝 = 𝑣, but not for p ≠ 𝑣. Since 𝑣 is chosen at random, the probability that V
!
accepts is at least ½. After 𝑛 repetitions V is convinced with probability 1 − "!.