Documentation

CslibFrontier.Crypto.Computational.ChaumPedersenProtocol

The Chaum–Pedersen protocol with a fair-coin prover, extractor and simulator #

The Chaum–Pedersen protocol for Diffie–Hellman triples ([BS23], Section 19.5.2, Figure 19.7 and Theorem 19.10, pp. 777–778) over a PrimeOrderGroupFamily, as a family indexed by a unary security parameter n and a group description d, with challenges in ZMod q for the group order q. A statement is a triple (u, v, w) of group elements and a witness is β with β • g = v and β • u = w ([BS23], (19.12), in additive notation). Statements and commitments are framed tuples of the family's element encoding, and scalars are binary (chaumPedersenEncoding).

chaumPedersenProbFamily equips the protocol with the fair-coin commitment sampler chaumPedersenCommit, which draws its commitment nonce with sampleExp n d (within statistical distance 1 / 2 ^ n of uniform on ZMod q). Both prover rounds have uniform polynomial-time word realizations (chaumPedersenCommitWord and schnorrRespondBits), and chaumPedersenFamily keeps the exact-uniform ZMod q commitment law (SigmaProtocol.linear) used as the ideal-sampling intermediate step:

Main definitions #

Main results #

Ideal-sampling steps #

References #

The Chaum–Pedersen protocol ([BS23], Section 19.5.2) in the group described by i.2, with challenges in ZMod q. The security parameter i.1 does not change the protocol. The honest prover draws its commitment nonce exactly uniformly on ZMod q at the PMF level, an ideal sampler that no fair-coin machine with a strict polynomial time bound realizes exactly when q is not a power of two; chaumPedersenProbFamily equips the protocol with the fair-coin commitment sampler chaumPedersenCommit.

noncomputable def Cslib.Crypto.PrimeOrderGroupFamily.chaumPedersenCommit (F : PrimeOrderGroupFamily) (i : ℕ × F.Desc) :
ZMod (F.order i.2) → F.Carrier i.2 × F.Carrier i.2 × F.Carrier i.2 → ProbComp ((F.Carrier i.2 × F.Carrier i.2) × ZMod (F.order i.2))

The fair-coin commitment sampler of the Chaum–Pedersen prover ([BS23], Section 19.5.2, Figure 19.7, p. 777): at index (n, d) and statement (u, v, w), sample s with sampleExp n d, read it as r = (s : ZMod q), and return the commitment (r • g, r • u) together with the prover state r.

The Chaum–Pedersen commitment sampler on words: on the index (n, d) and an encoded statement (u, v, w), sample s with sampleExp n d and return the encoded commitment (s • g, s • u) and the binary state (s % q).bits. It certifies chaumPedersenCommit (eval_chaumPedersenCommitWord, isPPTOn_chaumPedersenCommitWord).

The Chaum–Pedersen Sigma protocol ([BS23], Section 19.5.2, Figure 19.7, p. 777) with a fair-coin prover: at index (n, d), the honest prover commits with chaumPedersenCommit (using sampleExp n d), answers a challenge c with r + c * β, and the verifier checks z • g = t₁ + c • v and z • u = t₂ + c • w.

def Cslib.Crypto.PrimeOrderGroupFamily.chaumPedersenEncoding (F : PrimeOrderGroupFamily) :
Protocols.SigmaProtocol.Encoding (ℕ × F.Desc) (fun (i : ℕ × F.Desc) => F.Carrier i.2 × F.Carrier i.2 × F.Carrier i.2) (fun (i : ℕ × F.Desc) => F.Carrier i.2 × F.Carrier i.2) (fun (i : ℕ × F.Desc) => ZMod (F.order i.2)) fun (i : ℕ × F.Desc) => ZMod (F.order i.2)

The word encodings of chaumPedersenFamily: the unary security parameter with the description, statements (u, v, w) and commitments (t₁, t₂) as framed tuples of the family's element encoding, and challenges and responses in binary.

def Cslib.Crypto.PrimeOrderGroupFamily.chaumPedersenExtract (F : PrimeOrderGroupFamily) (i : ℕ × F.Desc) :
F.Carrier i.2 × F.Carrier i.2 × F.Carrier i.2 → F.Carrier i.2 × F.Carrier i.2 → (c z c' z' : ZMod (F.order i.2)) → ZMod (F.order i.2)

The Chaum–Pedersen extractor ([BS23], Theorem 19.10), computed with extractNat: it is (c - c')⁻¹ (z - z') whenever c ≠ c', and reads neither the statement nor the commitment.

noncomputable def Cslib.Crypto.PrimeOrderGroupFamily.chaumPedersenSimulator (F : PrimeOrderGroupFamily) :
Protocols.SigmaProtocol.Simulator (ℕ × F.Desc) (fun (i : ℕ × F.Desc) => F.Carrier i.2 × F.Carrier i.2 × F.Carrier i.2) (fun (i : ℕ × F.Desc) => F.Carrier i.2 × F.Carrier i.2) (fun (i : ℕ × F.Desc) => ZMod (F.order i.2)) fun (i : ℕ × F.Desc) => ZMod (F.order i.2)

The Chaum–Pedersen simulator ([BS23], Theorem 19.10) with fair coins: at index (n, d), on a statement (u, v, w) and a challenge c, sample s with sampleExp n d, read it as the response z = s mod q, and return the commitment (z • g - c • v, z • u - c • w) with z.

The Chaum–Pedersen simulator on words: on the index (n, d), an encoded statement (u, v, w) and a binary challenge c, sample s with sampleExp n d and return the encoding of (s • g - c • v, s • u - c • w) and of s mod q. It is the strict PPT certificate of chaumPedersenSimulator (eval_chaumPedersenSimulateWord).

Special soundness #

The Chaum–Pedersen protocol has efficient special soundness ([BS23], Theorem 19.10 with Definition 19.4).

The fair-coin Chaum–Pedersen protocol has efficient special soundness ([BS23], Theorem 19.10 with Definition 19.4).

Fair-coin prover completeness and efficiency #

theorem Cslib.Crypto.PrimeOrderGroupFamily.chaumPedersenProbFamily_complete (F : PrimeOrderGroupFamily) (i : ℕ × F.Desc) :
(F.chaumPedersenProbFamily i).Complete fun (β : ZMod (F.order i.2)) (x : F.Carrier i.2 × F.Carrier i.2 × F.Carrier i.2) => match x with | (u, v, w) => β • F.generator i.2 = v ∧ β • u = w

Completeness of the fair-coin Chaum–Pedersen protocol ([BS23], Theorem 19.10 with Definition 19.3): for every valid witness-statement pair (β, (u, v, w)) and challenge c, every honest transcript of chaumPedersenProbFamily is accepting.

On an encoded statement, chaumPedersenCommitWord computes the encoded commitment and scalar state of chaumPedersenCommit.

schnorrRespondBits (computableInPolyTime_schnorrRespondBits) computes the response step of chaumPedersenProbFamily on encodings.

Special HVZK #

chaumPedersenSimulator realizes the perfect Chaum–Pedersen simulator linearSimulate ([BS23], Theorem 19.10) up to statistical distance 1 / 2 ^ n at security parameter n.

Ideal-sampling step toward [BS23], Theorem 19.10 (special HVZK, Definition 19.5), not the cited result: against the honest prover of chaumPedersenFamily, which draws its commitment nonce exactly uniformly on ZMod q at the PMF level, linearSimulate is a perfect simulator, and the strict PPT simulator chaumPedersenSimulator realizes it with statistical error 1 / 2 ^ n at security parameter n. Consumed by closeTo_transcript_chaumPedersenProbFamily_simulator and advantage_chvzkGame_chaumPedersenProbFamily_le for the fair-coin prover chaumPedersenProbFamily.

theorem Cslib.Crypto.PrimeOrderGroupFamily.accepts_chaumPedersenSimulator (F : PrimeOrderGroupFamily) (i : ℕ × F.Desc) (y : F.Carrier i.2 × F.Carrier i.2 × F.Carrier i.2) (c : ZMod (F.order i.2)) :
(F.chaumPedersenSimulator i y c).eval.toOuterMeasure {tz : (fun (i : ℕ × F.Desc) => F.Carrier i.2 × F.Carrier i.2) i × (fun (i : ℕ × F.Desc) => ZMod (F.order i.2)) i | (F.chaumPedersenFamily i).Accepts y tz.1 c tz.2} = 1

Every output of chaumPedersenSimulator is an accepting conversation (acceptance error 0): for every sampled z, (z • g - c • v) + c • v = z • g and (z • u - c • w) + c • w = z • u.

theorem Cslib.Crypto.PrimeOrderGroupFamily.computationalSpecialHVZK_chaumPedersen_ideal (F : PrimeOrderGroupFamily) (setup : ℕ → PMF F.Desc) :
Protocols.SigmaProtocol.ComputationalSpecialHVZK F.chaumPedersenFamily (fun (i : ℕ × F.Desc) (β : ZMod (F.order i.2)) (x : F.Carrier i.2 × F.Carrier i.2 × F.Carrier i.2) => match x with | (u, v, w) => β • F.generator i.2 = v ∧ β • u = w) F.chaumPedersenEncoding (fun (i : ℕ × F.Desc) => F.encScalar i.2) (fun (n : ℕ) => PMF.map (fun (x : F.Desc) => (n, x)) (setup n)) F.chaumPedersenSimulator fun (x : ℕ × F.Desc) => 0

Ideal-sampling step toward [BS23], Theorem 19.10 with Definition 20.6 (special computational HVZK), not the cited result: Experiment 0 of Attack Game 20.4 runs the honest prover of chaumPedersenFamily, which draws its commitment nonce exactly uniformly on ZMod q at the PMF level, and against it the strict PPT simulator chaumPedersenSimulator satisfies Definition 20.6 with zero acceptance error (δ = fun _ => 0) over any group-description setup setup : ℕ → PMF F.Desc paired with the security parameter. Consumed by computationalSpecialHVZK_chaumPedersen for the fair-coin prover chaumPedersenProbFamily.

On every valid witness-statement pair (β, (u, v, w)) and challenge c, the honest transcript of the fair-coin chaumPedersenProbFamily and the output of the strict PPT simulator chaumPedersenSimulator are within statistical distance 2 / 2 ^ n (1 / 2 ^ n from the prover's sampleExp commitment nonce and 1 / 2 ^ n from the simulator's sampleExp response; [BS23], Theorem 19.10 with Definition 19.5, in the strict-PPT fair-coin model). Derived from efficientSpecialHVZK_chaumPedersen_ideal via closeTo_transcript_linearProbFamily_simulator.

theorem Cslib.Crypto.PrimeOrderGroupFamily.advantage_chvzkGame_chaumPedersenProbFamily_le (F : PrimeOrderGroupFamily) {σ : Type} (setup : ℕ → PMF F.Desc) (A : Protocols.SigmaProtocol.CHVZKAdversary (ℕ × F.Desc) (fun (i : ℕ × F.Desc) => ZMod (F.order i.2)) (fun (i : ℕ × F.Desc) => F.Carrier i.2 × F.Carrier i.2 × F.Carrier i.2) (fun (i : ℕ × F.Desc) => F.Carrier i.2 × F.Carrier i.2) (fun (i : ℕ × F.Desc) => ZMod (F.order i.2)) (fun (i : ℕ × F.Desc) => ZMod (F.order i.2)) σ) (n : ℕ) :
(Protocols.SigmaProtocol.chvzkRealGame F.chaumPedersenProbFamily (fun (i : ℕ × F.Desc) (β : ZMod (F.order i.2)) (x : F.Carrier i.2 × F.Carrier i.2 × F.Carrier i.2) => match x with | (u, v, w) => β • F.generator i.2 = v ∧ β • u = w) (fun (m : ℕ) => PMF.map (fun (x : F.Desc) => (m, x)) (setup m)) A n).advantage (Protocols.SigmaProtocol.chvzkSimGame (fun (i : ℕ × F.Desc) (β : ZMod (F.order i.2)) (x : F.Carrier i.2 × F.Carrier i.2 × F.Carrier i.2) => match x with | (u, v, w) => β • F.generator i.2 = v ∧ β • u = w) (fun (m : ℕ) => PMF.map (fun (x : F.Desc) => (m, x)) (setup m)) F.chaumPedersenSimulator A n) ≤ 2 / 2 ^ n

In Attack Game 20.4 (chvzkRealGame vs chvzkSimGame), the fair-coin Chaum–Pedersen prover chaumPedersenProbFamily and the strict PPT simulator chaumPedersenSimulator differ in distinguishing advantage by at most 2 / 2 ^ n against every adversary (including computationally unbounded ones). Derived from efficientSpecialHVZK_chaumPedersen_ideal via advantage_chvzkGame_linearProbFamily_le.

theorem Cslib.Crypto.PrimeOrderGroupFamily.computationalSpecialHVZK_chaumPedersen (F : PrimeOrderGroupFamily) (setup : ℕ → PMF F.Desc) :
Protocols.SigmaProtocol.ComputationalSpecialHVZK F.chaumPedersenProbFamily (fun (i : ℕ × F.Desc) (β : ZMod (F.order i.2)) (x : F.Carrier i.2 × F.Carrier i.2 × F.Carrier i.2) => match x with | (u, v, w) => β • F.generator i.2 = v ∧ β • u = w) F.chaumPedersenEncoding (fun (i : ℕ × F.Desc) => F.encScalar i.2) (fun (n : ℕ) => PMF.map (fun (x : F.Desc) => (n, x)) (setup n)) F.chaumPedersenSimulator fun (x : ℕ × F.Desc) => 0

The fair-coin Chaum–Pedersen protocol satisfies computational special HVZK ([BS23], Theorem 19.10, Section 19.5.2, p. 777, with Definition 20.6, Section 20.4.2, p. 840): Theorem 19.10 states exact special HVZK (Definition 19.5(ii), under Definition 2.8's negligible-overflow runtime convention, p. 30); in the strict-PPT fair-coin model exact simulation is impossible when q is not a power of two, so Definition 19.5(ii) is relaxed here to the 2 / 2 ^ n statistical form (closeTo_transcript_chaumPedersenProbFamily_simulator) and Definition 20.6. Against the fair-coin honest prover of chaumPedersenProbFamily, the strict PPT simulator chaumPedersenSimulator satisfies Definition 20.6 with exact zero acceptance error (δ = fun _ => 0) over any group-description setup setup : ℕ → PMF F.Desc paired with the security parameter. Derived from computationalSpecialHVZK_chaumPedersen_ideal via computationalSpecialHVZK_linearProbFamily.