Schnorr's Sigma protocol with an efficient prover, verifier, extractor and simulator #
Schnorr's Sigma protocol ([BS23], Example 19.1) 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. Group elements are encoded by the family's encoding and scalars
in binary (schnorrEncoding).
Two protocol families share the same response function, verifier (encodeSchnorrVerify,
efficientVerifier_schnorr, efficientVerifier_schnorrProb) and extractor (schnorrExtract):
schnorrFamilydraws its commitment nonceαₜfrom the exact uniform distribution onZMod qat thePMFlevel (SigmaProtocol.linear), an ideal sampler that no strict-PPT fair-coin machine realizes with zero error whenqis not a power of two. The zero-knowledge theorems forschnorrFamily(efficientSpecialHVZK_schnorr_ideal,computationalSpecialHVZK_schnorr_ideal) are therefore ideal-sampling steps toward Example 19.3, consumed by the fair-coin theorems below.schnorrProbFamilyspecializeslinearProbFamily(SigmaProtocol.linearwith its commitment nonce drawn from fair coins bysampleExp, within1 / 2 ^ nof uniform onZMod q). On encodings, its commitment and state(r • g, r)are sampled in uniform strict PPT byschnorrSigKeyGen(eval_schnorrSigKeyGen_eq_schnorrProbCommit,isPPTOn_schnorrSigKeyGen) and its responser + c * αis computed in deterministic polynomial time byschnorrRespondBits(computableInPolyTime_schnorrRespondBits,schnorrRespondBits_schnorrProbFamily).
Main results for the protocol:
- Completeness (
schnorrProbFamily_complete, Example 19.1 with Definition 19.3): every honest execution ofschnorrProbFamilyon a valid pair(α, u)accepts at every challenge. - Efficient verification and special soundness (
efficientVerifier_schnorrProb,efficientSpecialSoundness_schnorr,efficientSpecialSoundness_schnorrProb, Example 19.2 with Definition 19.4):encodeSchnorrVerifydecidesz • g = t + c • uin polynomial time, andschnorrExtractcomputes(c - c')⁻¹ (z - z')withextractNat, inverting by Fermat's little theorem, in polynomial time (schnorrExtractWord). - Statistical and computational special HVZK for the fair-coin prover
(
closeTo_transcript_schnorrProbFamily_simulator,advantage_chvzkGame_schnorrProbFamily_le,computationalSpecialHVZK_schnorr, Example 19.3 with Definitions 19.5 and 20.6): Example 19.3 states exact special HVZK (Definition 19.5(ii), under Definition 2.8's negligible-overflow runtime convention on p. 30). Because exact simulation onZMod qis impossible in the strict-PPT fair-coin model whenqis not a power of two, Definition 19.5(ii) is relaxed here to2 / 2 ^ nstatistical transcript closeness (1 / 2 ^ nfrom the prover'ssampleExpcommitment nonce and1 / 2 ^ nfromschnorrSimulator'ssampleExpresponse),2 / 2 ^ ndistinguishing advantage in Attack Game 20.4 against arbitrary (even computationally unbounded) adversaries, and Definition 20.6 (ComputationalSpecialHVZK) with exact zero acceptance error (accepts_schnorrSimulator,δ = fun _ => 0), derived without proof duplication through the sharedlinearProbFamilytransfer inCslibFrontier.Crypto.Computational.LinearSigmaProtocol.
Main definitions #
Cslib.Crypto.PrimeOrderGroupFamily.schnorrFamily: Schnorr's Sigma protocol with an idealZMod qcommitment sampler.Cslib.Crypto.PrimeOrderGroupFamily.schnorrProbCommit,Cslib.Crypto.PrimeOrderGroupFamily.schnorrProbFamily: Schnorr's Sigma protocol with a fair-coinsampleExpcommitment sampler.Cslib.Crypto.PrimeOrderGroupFamily.schnorrBitSigma: Schnorr's Sigma protocol in one group withm-bit challenges.Cslib.Crypto.PrimeOrderGroupFamily.schnorrEncoding: its word encodings.Cslib.Crypto.PrimeOrderGroupFamily.schnorrExtract,schnorrExtractWord: the extractor, computed withextractNat, and the word function computing it on encodings.Cslib.Crypto.PrimeOrderGroupFamily.schnorrSampleChallenge: a fair-coin challenge sampler within1 / 2 ^ nof uniform onZMod q.Cslib.Crypto.PrimeOrderGroupFamily.schnorrSimulator: the simulator withsampleExp.Cslib.Crypto.PrimeOrderGroupFamily.schnorrSimulateWord: the simulator as a strict PPT program on words.Cslib.Crypto.PrimeOrderGroupFamily.schnorrIdealKeyGen,Cslib.Crypto.PrimeOrderGroupFamily.schnorrSigKeyGen,Cslib.Crypto.PrimeOrderGroupFamily.schnorrCommitBits,Cslib.Crypto.PrimeOrderGroupFamily.encSchnorrBitsInput,Cslib.Crypto.PrimeOrderGroupFamily.schnorrRespondBits,Cslib.Crypto.PrimeOrderGroupFamily.schnorrRecoverCommitBits,Cslib.Crypto.PrimeOrderGroupFamily.encodeSchnorrVerify: shared bit-encoded Schnorr key generation, commitment, response, commitment recovery, and verification.
Main results #
Cslib.Crypto.PrimeOrderGroupFamily.schnorrProbFamily_complete: completeness ofschnorrProbFamily(Definition 19.3).Cslib.Crypto.PrimeOrderGroupFamily.efficientSpecialSoundness_schnorr,Cslib.Crypto.PrimeOrderGroupFamily.efficientSpecialSoundness_schnorrProb: efficient special soundness (Example 19.2), withschnorrExtractWordas its polynomial-time word function.Cslib.Crypto.PrimeOrderGroupFamily.verifierRealizedBy_encodeSchnorrVerify,Cslib.Crypto.PrimeOrderGroupFamily.efficientVerifier_schnorr,Cslib.Crypto.PrimeOrderGroupFamily.efficientVerifier_schnorrProb: deterministic polynomial-time verification on encodings.Cslib.Crypto.PrimeOrderGroupFamily.eval_schnorrSigKeyGen_eq_schnorrProbCommit,Cslib.Crypto.PrimeOrderGroupFamily.schnorrRespondBits_schnorrProbFamily: word-level realizations ofschnorrProbFamily's commitment and response byschnorrSigKeyGenandschnorrRespondBits.Cslib.Crypto.PrimeOrderGroupFamily.isPPTOn_schnorrSampleChallenge,Cslib.Crypto.PrimeOrderGroupFamily.closeTo_schnorrSampleChallenge: the challenge sampler is strict PPT and1 / 2 ^ n-close to uniform.Cslib.Crypto.PrimeOrderGroupFamily.isPPTOn_schnorrSimulateWord,Cslib.Crypto.PrimeOrderGroupFamily.eval_schnorrSimulateWord,Cslib.Crypto.PrimeOrderGroupFamily.isPPT_schnorrSimulator,Cslib.Crypto.PrimeOrderGroupFamily.simulatorRealizedBy_schnorrSimulator: the word program is strict PPT and computesschnorrSimulatoron encodings, soschnorrSimulatoris strict PPT; it realizes Boneh and Shoup's simulator up to1 / 2 ^ n.Cslib.Crypto.PrimeOrderGroupFamily.accepts_schnorrSimulator: exact acceptance (δ = 0).Cslib.Crypto.PrimeOrderGroupFamily.closeTo_transcript_schnorrProbFamily_simulator,Cslib.Crypto.PrimeOrderGroupFamily.advantage_chvzkGame_schnorrProbFamily_le,Cslib.Crypto.PrimeOrderGroupFamily.computationalSpecialHVZK_schnorr:2 / 2 ^ ntranscript closeness, Attack Game 20.4 advantage bound against arbitrary adversaries, and Definition 20.6 computational special HVZK with zero acceptance error for the fair-coinschnorrProbFamily.Cslib.Crypto.PrimeOrderGroupFamily.eval_schnorrSigKeyGen,Cslib.Crypto.PrimeOrderGroupFamily.closeTo_schnorrSigKeyGen,Cslib.Crypto.PrimeOrderGroupFamily.advantage_bind_schnorrSigKeyGen_le,Cslib.Crypto.PrimeOrderGroupFamily.isPPTOn_schnorrSigKeyGen,Cslib.Crypto.PrimeOrderGroupFamily.computableInPolyTime_schnorrCommitBits,Cslib.Crypto.PrimeOrderGroupFamily.computableInPolyTime_schnorrRespondBits,Cslib.Crypto.PrimeOrderGroupFamily.computableInPolyTime_schnorrRecoverCommitBits,Cslib.Crypto.PrimeOrderGroupFamily.encodeSchnorrVerify_encode,Cslib.Crypto.PrimeOrderGroupFamily.encodeSchnorrVerify_eq_true_iff,Cslib.Crypto.PrimeOrderGroupFamily.computableInPolyTime_encodeSchnorrVerify: strict-PPT and polynomial-time certificates and canonical-key characterizations for the shared bit-encoded Schnorr operations.
Ideal-sampling steps toward Example 19.3 #
Cslib.Crypto.PrimeOrderGroupFamily.efficientSpecialHVZK_schnorr_ideal: efficient special HVZK with statistical error1 / 2 ^ n, against the ideal-sampling prover.Cslib.Crypto.PrimeOrderGroupFamily.computationalSpecialHVZK_schnorr_ideal: computational special HVZK (Definition 20.6) with zero acceptance error, against the ideal-sampling prover.
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Version 0.6, Definition 2.8 (p. 30), Figure 19.1 (p. 756), Definitions 19.3–19.5 and Examples 19.1–19.3 (pp. 772–774), and Attack Game 20.4 and Definition 20.6 (p. 840).
- C.-P. Schnorr, Efficient Signature Generation by Smart Cards
Group elements as words, through the family's injective encoding.
Scalars modulo the group order as binary numbers, through their least nonnegative representatives.
Schnorr's Sigma protocol ([BS23], Example 19.1) 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; see schnorrProbFamily for the fair-coin sampleExp prover.
Fair-coin commitment sampler for Schnorr's Sigma protocol ([BS23], Figure 19.1,
p. 756, and Example 19.1, p. 773): at index i = (n, d), draw s ← F.sampleExp n d, read
r = s mod q, and return (r • g, r).
Schnorr's Sigma protocol ([BS23], Figure 19.1, p. 756, and Example 19.1, p. 773) with
a fair-coin commitment sampler: at index i = (n, d), the honest prover commits with
schnorrProbCommit i (sampleExp n d), responds with r + c * α, and the verifier checks
z • g = t + c • u.
Schnorr's Sigma protocol in F.Carrier d with m-bit challenges BitString m, embedded as
scalars by challengeEmbedding when 2 ^ m ≤ F.order d.
The word encodings of schnorrFamily: the unary security parameter with the description,
group elements by the family's encoding, and challenges and responses in binary.
Schnorr's extractor ([BS23], Example 19.2), computed with extractNat: it is
(c - c')⁻¹ (z - z') whenever c ≠ c'.
Schnorr's extractor on words: on the index (n, d) and the binary challenges and responses of
two conversations, return extractNat of their values in binary. It computes schnorrExtract on
encodings (extractorRealizedBy_schnorrExtractWord).
Schnorr's simulator ([BS23], Example 19.3) with fair coins: at index (n, d), on a
statement u 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 • u with z.
Schnorr's simulator on words ([BS23], Example 19.3): on the index (n, d), an
encoded statement u and a binary challenge c, sample s with sampleExp n d and return the
encodings of s • g - c • u and of s mod q. It is the strict PPT certificate of
schnorrSimulator (eval_schnorrSimulateWord); SchnorrEavesdrop also runs it on arbitrary
challenge words.
Special soundness #
schnorrExtractWord is computable in polynomial time.
schnorrExtractWord computes Schnorr's extractor schnorrExtract on encodings.
Schnorr's protocol has efficient special soundness ([BS23], Example 19.2).
Special HVZK #
A challenge sampler for schnorrFamily with fair coins: at index (n, d), sample s with
sampleExp n d and read it modulo the group order. It is within statistical distance 1 / 2 ^ n
of uniform (closeTo_schnorrSampleChallenge).
Reducing a computed binary natural modulo the group order F.order (d a) and encoding the
remainder in binary is computable in polynomial time.
One machine samples the encoded challenges of schnorrSampleChallenge from the encoded index:
it samples s with sampleExp n d and writes the binary encoding of s mod q.
schnorrSampleChallenge is within statistical distance 1 / 2 ^ n of uniform on
ZMod q.
On an encoded statement and challenge, schnorrSimulateWord computes the encoded output of
schnorrSimulator.
A word-level commitment step k • b + (q - c % q) • x computed with the family's word
operations is computable in polynomial time from polynomial-time components.
schnorrSimulateWord is uniform strict PPT in the security parameter, the description and the
encoded statement and challenge.
schnorrSimulator is uniform strict PPT, certified by schnorrSimulateWord.
schnorrSimulator realizes Schnorr's perfect simulator linearSimulate
([BS23], Example 19.3) up to statistical distance 1 / 2 ^ n at security parameter
n.
Ideal-sampling step toward [BS23], Example 19.3 (special HVZK, Definition 19.5),
not the cited result: against the honest prover of schnorrFamily, which draws its commitment
nonce exactly uniformly on ZMod q at the PMF level, linearSimulate is a perfect simulator,
and the strict PPT simulator schnorrSimulator realizes it with statistical error 1 / 2 ^ n at
security parameter n. Consumed by closeTo_transcript_schnorrProbFamily_simulator and
advantage_chvzkGame_schnorrProbFamily_le for the fair-coin prover schnorrProbFamily.
Every output of schnorrSimulator is an accepting conversation (acceptance error 0): for
every sampled z, (z • g - c • u) + c • u = z • g.
Ideal-sampling step toward [BS23], Example 19.3 with Definition 20.6 (special
computational HVZK), not the cited result: Experiment 0 of Attack Game 20.4 runs the honest prover
of schnorrFamily, which draws its commitment nonce exactly uniformly on ZMod q at the PMF
level, and against it the strict PPT simulator schnorrSimulator 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_schnorr for the fair-coin prover schnorrProbFamily.
Fair-coin schnorrProbFamily completeness, special soundness, and special HVZK #
Completeness of the fair-coin Schnorr Sigma protocol ([BS23], Figure 19.1,
p. 756, and Example 19.1 with Definition 19.3, pp. 772–773): for every valid discrete-logarithm
pair α • g = u and every challenge c, every honest transcript of schnorrProbFamily i is
accepting.
Efficient special soundness of the fair-coin Schnorr Sigma protocol ([BS23],
Example 19.2 with Definition 19.4, p. 773): schnorrProbFamily shares the verifier of
schnorrFamily, so schnorrExtract (schnorrExtractWord) extracts α in polynomial time.
On every valid discrete-logarithm pair (α, u) and challenge c, the honest transcript of the
fair-coin schnorrProbFamily and the output of the strict PPT simulator schnorrSimulator 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], Example 19.3 with
Definition 19.5, p. 774, relaxing Definition 19.5(ii)'s identical transcript distribution to
2 / 2 ^ n statistical closeness in the strict-PPT fair-coin model, cf. Definition 2.8, p. 30).
Derived from efficientSpecialHVZK_schnorr_ideal via
closeTo_transcript_linearProbFamily_simulator.
In Attack Game 20.4 (chvzkRealGame vs chvzkSimGame), the fair-coin Schnorr prover
schnorrProbFamily and the strict PPT simulator schnorrSimulator differ in distinguishing
advantage by at most 2 / 2 ^ n against every adversary (including computationally unbounded
ones). Derived from efficientSpecialHVZK_schnorr_ideal via
advantage_chvzkGame_linearProbFamily_le.
Schnorr's fair-coin Sigma protocol satisfies computational special HVZK ([BS23],
Example 19.3, Section 19.4.2, p. 774, with Definition 20.6, Section 20.4.2, p. 840): Example 19.3
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 on ZMod q 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_schnorrProbFamily_simulator) and Definition 20.6. Against
the fair-coin honest prover of schnorrProbFamily, the strict PPT simulator schnorrSimulator
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_schnorr_ideal via computationalSpecialHVZK_linearProbFamily.
Shared bit-encoded Schnorr key generation, commitment, response, and verification #
Ideal encoded Schnorr key generation for group description d: sample a uniform secret scalar
α : ZMod (F.order d) and output the encoded public key F.encode d (α • F.generator d) paired
with the binary-encoded secret key F.encScalar d α.
Bit-encoded Schnorr key generation at security parameter n and group description d
([BS23], Sections 19.1–19.2): sample an approximate uniform exponent
sk ← F.sampleExp n d and output the encoded public key
F.smul (d, sk, F.encode d (F.generator d)) together with the binary secret key
(sk % F.order d).bits.
Output distribution of schnorrSigKeyGen: the sampled exponent modulo F.order d determines
the encoded public key α • g and secret scalar α.
schnorrSigKeyGen n d is within statistical distance 1 / 2 ^ n of the ideal encoded Schnorr
key generator schnorrIdealKeyGen d.
Replacing schnorrSigKeyGen n d with an exact uniform secret key
α ← PMF.uniformOfFintype (ZMod (F.order d)) changes any Boolean continuation on the encoded
public key and secret scalar (ofBits sk : ZMod (F.order d)) by at most 1 / 2 ^ n.
Schnorr key generation is uniform strict PPT in the unary security parameter and the group description.
Bit-level Schnorr commitment: given (d, r) where r is the binary-encoded commitment
exponent, compute the encoded group element r • g.
On an encoded scalar r : ZMod (F.order d), schnorrCommitBits produces
F.encode d (r • g).
Bit-level Schnorr commitment is computable in polynomial time.
Input (d, a, b, c) of the bit-level Schnorr response and commitment-recovery maps: a group
description d, then three bit words. The description and the first two words are framed.
Bit-level Schnorr response: given (d, sk, r, roOut) where sk is the encoded secret key, r
is the encoded commitment randomness, and roOut is the challenge bit string, compute
((ofBits r + ofBits roOut * ofBits sk) % F.order d).bits.
On encoded scalars α, r : ZMod (F.order d), schnorrRespondBits computes the encoded scalar
r + (ofBits roOut : ZMod (F.order d)) * α.
Bit-level Schnorr response is computable in polynomial time.
Bit-level Schnorr commitment recovery is computable in polynomial time.
On an encoded public key pk = F.encode d u, schnorrRecoverCommitBits computes the encoding
of z • g - roOut • u.
Polynomial-time Schnorr verification on an encoded public key pk, commitment word t,
challenge word c, and response word z: compares t with the canonical commitment recovery
schnorrRecoverCommitBits (d, pk, c, z).
On a canonical encoded public key F.encode d u, encodeSchnorrVerify agrees with the
algebraic Schnorr verification check t = encode (z • g - c • u).
Under a canonical public key F.encode d u, encodeSchnorrVerify accepts if and only if t
equals the canonical encoding of z • g - c • u.
encodeSchnorrVerify is computable in polynomial time.
Composition rule for encodeSchnorrVerify.
The uniform strict PPT program schnorrSigKeyGen (isPPTOn_schnorrSigKeyGen) computes the
encoded commitment and scalar private state of schnorrProbCommit on encodings (the commitment
r • g uses neither the witness α nor the statement u; see [BS23], Figure 19.1,
p. 756, and the remark after Example 19.1, p. 773, that the prover does not use the
statement).
schnorrRespondBits (computableInPolyTime_schnorrRespondBits) computes the response step of
schnorrProbFamily on encodings.
encodeSchnorrVerify realizes the verifier of schnorrFamily on schnorrEncoding.
Schnorr's Sigma protocol has a deterministic polynomial-time verifier.
Schnorr's fair-coin Sigma protocol has a deterministic polynomial-time verifier.