密码学题型as2en

11 阅读7分钟

Task F: Schnorr Protocol Security Analysis

Problem Analysis

Problem Background and Core Challenges

Task F provides an in-depth analysis of the Schnorr Identification Protocol, a standard zero-knowledge Sigma protocol. The goal of this protocol is to prove that the Prover knows the discrete logarithm xx such that the public key y=gxy = g^x.

This problem analyzes the security of the protocol from three perspectives:

  1. Lack of Soundness: When the verifier's random number generator is predictable, a malicious prover can pass verification through a "lucky guess" attack
  2. Special Soundness: Through "rewinding" techniques, we can formally prove knowledge soundness
  3. Real-World Implementation Errors: When the prover reuses the random number kk, an attacker can recover the secret key

Basic Structure of the Schnorr Protocol

Public Parameters:

  • Group GG: A group of large prime order qq with generator gg

Keys:

  • Secret Key (Prover): xZqx \in \mathbb{Z}_q
  • Public Key (Verifier): y=gxy = g^x

Protocol Steps (P ↔ V):

  1. Commit: P selects random kZqk \in \mathbb{Z}_q, computes commitment t=gkt = g^k, and sends tt to V
  2. Challenge: V selects random challenge cZqc \in \mathbb{Z}_q and sends cc to P
  3. Response: P computes response z=k+cx(modq)z = k + c \cdot x \pmod{q} and sends zz to V
  4. Verify: V accepts the proof if and only if the check gztycg^z \equiv t \cdot y^c holds

Correctness Verification: gz=gk+cx=gkgcx=gk(gx)c=tycg^z = g^{k + cx} = g^k \cdot g^{cx} = g^k \cdot (g^x)^c = t \cdot y^c \quad \checkmark

Three Basic Properties of Zero-Knowledge Proofs

  1. Completeness: If the prover knows the secret, an honest verifier always accepts
  2. Soundness: If the prover does not know the secret, the verifier rejects with high probability
  3. Zero-Knowledge: The verifier cannot obtain any information about the secret from the proof process

Problem 1.1: "Lucky Guess" Attack (Lack of Soundness)

Problem Description

Scenario: Malicious prover Mallory does not know the secret xx, but she knows that the verifier's random number generator is weak and always issues the challenge value cc (predictable).

Question (a): Show how Mallory can construct a valid proof transcript (t,c,z)(t, c, z) that passes the verification check gz=tycg^z = t \cdot y^c without knowing xx. Clearly state the order in which Mallory generates zz and tt.

Question (b): Explain why this "lucky guess" attack works in a single interaction.

In-Depth Analysis

Definition of Soundness

Soundness:

  • If the prover does not know the secret, the verifier rejects the proof with high probability
  • Formal: Pr[Verifier acceptsProver doesn’t know secret]ϵ\Pr[\text{Verifier accepts} | \text{Prover doesn't know secret}] \leq \epsilon, where ϵ\epsilon is a negligible function

Importance of Soundness:

  • Ensures that provers without the secret cannot pass verification
  • If Soundness is not satisfied, the protocol is insecure
The Problem of Predictable Challenges

Normal Case:

  • The verifier randomly selects challenge cc, which the prover cannot predict
  • The prover must choose tt in advance, then compute zz based on cc
  • Without knowing xx, it is impossible to compute the correct zz for any arbitrary cc

Case of Predictable Challenge:

  • If challenge cc is predictable (e.g., always a fixed value or can be inferred from some information)
  • The prover can know cc in advance and thus construct a valid proof

Standard Answer

Question (a): Mallory's Attack Method

Mallory's Knowledge:

  • Mallory does not know the secret xx
  • Mallory knows that the verifier's random number generator is weak and always issues challenge value cc (predictable)

Mallory's Attack Steps:

Step 1: Mallory knows challenge cc in advance

  • Since the verifier's random number generator is predictable, Mallory can know the challenge value cc in advance

Step 2: Mallory randomly selects response zz

  • Mallory randomly selects zZqz \leftarrow \mathbb{Z}_q

Step 3: Mallory computes commitment tt

  • Mallory computes: t=gzyct = g^z \cdot y^{-c}
  • This is equivalent to: t=gz(gx)c=gzgcx=gzcxt = g^z \cdot (g^x)^{-c} = g^z \cdot g^{-cx} = g^{z-cx}

Step 4: Mallory sends (t,c,z)(t, c, z) to the verifier

Verification Check: gz=tyc=(gzyc)yc=gzycyc=gzg^z = t \cdot y^c = (g^z \cdot y^{-c}) \cdot y^c = g^z \cdot y^{-c} \cdot y^c = g^z \quad \checkmark

Key Observation:

  • Generation Order: Mallory first selects zz, then computes tt
  • This is opposite to the normal protocol: the normal protocol first selects kk (thus determining tt), then computes zz based on cc
  • Since Mallory knows cc in advance, she can "work backwards": first select zz, then compute tt that makes the verification equation hold
Question (b): Why the "Lucky Guess" Attack Works in a Single Interaction

Philosophical Reasons:

  1. Soundness Depends on Challenge Unpredictability:

    • The proof of Soundness relies on the prover's inability to predict the challenge
    • If the challenge is predictable, the prover can "prepare in advance"
  2. Limitations of Single Interaction:

    • In a single interaction, the verifier only sends the challenge once
    • If the challenge is predictable, the prover can construct a valid proof for this specific challenge
    • The verifier cannot "retry" to detect whether the prover really knows the secret
  3. Possibility of "Working Backwards":

    • Normal protocol: t=gkt = g^k (determined first), z=k+cxz = k + cx (computed later)
    • Attack method: zz (selected first), t=gzyct = g^z \cdot y^{-c} (computed later)
    • Since cc is known, we can "work backwards" to find tt that makes the verification equation hold
  4. Lack of "Knowledge Extraction" Mechanism:

    • In a single interaction, the verifier cannot extract the prover's knowledge
    • If the challenge is predictable, the prover can "forge" a knowledge proof without really knowing the secret

Summary: The "lucky guess" attack works in a single interaction because Soundness depends on the randomness and unpredictability of the challenge. When the challenge is predictable, the prover can construct a valid proof for a specific challenge without knowing the secret.


Problem 1.2: The Rewinding Trap (Special Soundness)

Problem Description

Scenario: To formally prove "Knowledge Soundness", we use a "thought experiment" involving an "Extractor" capable of "rewinding" the prover. The purpose of this test is to ensure the prover is not just "getting lucky".

Scenario Description:

  • A malicious prover is tested by the "rewinding" process
  • The prover outputs commitment tt
  • Then is forced to correctly answer two different challenges

Run A: Challenge c1c_1 yields valid response z1z_1 Run B: Challenge c2c_2 yields valid response z2z_2 (where c1c2c_1 \neq c_2)

Since tt is the same in both runs, this means the hidden random number kk (such that t=gkt = g^k) is also the same.

Question (a): Write down the two verification equations based on the prover's knowledge for Run A and Run B.

Question (b): Using algebraic manipulation (subtraction and modular arithmetic), prove that the Extractor can compute the secret xx using only the public values z1,z2,c1,c2z_1, z_2, c_1, c_2. Derive the formula for xx.

Question (c): Explain, in a single sentence, why this Rewinding process guarantees that any prover who can consistently pass this test must possess the secret xx.

In-Depth Analysis

Concept of Special Soundness

Special Soundness:

  • If a prover can answer two different challenges c1c2c_1 \neq c_2 for the same commitment tt, then the secret can be extracted
  • This is a stronger property than ordinary Soundness: it not only ensures that provers without the secret cannot pass verification, but also guarantees that provers who can pass verification must know the secret (knowledge extraction)
Rewinding Technique

Rewinding Technique:

  • The extractor can "rewind" the prover, using the same commitment tt but sending different challenges
  • If the prover can provide valid responses to two different challenges, the secret can be extracted from the two responses

Why Rewinding is Needed:

  • In a single interaction, the secret cannot be extracted
  • Through rewinding, we can "force" the prover to answer multiple challenges, thus extracting the secret

Standard Answer

Question (a): Two Verification Equations

Run A:

  • Commitment: t=gkt = g^k
  • Challenge: c1c_1
  • Response: z1=k+c1x(modq)z_1 = k + c_1 \cdot x \pmod{q}
  • Verification equation: gz1=tyc1g^{z_1} = t \cdot y^{c_1}

Run B:

  • Commitment: t=gkt = g^k (same as Run A)
  • Challenge: c2c_2 (c2c1c_2 \neq c_1)
  • Response: z2=k+c2x(modq)z_2 = k + c_2 \cdot x \pmod{q}
  • Verification equation: gz2=tyc2g^{z_2} = t \cdot y^{c_2}

Key Observation:

  • Both runs use the same tt and kk
  • But challenges are different: c1c2c_1 \neq c_2
  • Responses are also different: z1z2z_1 \neq z_2
Question (b): Derivation of Formula to Extract Secret xx

Given Conditions:

  • z1=k+c1x(modq)z_1 = k + c_1 \cdot x \pmod{q}
  • z2=k+c2x(modq)z_2 = k + c_2 \cdot x \pmod{q}
  • c1c2c_1 \neq c_2

Derivation Process:

Step 1: Compute z1z2z_1 - z_2 z1z2=(k+c1x)(k+c2x)=c1xc2x=(c1c2)x(modq)z_1 - z_2 = (k + c_1 \cdot x) - (k + c_2 \cdot x) = c_1 \cdot x - c_2 \cdot x = (c_1 - c_2) \cdot x \pmod{q}

Step 2: Solve for xx Since c1c2c_1 \neq c_2, c1c20c_1 - c_2 \neq 0, therefore (c1c2)(c_1 - c_2) has an inverse in Zq\mathbb{Z}_q.

x=(z1z2)(c1c2)1(modq)x = (z_1 - z_2) \cdot (c_1 - c_2)^{-1} \pmod{q}

Verification: x=z1z2c1c2(modq)x = \frac{z_1 - z_2}{c_1 - c_2} \pmod{q}

Extractor's Algorithm:

  1. Run the protocol, obtain (t,c1,z1)(t, c_1, z_1)
  2. Rewind the protocol, use the same tt, send different challenge c2c_2, obtain (t,c2,z2)(t, c_2, z_2)
  3. Compute: x=(z1z2)(c1c2)1(modq)x = (z_1 - z_2) \cdot (c_1 - c_2)^{-1} \pmod{q}

Key Observation:

  • The extractor only needs public values: z1,z2,c1,c2z_1, z_2, c_1, c_2
  • Does not need to know kk (because kk is eliminated in the subtraction)
  • As long as c1c2c_1 \neq c_2, xx can be computed
Question (c): Why Rewinding Guarantees the Prover Must Possess Secret xx

One-Sentence Explanation:

If a prover can answer two different challenges c1c2c_1 \neq c_2 for the same commitment tt, then the secret x=(z1z2)(c1c2)1(modq)x = (z_1 - z_2) \cdot (c_1 - c_2)^{-1} \pmod{q} can be directly computed from the two responses z1,z2z_1, z_2, which means the prover must know xx (or be able to compute xx), otherwise it cannot construct responses that satisfy both verification equations.

Detailed Explanation:

  1. Possibility of Knowledge Extraction:

    • If the prover can pass the rewinding test, the extractor can compute xx
    • This means the prover "possesses" the knowledge (or can compute the knowledge)
  2. Impossibility Argument:

    • If the prover does not know xx, it cannot provide correct responses to arbitrary challenges
    • Even if "lucky" to pass verification once, it cannot provide correct responses to a second different challenge
    • Therefore, a prover who can pass the rewinding test must know xx
  3. Guarantee of Special Soundness:

    • Special Soundness guarantees: provers who can pass verification have extractable knowledge
    • This is stronger than ordinary Soundness: it not only ensures that provers without the secret cannot pass, but also guarantees that provers who can pass must know the secret

Problem 1.3: Real-World Implementation Error (Nonce Reuse)

Problem Description

Scenario: The mathematical extraction proved in Question 1.2 is highly theoretical. However, sometimes a disastrous real-world implementation error causes the exact same extraction to occur naturally.

Consider a lazy prover Peggy who reuses the same random value kk (and thus the same commitment tt) for two separate, independent proofs against different challenges c1c_1 and c2c_2. An attacker Eve observes two complete transcripts:

  • Transcript 1: (t,c1,z1)(t, c_1, z_1)
  • Transcript 2: (t,c2,z2)(t, c_2, z_2)

Question (a): Prove that Eve can recover Peggy's secret key xx using the same algebraic method as in Question 1.2, without needing to "hack" or "rewind time".

Question (b): Explain the difference in who controls the reuse of kk in the following two scenarios, and why one is a feature (Soundness Proof) and the other is a fatal bug (Real-World Attack):

  • Scenario A: The Extractor forcing kk reuse in Question 1.2
  • Scenario B: The Prover accidentally reusing kk in this Question

In-Depth Analysis

Danger of Nonce Reuse

Role of Nonce (Random Number):

  • In the Schnorr protocol, kk is a random number (nonce) used to generate commitment t=gkt = g^k
  • kk must be randomly chosen each time and cannot be reused

Consequences of Nonce Reuse:

  • If kk is reused, two different proofs use the same tt
  • An attacker can observe two transcripts and thus extract the secret
Theoretical Extraction vs. Real-World Attack

Theoretical Extraction (Problem 1.2):

  • The extractor can "rewind" the prover, forcing the use of the same tt
  • This is a theoretical thought experiment used to prove Special Soundness

Real-World Attack (Problem 1.3):

  • The prover herself reuses kk, causing two proofs to use the same tt
  • An attacker only needs to observe two transcripts to extract the secret
  • This is a real attack caused by implementation errors

Standard Answer

Question (a): Eve Recovers Secret Key xx

Eve's Observation:

  • Transcript 1: (t,c1,z1)(t, c_1, z_1), where z1=k+c1x(modq)z_1 = k + c_1 \cdot x \pmod{q}
  • Transcript 2: (t,c2,z2)(t, c_2, z_2), where z2=k+c2x(modq)z_2 = k + c_2 \cdot x \pmod{q} (Note: tt is the same, meaning kk is the same)

Eve's Attack Method:

Step 1: Compute z1z2z_1 - z_2 z1z2=(k+c1x)(k+c2x)=(c1c2)x(modq)z_1 - z_2 = (k + c_1 \cdot x) - (k + c_2 \cdot x) = (c_1 - c_2) \cdot x \pmod{q}

Step 2: Solve for xx Since c1c2c_1 \neq c_2 (two different challenges), c1c20c_1 - c_2 \neq 0, therefore we can compute:

x=(z1z2)(c1c2)1(modq)x = (z_1 - z_2) \cdot (c_1 - c_2)^{-1} \pmod{q}

Verification: This is exactly the same formula as in Problem 1.2!

Key Observation:

  • Eve only needs to observe two transcripts, without "rewinding" or "hacking"
  • Since Peggy reuses kk, the tt in both transcripts is the same
  • Eve can extract xx using exactly the same algebraic method as in Problem 1.2

Practical Calculation Example: Assume q=23q = 23, c1=5c_1 = 5, c2=7c_2 = 7, z1=12z_1 = 12, z2=18z_2 = 18.

x=(1218)(57)1mod23=(6)(2)1mod23=611mod23=66mod23=20x = (12 - 18) \cdot (5 - 7)^{-1} \bmod 23 = (-6) \cdot (-2)^{-1} \bmod 23 = 6 \cdot 11 \bmod 23 = 66 \bmod 23 = 20

where (2)1mod23=11(-2)^{-1} \bmod 23 = 11 (because 221(mod23)-2 \equiv 21 \pmod{23}, 211mod23=1121^{-1} \bmod 23 = 11)

Question (b): Difference Between Two Scenarios

Scenario A: Extractor Forces kk Reuse (Soundness Proof)

Who Controls Reuse:

  • Extractor controls: The extractor forces the prover to use the same commitment tt (thus the same kk) through "rewinding" techniques
  • This is a theoretical thought experiment used to prove Special Soundness

Why It's a Feature:

  1. Theoretical Proof Tool: Rewinding is a tool for formal proofs, not a real attack
  2. Proves Security: By proving "if a prover can pass the rewinding test, then the secret can be extracted", we prove the security of the protocol
  3. Does Not Rely on Implementation Errors: This is part of the protocol design and does not rely on implementation errors

Scenario B: Prover Accidentally Reuses kk (Real-World Attack)

Who Controls Reuse:

  • Prover controls: The prover accidentally reuses the same kk due to implementation errors (laziness, random number generator failure, etc.)
  • This is an error in real-world implementation

Why It's a Fatal Bug:

  1. Real Attack: An attacker can observe two transcripts and directly extract the secret
  2. No Special Ability Needed: The attacker does not need "rewinding" ability, only needs to observe communication
  3. Complete Security Breach: The secret key is completely leaked, and the security of the protocol is completely broken

Comparison Summary:

FeatureScenario A (Extractor Forces Reuse)Scenario B (Prover Accidentally Reuses)
ControllerExtractor (theoretical entity)Prover (real implementation)
PurposeProve protocol securityReal attack
NatureTheoretical tool (feature)Implementation error (fatal bug)
Attacker AbilityNeeds "rewinding" abilityOnly needs to observe communication
ResultProves Special SoundnessComplete security breach

Key Lessons:

  • Nonce reuse is fatal: In real-world implementation, we must ensure that each proof uses a new random number kk
  • Importance of random number generator: Must use a cryptographically secure random number generator
  • Importance of implementation security: Even if the protocol design is secure, implementation errors can lead to complete security breaches

Summary

Key Knowledge Points

  1. Importance of Soundness: The protocol must ensure that provers without the secret cannot pass verification
  2. Importance of Challenge Randomness: Soundness depends on the randomness and unpredictability of challenges
  3. Special Soundness: Through rewinding techniques, we can prove knowledge soundness
  4. Danger of Nonce Reuse: In real-world implementation, reusing random numbers leads to secret leakage

Practical Considerations

  1. Use cryptographically secure random number generators: Ensure each proof uses a new random number
  2. Verify challenge randomness: The verifier must use truly random challenges
  3. Implementation security: Even if the protocol design is secure, implementation errors can lead to security breaches

Protocol Design Principles

  1. Completeness: Honest provers should be able to pass verification
  2. Soundness: Provers without the secret should be rejected
  3. Zero-Knowledge: The verifier should not obtain information about the secret
  4. Knowledge Extraction: Provers who can pass verification should have extractable knowledge (Special Soundness)

Problem 2: Secure Voting Protocol

Problem Background and Core Challenges

Problem 2 designs a secure electronic voting system based on the ElGamal encryption scheme. The protocol needs to satisfy:

  1. Vote Confidentiality: No one can know the content of individual votes
  2. Vote Validity: Each vote must be 0 or 1
  3. Correct Vote Counting: Can correctly count the total votes
  4. Verifiability: Use zero-knowledge proofs to ensure vote validity

Basic Structure of ElGamal Voting Protocol

Public Parameters:

  • Group GG: A cyclic group of prime order qq with generator gg

Keys:

  • Private Key (Tally Center): xZqx \in \mathbb{Z}_q
  • Public Key: h=gxh = g^x

Valid Vote: v{0,1}v \in \{0, 1\}

Vote Encryption:

  • Voter selects random rZqr \in \mathbb{Z}_q
  • Computes ciphertext C=(c1,c2)C = (c_1, c_2), where:
    • c1=grc_1 = g^r
    • c2=hrgvc_2 = h^r \cdot g^v

Problem 2.1: Homomorphic Aggregation

Problem Description

Scenario: There are NN voters who produce individual ciphertexts C1,C2,,CNC_1, C_2, \ldots, C_N. Each ciphertext CiC_i is defined as (c1,i,c2,i)(c_{1,i}, c_{2,i}).

Task: Define an aggregated ciphertext CaggC_{agg} that represents the encryption of the sum of votes Vtotal=i=1NviV_{total} = \sum_{i=1}^N v_i.

Requirement: Show the mathematical derivation.

In-Depth Analysis

Multiplicative Homomorphism of ElGamal

Homomorphic Property of ElGamal Encryption:

  • Given two ciphertexts C1=(c1,1,c2,1)C_1 = (c_{1,1}, c_{2,1}) and C2=(c1,2,c2,2)C_2 = (c_{1,2}, c_{2,2})
  • If C1C_1 encrypts v1v_1 and C2C_2 encrypts v2v_2
  • Then C1C2=(c1,1c1,2,c2,1c2,2)C_1 \cdot C_2 = (c_{1,1} \cdot c_{1,2}, c_{2,1} \cdot c_{2,2}) encrypts v1+v2v_1 + v_2 (in the exponent)

Key Observation:

  • ElGamal's plaintext space is group GG
  • If v{0,1}v \in \{0, 1\}, then gv{g0,g1}={1,g}g^v \in \{g^0, g^1\} = \{1, g\}
  • Ciphertext C=(gr,hrgv)C = (g^r, h^r \cdot g^v) actually encrypts gvg^v
  • The product of multiple ciphertexts yields gv1+v2++vN=gVtotalg^{v_1 + v_2 + \ldots + v_N} = g^{V_{total}}

Standard Answer

Mathematical Derivation

Encryption of Single Vote: For voter ii, vote vi{0,1}v_i \in \{0, 1\}, random number riZqr_i \in \mathbb{Z}_q: Ci=(c1,i,c2,i)=(gri,hrigvi)C_i = (c_{1,i}, c_{2,i}) = (g^{r_i}, h^{r_i} \cdot g^{v_i})

Construction of Aggregated Ciphertext:

Perform component-wise multiplication on all NN ciphertexts:

Cagg=i=1NCi=(i=1Nc1,i,i=1Nc2,i)C_{agg} = \prod_{i=1}^N C_i = \left(\prod_{i=1}^N c_{1,i}, \prod_{i=1}^N c_{2,i}\right)

Compute First Component: c1,agg=i=1Nc1,i=i=1Ngri=gi=1Nri=gRtotalc_{1,agg} = \prod_{i=1}^N c_{1,i} = \prod_{i=1}^N g^{r_i} = g^{\sum_{i=1}^N r_i} = g^{R_{total}}

where Rtotal=i=1NriR_{total} = \sum_{i=1}^N r_i.

Compute Second Component: c2,agg=i=1Nc2,i=i=1N(hrigvi)=i=1Nhrii=1Ngvi=hi=1Nrigi=1Nvi=hRtotalgVtotalc_{2,agg} = \prod_{i=1}^N c_{2,i} = \prod_{i=1}^N (h^{r_i} \cdot g^{v_i}) = \prod_{i=1}^N h^{r_i} \cdot \prod_{i=1}^N g^{v_i} = h^{\sum_{i=1}^N r_i} \cdot g^{\sum_{i=1}^N v_i} = h^{R_{total}} \cdot g^{V_{total}}

Aggregated Ciphertext: Cagg=(c1,agg,c2,agg)=(gRtotal,hRtotalgVtotal)C_{agg} = (c_{1,agg}, c_{2,agg}) = \left(g^{R_{total}}, h^{R_{total}} \cdot g^{V_{total}}\right)

Verification: The aggregated ciphertext CaggC_{agg} has the same form as a single vote encryption:

  • First component: gRtotalg^{R_{total}} (where Rtotal=i=1NriR_{total} = \sum_{i=1}^N r_i is the sum of random numbers)
  • Second component: hRtotalgVtotalh^{R_{total}} \cdot g^{V_{total}} (where Vtotal=i=1NviV_{total} = \sum_{i=1}^N v_i is the total votes)

Therefore, CaggC_{agg} indeed encrypts gVtotalg^{V_{total}}, i.e., the encryption of the total votes.


Problem 2.2: Decryption

Problem Description

Describe the procedure the tally center uses to recover the integer value VtotalV_{total} from CaggC_{agg} using the secret key xx. Explain why this decryption method is computationally feasible in the context of an election.

In-Depth Analysis

ElGamal Decryption Process

Standard ElGamal Decryption:

  • Given ciphertext C=(c1,c2)=(gr,hrgv)C = (c_1, c_2) = (g^r, h^r \cdot g^v)
  • Using private key xx (where h=gxh = g^x) to decrypt:
    • Compute shared secret: s=c1x=(gr)x=grx=hrs = c_1^x = (g^r)^x = g^{rx} = h^r
    • Recover plaintext: gv=c2s=hrgvhr=gvg^v = \frac{c_2}{s} = \frac{h^r \cdot g^v}{h^r} = g^v

Recovering vv from gvg^v:

  • If v{0,1}v \in \{0, 1\}, then gv{g0,g1}={1,g}g^v \in \{g^0, g^1\} = \{1, g\}
  • Can recover vv by simple comparison:
    • If gv=1g^v = 1, then v=0v = 0
    • If gv=gg^v = g, then v=1v = 1

For Aggregated Ciphertext:

  • After decryption, we get gVtotalg^{V_{total}}
  • Need to recover VtotalV_{total} from gVtotalg^{V_{total}}
  • This requires computing discrete logarithm, but VtotalV_{total} has a small range (0VtotalN0 \leq V_{total} \leq N)

Standard Answer

Decryption Process

Step 1: Compute Shared Secret s=c1,aggx=(gRtotal)x=gxRtotal=hRtotals = c_{1,agg}^x = (g^{R_{total}})^x = g^{x \cdot R_{total}} = h^{R_{total}}

Step 2: Recover gVtotalg^{V_{total}} gVtotal=c2,aggs=hRtotalgVtotalhRtotal=gVtotalg^{V_{total}} = \frac{c_{2,agg}}{s} = \frac{h^{R_{total}} \cdot g^{V_{total}}}{h^{R_{total}}} = g^{V_{total}}

Step 3: Compute Discrete Logarithm to Recover VtotalV_{total} Vtotal=logg(gVtotal)V_{total} = \log_g(g^{V_{total}})

Computational Feasibility Analysis:

  1. VtotalV_{total} has a small range:

    • Vtotal=i=1NviV_{total} = \sum_{i=1}^N v_i, where each vi{0,1}v_i \in \{0, 1\}
    • Therefore 0VtotalN0 \leq V_{total} \leq N
    • In elections, NN is usually a manageable number (e.g., thousands to millions)
  2. Brute force search is feasible:

    • Since VtotalV_{total} has a small range, we can use brute force search:
      • For i=0,1,2,,Ni = 0, 1, 2, \ldots, N:
        • Compute gig^i
        • If gi=gVtotalg^i = g^{V_{total}}, then Vtotal=iV_{total} = i
    • Time complexity: O(N)O(N), which is feasible for reasonable values of NN (e.g., N106N \leq 10^6)
  3. No need for general discrete logarithm algorithms:

    • General discrete logarithm algorithms (such as number field sieve) are computationally hard for large prime-order groups
    • But since VtotalV_{total} has a small range, we don't need to use these algorithms
    • Simple brute force search is sufficient

Summary: This decryption method is computationally feasible in the election context because the total vote count VtotalV_{total} is bounded by the number of voters NN, and can be recovered using simple brute force search in polynomial time.


Problem 2.3: Zero-Knowledge Proof (Sigma Protocol)

Problem Description

A malicious voter might attempt to encrypt a value other than 0 or 1 (e.g., v=5v = 5) to manipulate the outcome. To prevent this, every voter must provide a zero-knowledge proof that their ciphertext C=(c1,c2)C = (c_1, c_2) encrypts either 0 or 1, without revealing which one.

Design a Sigma protocol (an interactive 3-move protocol) for this purpose.

Hint: Formulate this as an OR-proof showing that (g,h,c1,c2)(g, h, c_1, c_2) is a Diffie-Hellman tuple OR (g,h,c1,c2g1)(g, h, c_1, c_2 \cdot g^{-1}) is a Diffie-Hellman tuple.

In-Depth Analysis

Diffie-Hellman Tuple

Definition of Diffie-Hellman Tuple:

  • A quadruple (g,h,A,B)(g, h, A, B) is a Diffie-Hellman tuple if there exists rr such that A=grA = g^r and B=hrB = h^r
  • Equivalently, loggA=loghB\log_g A = \log_h B

In the Voting Protocol:

  • Ciphertext C=(c1,c2)=(gr,hrgv)C = (c_1, c_2) = (g^r, h^r \cdot g^v)
  • If v=0v = 0, then c2=hrg0=hrc_2 = h^r \cdot g^0 = h^r, so (g,h,c1,c2)=(g,h,gr,hr)(g, h, c_1, c_2) = (g, h, g^r, h^r) is a Diffie-Hellman tuple
  • If v=1v = 1, then c2=hrg1=hrgc_2 = h^r \cdot g^1 = h^r \cdot g, so c2g1=hrc_2 \cdot g^{-1} = h^r, thus (g,h,c1,c2g1)=(g,h,gr,hr)(g, h, c_1, c_2 \cdot g^{-1}) = (g, h, g^r, h^r) is a Diffie-Hellman tuple
OR Proof

Goal of OR Proof:

  • The prover wants to prove: knows rr such that (g,h,c1,c2)(g, h, c_1, c_2) is a Diffie-Hellman tuple, OR knows rr such that (g,h,c1,c2g1)(g, h, c_1, c_2 \cdot g^{-1}) is a Diffie-Hellman tuple
  • But does not reveal which one

Standard Answer

Sigma Protocol Design

Protocol Setup:

  • Public input: (g,h,c1,c2)(g, h, c_1, c_2)
  • Prover's secret: rr (such that c1=grc_1 = g^r)
  • Prover's goal: Prove v{0,1}v \in \{0, 1\}, i.e.:
    • Case 1: v=0v = 0, then (g,h,c1,c2)(g, h, c_1, c_2) is a Diffie-Hellman tuple
    • Case 2: v=1v = 1, then (g,h,c1,c2g1)(g, h, c_1, c_2 \cdot g^{-1}) is a Diffie-Hellman tuple

Protocol Steps:

Step 1: Commit

The prover needs to generate commitments for both cases:

For the true case (assuming v=0v = 0, i.e., (g,h,c1,c2)(g, h, c_1, c_2) is a Diffie-Hellman tuple):

  • The prover knows rr such that c1=grc_1 = g^r and c2=hrc_2 = h^r
  • The prover selects random k0Zqk_0 \leftarrow \mathbb{Z}_q
  • Computes commitments: a0=gk0a_0 = g^{k_0}, b0=hk0b_0 = h^{k_0}
  • Sends (a0,b0)(a_0, b_0) to the verifier

For the simulated case (v=1v = 1 case):

  • The prover does not know rr' such that c1=grc_1 = g^{r'} and c2g1=hrc_2 \cdot g^{-1} = h^{r'}
  • The prover selects random k1Zqk_1 \leftarrow \mathbb{Z}_q and random challenge c1Zqc_1 \leftarrow \mathbb{Z}_q
  • Computes simulated response: z1Zqz_1 \leftarrow \mathbb{Z}_q
  • Computes simulated commitment: a1=gz1c1c1a_1 = g^{z_1} \cdot c_1^{-c_1}, b1=hz1(c2g1)c1b_1 = h^{z_1} \cdot (c_2 \cdot g^{-1})^{-c_1}
  • Sends (a1,b1)(a_1, b_1) to the verifier

Step 2: Challenge

The verifier selects random challenge cZqc \leftarrow \mathbb{Z}_q and sends it to the prover.

Step 3: Response

The prover needs to distribute the challenge:

For the true case (v=0v = 0):

  • The prover sets c0=cc1(modq)c_0 = c - c_1 \pmod{q}
  • Computes response: z0=k0+c0r(modq)z_0 = k_0 + c_0 \cdot r \pmod{q}
  • Sends (c0,z0,c1,z1)(c_0, z_0, c_1, z_1) to the verifier

For the simulated case (v=1v = 1):

  • If v=1v = 1, then the prover knows rr such that c1=grc_1 = g^r and c2g1=hrc_2 \cdot g^{-1} = h^r
  • Similarly, the prover will generate a real proof for the v=1v = 1 case and a simulated proof for the v=0v = 0 case

Step 4: Verify

The verifier checks:

  1. Challenge distribution: c0+c1c(modq)c_0 + c_1 \equiv c \pmod{q}

  2. For case 0 ((g,h,c1,c2)(g, h, c_1, c_2) is a Diffie-Hellman tuple):

    • gz0=a0c1c0g^{z_0} = a_0 \cdot c_1^{c_0}
    • hz0=b0c2c0h^{z_0} = b_0 \cdot c_2^{c_0}
  3. For case 1 ((g,h,c1,c2g1)(g, h, c_1, c_2 \cdot g^{-1}) is a Diffie-Hellman tuple):

    • gz1=a1c1c1g^{z_1} = a_1 \cdot c_1^{c_1}
    • hz1=b1(c2g1)c1h^{z_1} = b_1 \cdot (c_2 \cdot g^{-1})^{c_1}

If all checks pass, the verifier accepts the proof.

Protocol Summary:

Complete Protocol Flow:

  1. P → V: (a0,b0,a1,b1)(a_0, b_0, a_1, b_1) (commitments for both cases)

  2. V → P: cc (random challenge)

  3. P → V: (c0,z0,c1,z1)(c_0, z_0, c_1, z_1) (challenge distribution and responses)

  4. V verifies:

    • c0+c1c(modq)c_0 + c_1 \equiv c \pmod{q}
    • gz0=a0c1c0g^{z_0} = a_0 \cdot c_1^{c_0} and hz0=b0c2c0h^{z_0} = b_0 \cdot c_2^{c_0}
    • gz1=a1c1c1g^{z_1} = a_1 \cdot c_1^{c_1} and hz1=b1(c2g1)c1h^{z_1} = b_1 \cdot (c_2 \cdot g^{-1})^{c_1}

Security:

  • Completeness: If v{0,1}v \in \{0, 1\}, an honest prover can always pass verification
  • Soundness: If v{0,1}v \notin \{0, 1\}, the prover cannot pass verification (because neither case holds)
  • Zero-Knowledge: The verifier cannot know whether vv is 0 or 1 (because both cases provide valid proofs)

Problem 2.4: Non-Interactive Proof

Problem Description

Apply the Fiat-Shamir heuristic to the protocol designed in Question 2.3 to make it non-interactive. Specify how the challenge is computed.

In-Depth Analysis

Fiat-Shamir Heuristic

Fiat-Shamir Heuristic:

  • Converts interactive zero-knowledge proofs into non-interactive zero-knowledge proofs
  • Core idea: Use a hash function instead of the verifier's random challenge
  • Challenge is computed as: c=H(public inputcommitment)c = H(\text{public input} || \text{commitment}), where HH is a hash function (in the random oracle model)

Advantages:

  • No interaction needed, the prover can generate the proof independently
  • The proof can be publicly verified
  • Suitable for blockchain and other scenarios

Security:

  • Under the random oracle model, the security of non-interactive proofs is equivalent to interactive proofs

Standard Answer

Applying Fiat-Shamir Heuristic

Modified Non-Interactive Protocol:

Step 1: Commit (same as interactive protocol)

The prover generates commitments (a0,b0,a1,b1)(a_0, b_0, a_1, b_1).

Step 2: Compute Challenge (using Fiat-Shamir)

The prover computes the challenge: c=H(ghc1c2a0b0a1b1)c = H(g || h || c_1 || c_2 || a_0 || b_0 || a_1 || b_1)

where HH is a cryptographic hash function (e.g., SHA-256), modeled in the random oracle model.

Step 3: Response (same as interactive protocol)

The prover computes responses (c0,z0,c1,z1)(c_0, z_0, c_1, z_1), where c0+c1c(modq)c_0 + c_1 \equiv c \pmod{q}.

Step 4: Verify (same as interactive protocol)

The verifier:

  1. Recomputes the challenge: c=H(ghc1c2a0b0a1b1)c' = H(g || h || c_1 || c_2 || a_0 || b_0 || a_1 || b_1)
  2. Checks c=cc' = c
  3. Performs the same verification checks as the interactive protocol

Complete Non-Interactive Proof:

The prover outputs: π=(a0,b0,a1,b1,c0,z0,c1,z1)\pi = (a_0, b_0, a_1, b_1, c_0, z_0, c_1, z_1)

The verifier verifies:

  1. Computes c=H(ghc1c2a0b0a1b1)c = H(g || h || c_1 || c_2 || a_0 || b_0 || a_1 || b_1)
  2. Checks c0+c1c(modq)c_0 + c_1 \equiv c \pmod{q}
  3. Checks gz0=a0c1c0g^{z_0} = a_0 \cdot c_1^{c_0} and hz0=b0c2c0h^{z_0} = b_0 \cdot c_2^{c_0}
  4. Checks gz1=a1c1c1g^{z_1} = a_1 \cdot c_1^{c_1} and hz1=b1(c2g1)c1h^{z_1} = b_1 \cdot (c_2 \cdot g^{-1})^{c_1}

Key Points:

  1. Challenge computation:

    • The challenge cc is the output of the hash function, depending on all public inputs and commitments
    • This ensures the prover cannot "choose" the challenge (because commitments are already fixed)
  2. Random oracle model:

    • The hash function HH is modeled in the random oracle model
    • This ensures the randomness and unpredictability of the challenge
  3. Non-interactivity:

    • The prover can independently generate a complete proof without interacting with the verifier
    • The proof can be publicly verified, anyone can verify the validity of the proof

Practical Applications:

  • In electronic voting systems, voters can independently generate votes and proofs
  • Proofs can be stored on the blockchain for anyone to verify
  • No online verifier needed, improving system scalability

Summary

Key Knowledge Points

  1. ElGamal Homomorphic Encryption: Supports multiplication operations on ciphertexts, enabling vote aggregation
  2. Homomorphic Aggregation: Through component-wise multiplication of ciphertexts, we can compute the encryption of total votes
  3. Small-Range Discrete Logarithm: When the value range is small, brute force search can be used
  4. OR Proof: Used to prove that vote values are in the allowed range without revealing the specific value
  5. Fiat-Shamir Heuristic: Converts interactive proofs into non-interactive proofs

Practical Considerations

  1. Vote Validity Verification: Must use zero-knowledge proofs to ensure each vote is 0 or 1
  2. Random Number Generation: Voters must use cryptographically secure random number generators
  3. Key Management: The tally center's private key must be securely stored
  4. Verifiability: Non-interactive proofs enable public verification of votes

Problem 3: BLS Digital Signature

Problem Background and Core Challenges

Problem 3 introduces the BLS (Boneh-Lynn-Shacham) digital signature scheme, a digital signature scheme based on bilinear pairings. BLS signatures have advantages such as short signatures and aggregability, and are widely used in blockchain and distributed systems.

Basic Concepts of Bilinear Pairing

Bilinear Pairing:

  • Let G0G_0, G1G_1, and GTG_T be three cyclic groups of prime order qq
  • Let g0g_0 be a generator of G0G_0 and g1g_1 be a generator of G1G_1
  • A bilinear pairing is an efficiently computable function e:G0×G1GTe: G_0 \times G_1 \rightarrow G_T

Properties of Bilinear Pairing:

  1. Bilinearity: For all uG0u \in G_0, vG1v \in G_1, and a,bZqa, b \in \mathbb{Z}_q: e(ua,vb)=e(u,v)abe(u^a, v^b) = e(u, v)^{ab}

  2. Non-degeneracy: e(g0,g1)1 in GTe(g_0, g_1) \neq 1 \text{ in } G_T

Computational co-Diffie-Hellman (co-CDH) Problem

co-CDH Problem:

  • Given: Tuple (g0,g0α,g0β)G0(g_0, g_0^{\alpha}, g_0^{\beta}) \in G_0 and (g1,g1α)G1(g_1, g_1^{\alpha}) \in G_1, where α,βZq\alpha, \beta \in \mathbb{Z}_q are unknown random numbers
  • Problem: Compute g0αβG0g_0^{\alpha\beta} \in G_0
  • Assumption: For appropriate groups, the co-CDH problem is computationally intractable

BLS Signature Scheme

Setup:

  • Groups G0G_0, G1G_1, GTG_T and pairing ee are public parameters
  • Let H:{0,1}G0H: \{0,1\}^* \rightarrow G_0 be a cryptographic hash function (modeled in the random oracle model)

KeyGen:

  • Select random secret αZq\alpha \in \mathbb{Z}_q
  • Private Key (Signing Key): sk=αsk = \alpha
  • Public Key (Verification Key): pk=g1αG1pk = g_1^{\alpha} \in G_1

Sign(sk, m):

  • To sign message mm, compute h=H(m)G0h = H(m) \in G_0
  • Output signature: σ=hαG0\sigma = h^{\alpha} \in G_0

**Verify(pk, m, \sigma)$:

  • Compute h=H(m)h = H(m)
  • Accept if and only if: e(σ,g1)=e(h,pk)e(\sigma, g_1) = e(h, pk)

Problem 3.1: Correctness

Problem Description

Prove that a validly generated BLS signature will always pass the verification equation. Use the bilinearity property of pairing ee.

In-Depth Analysis

Key to Correctness Proof

What needs to be proved:

  • If signature σ=hα\sigma = h^{\alpha} is correctly generated using private key α\alpha for message mm
  • Then the verification equation e(σ,g1)=e(h,pk)e(\sigma, g_1) = e(h, pk) should hold

Using Bilinearity Property:

  • The bilinearity property allows us to "move" exponents inside the pairing
  • This is the key to the proof

Standard Answer

Correctness Proof

Given:

  • Private key: sk=αsk = \alpha
  • Public key: pk=g1αpk = g_1^{\alpha}
  • Message: mm
  • Signature: σ=hα\sigma = h^{\alpha}, where h=H(m)G0h = H(m) \in G_0

Verification Equation: e(σ,g1)=e(h,pk)e(\sigma, g_1) = e(h, pk)

Proof Process:

Left Side: e(σ,g1)=e(hα,g1)e(\sigma, g_1) = e(h^{\alpha}, g_1)

Using Bilinearity Property: According to the bilinearity property e(ua,vb)=e(u,v)abe(u^a, v^b) = e(u, v)^{ab}, we have: e(hα,g1)=e(h,g1)αe(h^{\alpha}, g_1) = e(h, g_1)^{\alpha}

Right Side: e(h,pk)=e(h,g1α)e(h, pk) = e(h, g_1^{\alpha})

Using Bilinearity Property Again: e(h,g1α)=e(h,g1)αe(h, g_1^{\alpha}) = e(h, g_1)^{\alpha}

Therefore: e(σ,g1)=e(hα,g1)=e(h,g1)α=e(h,g1α)=e(h,pk)e(\sigma, g_1) = e(h^{\alpha}, g_1) = e(h, g_1)^{\alpha} = e(h, g_1^{\alpha}) = e(h, pk) \quad \checkmark

Conclusion: A validly generated BLS signature will always pass the verification equation. ✓


Problem 3.2: Security Reduction

Problem Description

We want to prove that if the co-CDH assumption holds, then BLS is secure against Existential Forgery under Chosen Message Attacks (EUF-CMA) in the Random Oracle Model.

Let AA be an adversary that makes at most qHq_H queries to the hash oracle HH and qSq_S queries to the signing oracle, and produces a valid forgery with non-negligible probability.

Construct a simulator BB that uses AA to solve the co-CDH problem.

Hint: BB receives a co-CDH challenge (u0,u0α,u0β)G0(u_0, u_0^{\alpha}, u_0^{\beta}) \in G_0 and (g1,g1α)G1(g_1, g_1^{\alpha}) \in G_1. BB should set the public key pk=g1αpk = g_1^{\alpha}.

Question (a): How should BB program the Random Oracle H(m)H(m) so that it can answer signing queries for some messages (where it knows the discrete log of H(m)H(m)) but embed the challenge term u0βu_0^{\beta} into the hash of the target message mm^*?

Question (b): How does BB extract the solution u0αβu_0^{\alpha\beta} from AA's forgery?

In-Depth Analysis

EUF-CMA Security

Existential Forgery:

  • The adversary can forge a signature for some message (does not need to be a specific message)
  • But the adversary cannot choose which message to forge (during the query phase)

Chosen Message Attack:

  • The adversary can query the signing oracle to obtain signatures for arbitrary messages
  • This simulates real-world scenarios where the adversary can observe legitimate signatures
Security Reduction Approach

Reduction Goal:

  • Assume there exists an adversary AA that can forge BLS signatures with non-negligible probability
  • Construct algorithm BB that uses AA to solve the co-CDH problem
  • If AA succeeds, then BB can solve the co-CDH problem
  • This contradicts the hardness of the co-CDH problem
  • Therefore, BLS is EUF-CMA secure

Key Challenges:

  1. Simulate Signing Oracle: BB needs to be able to answer AA's signing queries, but BB does not know the private key α\alpha
  2. Embed Challenge: BB needs to embed the co-CDH challenge into the hash of some message
  3. Extract Solution: Extract the solution to the co-CDH problem from AA's forgery

Standard Answer

Question (a): Programming the Random Oracle

BB's Strategy:

Step 1: Initialization

  • BB receives co-CDH challenge: (u0,u0α,u0β)G0(u_0, u_0^{\alpha}, u_0^{\beta}) \in G_0 and (g1,g1α)G1(g_1, g_1^{\alpha}) \in G_1
  • BB sets public key: pk=g1αpk = g_1^{\alpha} (this is part of the challenge)
  • BB maintains a hash table TT to store values of H(m)H(m)

Step 2: Programming Random Oracle H(m)H(m)

For each hash query mim_i (i=1,2,,qHi = 1, 2, \ldots, q_H):

  1. If mim_i is a message for signing query (BB needs to be able to generate signatures):

    • BB randomly selects siZqs_i \leftarrow \mathbb{Z}_q
    • BB sets: H(mi)=u0siH(m_i) = u_0^{s_i} (where u0u_0 is the generator of G0G_0, from the challenge)
    • BB stores (mi,si,H(mi))(m_i, s_i, H(m_i)) in table TT
    • When AA queries signature for mim_i, BB computes: σi=(u0α)si=u0αsi\sigma_i = (u_0^{\alpha})^{s_i} = u_0^{\alpha s_i}
    • Key: BB has u0αu_0^{\alpha} (from the challenge), so can compute σi=(u0α)si\sigma_i = (u_0^{\alpha})^{s_i}
  2. If mim_i is the target message mm^* (BB hopes AA will forge this message):

    • BB sets: H(m)=u0βG0H(m^*) = u_0^{\beta} \in G_0
    • BB stores (m,,u0β)(m^*, \bot, u_0^{\beta}) in table TT (\bot indicates unknown discrete logarithm)
    • Key Observation: BB does not know the discrete logarithm of H(m)H(m^*), but this is part of the challenge

Verification of Signature Validity: e(σi,g1)=e(u0αsi,g1)=e(u0,g1)αsie(\sigma_i, g_1) = e(u_0^{\alpha s_i}, g_1) = e(u_0, g_1)^{\alpha s_i} e(H(mi),pk)=e(u0si,g1α)=e(u0,g1)siα=e(u0,g1)αsie(H(m_i), pk) = e(u_0^{s_i}, g_1^{\alpha}) = e(u_0, g_1)^{s_i \alpha} = e(u_0, g_1)^{\alpha s_i}

Therefore, e(σi,g1)=e(H(mi),pk)e(\sigma_i, g_1) = e(H(m_i), pk), signature is valid! ✓

For Target Message mm^*:

  • BB sets: H(m)=u0βH(m^*) = u_0^{\beta} (this is part of the challenge)
  • BB does not know the discrete logarithm of H(m)H(m^*), so cannot generate a signature for mm^*
  • This forces AA to forge the signature for mm^*
Question (b): Extracting Solution from Forgery

AA's Forgery:

  • AA outputs forgery (m,σ)(m^*, \sigma^*), where mm^* is a message that AA has not queried for signature
  • Forgery satisfies: e(σ,g1)=e(H(m),pk)=e(u0β,g1α)e(\sigma^*, g_1) = e(H(m^*), pk) = e(u_0^{\beta}, g_1^{\alpha})

BB Extracts Solution:

Step 1: Verify Forgery Validity e(σ,g1)=e(u0β,g1α)e(\sigma^*, g_1) = e(u_0^{\beta}, g_1^{\alpha})

Step 2: Use Bilinearity Property e(σ,g1)=e(u0β,g1α)=e(u0,g1)βαe(\sigma^*, g_1) = e(u_0^{\beta}, g_1^{\alpha}) = e(u_0, g_1)^{\beta \alpha}

Step 3: Extract u0αβu_0^{\alpha\beta}

Since e(σ,g1)=e(u0β,g1α)e(\sigma^*, g_1) = e(u_0^{\beta}, g_1^{\alpha}), and the pairing is non-degenerate, we have: σ=u0αβ\sigma^* = u_0^{\alpha\beta}

Verification: e(σ,g1)=e(u0αβ,g1)=e(u0,g1)αβe(\sigma^*, g_1) = e(u_0^{\alpha\beta}, g_1) = e(u_0, g_1)^{\alpha\beta} e(u0β,g1α)=e(u0,g1)βα=e(u0,g1)αβe(u_0^{\beta}, g_1^{\alpha}) = e(u_0, g_1)^{\beta\alpha} = e(u_0, g_1)^{\alpha\beta}

Therefore, σ=u0αβ\sigma^* = u_0^{\alpha\beta} is the solution to the co-CDH problem.

BB's Output:

  • BB outputs σ\sigma^* as the solution u0αβu_0^{\alpha\beta} to the co-CDH problem

Success Probability:

  • If AA succeeds with probability ϵ\epsilon, and mm^* is the target message chosen by AA (probability at least 1/qH1/q_H), then BB solves the co-CDH problem with probability at least ϵ/qH\epsilon/q_H
  • If ϵ\epsilon is non-negligible, then ϵ/qH\epsilon/q_H is also non-negligible (since qHq_H is polynomial)

Conclusion:

  • If there exists an adversary AA that can forge BLS signatures with non-negligible probability, then there exists an algorithm BB that can solve the co-CDH problem with non-negligible probability
  • This contradicts the hardness of the co-CDH problem
  • Therefore, BLS is EUF-CMA secure under the co-CDH assumption and the random oracle model

Problem 3.3: Signature Aggregation

Problem Description

One of the most powerful features of BLS is non-interactive aggregation. Suppose we have nn users with public keys pk1,,pknpk_1, \ldots, pk_n. Each user ii signs a distinct message mim_i to produce signature σi\sigma_i.

The aggregate signature is computed as σagg=i=1nσi\sigma_{agg} = \prod_{i=1}^n \sigma_i (computed in group G0G_0).

Write down the verification equation for the aggregate signature σagg\sigma_{agg} given the set of public keys {pk1,,pkn}\{pk_1, \ldots, pk_n\} and messages {m1,,mn}\{m_1, \ldots, m_n\}. Prove that the verification equation holds if all individual signatures are valid.

In-Depth Analysis

Advantages of Signature Aggregation

Non-Interactive Aggregation:

  • Multiple signatures can be aggregated into one signature without interaction between signers
  • The aggregate signature has the same size as a single signature
  • Can efficiently batch verify multiple signatures

Application Scenarios:

  • Multi-signatures in blockchain
  • Batch verification in distributed systems
  • Reduce storage and transmission overhead

Standard Answer

Verification Equation for Aggregate Signature

Given:

  • nn users' public keys: pk1,,pknpk_1, \ldots, pk_n, where pki=g1αipk_i = g_1^{\alpha_i} (user ii's private key is αi\alpha_i)
  • nn messages: m1,,mnm_1, \ldots, m_n
  • Aggregate signature: σagg=i=1nσi\sigma_{agg} = \prod_{i=1}^n \sigma_i, where σi=H(mi)αi\sigma_i = H(m_i)^{\alpha_i}

Verification Equation: e(σagg,g1)=i=1ne(H(mi),pki)e(\sigma_{agg}, g_1) = \prod_{i=1}^n e(H(m_i), pk_i)

Equivalent Form (using bilinearity property of pairing): e(σagg,g1)=i=1ne(H(mi),g1αi)e(\sigma_{agg}, g_1) = \prod_{i=1}^n e(H(m_i), g_1^{\alpha_i})

Correctness Proof

Assumption: All individual signatures σi\sigma_i are valid, i.e., for each ii: e(σi,g1)=e(H(mi),pki)e(\sigma_i, g_1) = e(H(m_i), pk_i)

Proving the Verification Equation for Aggregate Signature:

Left Side: e(σagg,g1)=e(i=1nσi,g1)e(\sigma_{agg}, g_1) = e\left(\prod_{i=1}^n \sigma_i, g_1\right)

Using Bilinearity Property: Since the pairing is bilinear, for the product of group elements, we have: e(i=1nσi,g1)=i=1ne(σi,g1)e\left(\prod_{i=1}^n \sigma_i, g_1\right) = \prod_{i=1}^n e(\sigma_i, g_1)

Using Validity of Individual Signatures: i=1ne(σi,g1)=i=1ne(H(mi),pki)\prod_{i=1}^n e(\sigma_i, g_1) = \prod_{i=1}^n e(H(m_i), pk_i)

Right Side: i=1ne(H(mi),pki)\prod_{i=1}^n e(H(m_i), pk_i)

Therefore: e(σagg,g1)=i=1ne(σi,g1)=i=1ne(H(mi),pki)e(\sigma_{agg}, g_1) = \prod_{i=1}^n e(\sigma_i, g_1) = \prod_{i=1}^n e(H(m_i), pk_i) \quad \checkmark

Conclusion: If all individual signatures are valid, then the verification equation for the aggregate signature holds. ✓

Detailed Derivation (using bilinearity property):

For each ii, since σi=H(mi)αi\sigma_i = H(m_i)^{\alpha_i} and pki=g1αipk_i = g_1^{\alpha_i}: e(σi,g1)=e(H(mi)αi,g1)=e(H(mi),g1)αi=e(H(mi),g1αi)=e(H(mi),pki)e(\sigma_i, g_1) = e(H(m_i)^{\alpha_i}, g_1) = e(H(m_i), g_1)^{\alpha_i} = e(H(m_i), g_1^{\alpha_i}) = e(H(m_i), pk_i)

Therefore: e(σagg,g1)=e(i=1nH(mi)αi,g1)=i=1ne(H(mi)αi,g1)=i=1ne(H(mi),pki)e(\sigma_{agg}, g_1) = e\left(\prod_{i=1}^n H(m_i)^{\alpha_i}, g_1\right) = \prod_{i=1}^n e(H(m_i)^{\alpha_i}, g_1) = \prod_{i=1}^n e(H(m_i), pk_i)


Problem 3.4: Rogue Public Key Attack

Problem Description

Consider the special case where multiple users sign the same message mm. The verification equation simplifies significantly.

Question 1: Write down the simplified verification equation for an aggregate signature σagg\sigma_{agg} on a single message mm verified against public keys pk1,,pknpk_1, \ldots, pk_n.

Question 2: Suppose Alice has a public key pkApk_A. An adversary wants to forge an aggregate signature that appears to come from both Alice and the Adversary on a message mm. The adversary can choose his own public key pkadvpk_{adv} arbitrarily.

Show how the adversary can choose a specific pkadvpk_{adv} (as a function of pkApk_A) and generate a valid aggregate signature σagg\sigma_{agg} for the set of keys {pkA,pkadv}\{pk_A, pk_{adv}\} on message mm, without knowing Alice's secret key.

Question 3: Briefly propose a simple countermeasure to prevent this attack.

In-Depth Analysis

Same Message Case

When All Messages Are the Same:

  • m1=m2==mn=mm_1 = m_2 = \ldots = m_n = m
  • H(m1)=H(m2)==H(mn)=H(m)=hH(m_1) = H(m_2) = \ldots = H(m_n) = H(m) = h
  • The verification equation can be simplified
Rogue Public Key Attack

Attack Scenario:

  • The adversary can freely choose their own public key
  • The adversary wants to forge an aggregate signature that appears to come from Alice and the adversary
  • The adversary does not know Alice's private key

Attack Method:

  • The adversary can choose pkadvpk_{adv} to make the verification equation easier to satisfy
  • By carefully choosing pkadvpk_{adv}, the adversary can "cancel out" the part that requires Alice's signature

Standard Answer

Question 1: Simplified Verification Equation

When All Messages Are the Same (m1=m2==mn=mm_1 = m_2 = \ldots = m_n = m):

Let h=H(m)G0h = H(m) \in G_0.

Aggregate Signature: σagg=i=1nσi=i=1nhαi=hi=1nαi\sigma_{agg} = \prod_{i=1}^n \sigma_i = \prod_{i=1}^n h^{\alpha_i} = h^{\sum_{i=1}^n \alpha_i}

Simplified Verification Equation: e(σagg,g1)=e(h,i=1npki)e(\sigma_{agg}, g_1) = e(h, \prod_{i=1}^n pk_i)

Proof:

Left Side: e(σagg,g1)=e(hi=1nαi,g1)=e(h,g1)i=1nαie(\sigma_{agg}, g_1) = e\left(h^{\sum_{i=1}^n \alpha_i}, g_1\right) = e(h, g_1)^{\sum_{i=1}^n \alpha_i}

Right Side: e(h,i=1npki)=e(h,i=1ng1αi)=e(h,g1i=1nαi)=e(h,g1)i=1nαie(h, \prod_{i=1}^n pk_i) = e(h, \prod_{i=1}^n g_1^{\alpha_i}) = e(h, g_1^{\sum_{i=1}^n \alpha_i}) = e(h, g_1)^{\sum_{i=1}^n \alpha_i}

Therefore, the verification equation holds. ✓

Simplified Form: e(σagg,g1)=e(h,pk1pk2pkn)e(\sigma_{agg}, g_1) = e(h, pk_1 \cdot pk_2 \cdot \ldots \cdot pk_n)

Question 2: Rogue Public Key Attack

Adversary's Goal:

  • Forge aggregate signature σagg\sigma_{agg} that appears to come from Alice (public key pkApk_A) and the adversary (public key pkadvpk_{adv})
  • For message mm
  • The adversary does not know Alice's private key αA\alpha_A (where pkA=g1αApk_A = g_1^{\alpha_A})

Adversary's Strategy:

Step 1: Choose Rogue Public Key

The adversary computes: pkadv=pkA1=(g1αA)1=g1αApk_{adv} = pk_A^{-1} = (g_1^{\alpha_A})^{-1} = g_1^{-\alpha_A}

Step 2: Generate Aggregate Signature

The adversary computes: σagg=h0=1G0\sigma_{agg} = h^0 = 1 \in G_0

(where h=H(m)h = H(m))

Step 3: Verify Attack Success

Verification equation: e(σagg,g1)=e(1,g1)=1e(\sigma_{agg}, g_1) = e(1, g_1) = 1

e(h,pkApkadv)=e(h,pkApkA1)=e(h,1)=1e(h, pk_A \cdot pk_{adv}) = e(h, pk_A \cdot pk_A^{-1}) = e(h, 1) = 1

Therefore, e(σagg,g1)=e(h,pkApkadv)=1e(\sigma_{agg}, g_1) = e(h, pk_A \cdot pk_{adv}) = 1, verification passes! ✓

Attack Success:

  • The adversary successfully forged the aggregate signature
  • The verifier will think this signature comes from Alice and the adversary
  • But the adversary actually does not have Alice's signature, nor their own valid signature (because pkadv=pkA1pk_{adv} = pk_A^{-1} corresponds to private key αA-\alpha_A, which the adversary does not know)

Key Observation:

  • By choosing pkadv=pkA1pk_{adv} = pk_A^{-1}, the adversary makes pkApkadv=1pk_A \cdot pk_{adv} = 1
  • Therefore, the verification equation becomes e(σagg,g1)=e(h,1)=1e(\sigma_{agg}, g_1) = e(h, 1) = 1
  • The adversary can simply set σagg=1\sigma_{agg} = 1 to satisfy the verification equation
Question 3: Countermeasure

Simple Countermeasure: Proof of Knowledge

Method: Require each user to provide a zero-knowledge proof when registering their public key, proving they know the discrete logarithm of the corresponding private key.

Specific Implementation:

  1. Key Registration Phase:

    • User ii generates key pair: (αi,pki=g1αi)(\alpha_i, pk_i = g_1^{\alpha_i})
    • User ii generates zero-knowledge proof πi\pi_i proving knowledge of αi\alpha_i such that pki=g1αipk_i = g_1^{\alpha_i}
    • User ii submits (pki,πi)(pk_i, \pi_i) for registration
  2. Verify Registration:

    • The verifier verifies the validity of πi\pi_i
    • Only public keys that pass verification are accepted
  3. Prevent Attack:

    • The adversary cannot generate a valid proof of knowledge for pkadv=pkA1pk_{adv} = pk_A^{-1}
    • Because the adversary does not know αA-\alpha_A (the adversary does not know αA\alpha_A)
    • Therefore, pkadv=pkA1pk_{adv} = pk_A^{-1} cannot pass registration

Other Countermeasures:

  1. Message Binding: Require each signer to include their own public key when signing, i.e., sign H(mpki)H(m || pk_i) instead of H(m)H(m)

  2. Public Key Aggregation: Use more complex aggregation schemes that require all public keys to be known before aggregation

  3. Signer List: Maintain a trusted list of public keys, only accept signatures from public keys in the list

Simplest Countermeasure:

  • Require Proof of Knowledge: Each public key must be accompanied by a zero-knowledge proof proving the registrant knows the corresponding private key
  • This prevents adversaries from registering maliciously constructed public keys (such as pkA1pk_A^{-1})

Summary

Key Knowledge Points

  1. Bilinear Pairing: The foundation of BLS signatures, enabling efficient signature verification and aggregation
  2. co-CDH Problem: The fundamental assumption for BLS security
  3. Signature Aggregation: A powerful feature of BLS, allowing multiple signatures to be aggregated into one
  4. Rogue Public Key Attack: When messages are the same, adversaries can forge aggregate signatures by choosing rogue public keys
  5. Countermeasure: Use proof of knowledge to prevent rogue public key registration

Practical Considerations

  1. Public Key Registration: Must require proof of knowledge to prevent rogue public key attacks
  2. Message Uniqueness: If possible, avoid multiple users signing the same message
  3. Key Management: Private keys must be securely stored
  4. Batch Verification: Aggregate signatures can efficiently batch verify multiple signatures

Cryptography Final Exam Solutions

Problem 1: Concept Explanation

1.1 Hash Function

Knowledge Point Analysis

Basic Concept of Hash Functions:

  • A hash function H:{0,1}{0,1}nH: \{0,1\}^* \rightarrow \{0,1\}^n maps inputs of arbitrary length to fixed-length outputs
  • It is a fundamental tool in cryptography, used for data integrity verification, digital signatures, password storage, etc.

Three Basic Security Properties:

  1. Preimage Resistance / One-Wayness: Given a hash value yy, finding xx such that H(x)=yH(x) = y is computationally infeasible
  2. Second Preimage Resistance: Given xx, finding xxx' \neq x such that H(x)=H(x)H(x) = H(x') is computationally infeasible
  3. Collision Resistance: Finding any xxx \neq x' such that H(x)=H(x)H(x) = H(x') is computationally infeasible

Relationships Between Properties:

  • Collision Resistance \Rightarrow Second Preimage Resistance \Rightarrow Preimage Resistance
  • If a hash function is collision-resistant, then it is also second preimage-resistant and preimage-resistant
Standard Answer Format

Form: A hash function is a deterministic function H:{0,1}{0,1}nH: \{0,1\}^* \rightarrow \{0,1\}^n that maps binary strings of arbitrary length to fixed-length binary strings of length nn.

Background: Hash functions are fundamental tools in cryptography, widely used in:

  • Data integrity verification (e.g., file checksums)
  • Digital signatures (e.g., RSA-FDH, BLS signatures)
  • Password storage (e.g., bcrypt, scrypt)
  • Blockchain (e.g., Bitcoin's Merkle tree)

Scenario: In practical applications, hash functions are used for:

  1. File Integrity: Computing hash values of files to detect tampering
  2. Password Storage: Storing hash values of passwords instead of plaintext passwords
  3. Digital Signatures: Mapping messages to fixed length before signing
  4. Commitment Schemes: Using hash functions to implement commitments

Benefit:

  1. High Efficiency: Fast computation, suitable for processing large amounts of data
  2. Fixed Output Length: Regardless of input length, output is always fixed length
  3. One-Way Property: Difficult to recover original input from hash value
  4. Avalanche Effect: Small changes in input cause large changes in output

1.2 1-n OT (1-out-of-n Oblivious Transfer)

Knowledge Point Analysis

Basic Concept of 1-n OT:

  • 1-out-of-n OT is a generalization of 1-out-of-2 OT
  • The sender has nn messages m1,m2,,mnm_1, m_2, \ldots, m_n
  • The receiver selects an index i{1,2,,n}i \in \{1, 2, \ldots, n\}
  • After the protocol, the receiver obtains mim_i but does not know other messages, and the sender does not know ii

Security Requirements:

  1. Receiver's Privacy: The sender cannot know which message the receiver selected
  2. Sender's Privacy: The receiver cannot obtain unselected messages
Standard Answer Format

Form: 1-out-of-n Oblivious Transfer (1-n OT) is a cryptographic protocol that allows a receiver to select and obtain one message from the sender's nn messages, while the sender does not know which message the receiver selected.

Background: 1-n OT is a generalization of 1-out-of-2 OT, applied in the following scenarios:

  • Privacy-preserving data queries
  • Secure multi-party computation
  • Electronic voting systems
  • Privacy-preserving machine learning

Scenario: Typical application scenarios:

  1. Privacy Query: A user wants to query a record from a database without letting the database know which record is queried
  2. Privacy Auction: A bidder wants to obtain information about an item without revealing their interest
  3. Privacy Data Sharing: One party wants to obtain data from another party without revealing their choice

Benefit:

  1. Privacy Protection: Protects the receiver's choice privacy and the sender's message privacy
  2. Flexibility: Supports selection from multiple options
  3. Security: Based on cryptographic assumptions, provides formal security guarantees

1.3 IBE (Identity-Based Encryption)

Knowledge Point Analysis

Basic Concept of IBE:

  • IBE is a public-key encryption scheme where the public key can be any string (e.g., email address, ID number)
  • The private key is generated by a Key Generation Center (PKG) based on identity and master key
  • No public key certificates are needed, simplifying key management

Components of IBE:

  1. Setup: Generate system parameters and master key
  2. Extract: Generate private key based on identity
  3. Encrypt: Encrypt messages using identity
  4. Decrypt: Decrypt messages using private key

Security:

  • IBE security is based on bilinear pairings and hard problems (e.g., BDH problem)
  • Need to address the key escrow problem (PKG knows all private keys)
Standard Answer Format

Form: Identity-Based Encryption (IBE) is a public-key encryption scheme where the public key can be any string (identity), and the private key is generated by a Key Generation Center based on identity and master key.

Background: IBE was proposed by Boneh and Franklin in 2001, solving the complexity of public key certificate management in traditional public-key encryption:

  • Traditional schemes require Public Key Infrastructure (PKI) and certificates
  • IBE uses identity (e.g., email address) as public key, no certificates needed

Scenario: Typical application scenarios:

  1. Email Encryption: Using recipient's email address as public key to encrypt emails
  2. Internet of Things: Using device ID as public key, simplifying key management
  3. Cloud Storage: Using user identity to encrypt data stored in the cloud

Benefit:

  1. Simplified Key Management: No public key certificates needed, identity is the public key
  2. Flexibility: Can use any string as public key
  3. Scalability: Suitable for large-scale deployment
  4. Forward Security: Can revoke identity, making old ciphertexts undecryptable

1.4 MPC (Multi-Party Computation)

Knowledge Point Analysis

Basic Concept of MPC:

  • MPC allows multiple parties to jointly compute a function without revealing their private inputs
  • The computation result is correct, but no party can obtain other parties' private inputs

Security Models of MPC:

  1. Semi-Honest Model: Parties follow the protocol but try to infer other parties' inputs from protocol execution
  2. Malicious Model: Parties may not follow the protocol and try to break security

Implementation Methods of MPC:

  • Secret Sharing
  • Homomorphic Encryption
  • Garbled Circuits
  • Oblivious Transfer
Standard Answer Format

Form: Secure Multi-Party Computation (MPC) is a cryptographic protocol that allows multiple parties to jointly compute a function without revealing their private inputs, and obtain correct computation results.

Background: MPC was proposed by Yao in 1982, solving the following problems:

  • Multiple parties need to jointly compute but do not want to reveal their private data
  • Application scenarios include privacy-preserving data analysis, federated machine learning, privacy auctions, etc.

Scenario: Typical application scenarios:

  1. Privacy-Preserving Data Analysis: Multiple hospitals want to jointly analyze medical data without revealing their patient data
  2. Federated Machine Learning: Multiple companies want to jointly train models without revealing their training data
  3. Privacy Auction: Multiple bidders want to determine the winner without revealing their bid prices
  4. Electronic Voting: Multiple voters want to count voting results without revealing their voting content

Benefit:

  1. Privacy Protection: Protects each party's private inputs
  2. Correctness: Guarantees correctness of computation results
  3. Flexibility: Can compute any function
  4. Practicality: With the development of cryptography, MPC can now be applied in practical scenarios

Problem 2: Scheme Design

Problem Description

Design a secure file transfer scheme that satisfies the following requirements:

  1. 10GB File [Large]: Need to handle large files
  2. Payment (No one knows): Payment information is confidential, no one knows the payment amount
  3. Integrity: File integrity
  4. Only Bob can check the content: Only Bob can check the file content

Requirements: Select tools, explain the process, explain how each requirement is satisfied.

Knowledge Point Analysis

Core Challenges
  1. Large File Processing:

    • 10GB file is too large to encrypt and transfer directly
    • Need to use stream encryption or block encryption
    • Consider efficiency issues
  2. Payment Confidentiality:

    • Payment amount must be confidential
    • Can use homomorphic encryption or commitment schemes
    • Need to support payment verification without revealing amount
  3. Integrity:

    • Need to detect if file has been tampered with
    • Can use hash functions or MAC
    • Need to support integrity verification for large files
  4. Access Control:

    • Only Bob can decrypt and check file content
    • Need to use encryption schemes
    • Consider key distribution issues
Tool Selection
  1. Symmetric Encryption: For encrypting large files (e.g., AES-256-CTR)
  2. Public-Key Encryption: For encrypting symmetric keys (e.g., RSA-OAEP or ElGamal)
  3. Hash Function: For integrity verification (e.g., SHA-256)
  4. MAC: For authentication (e.g., HMAC-SHA256)
  5. Commitment Scheme: For payment confidentiality (e.g., Pedersen commitment)

Standard Answer

Tool Selection

1. File Encryption:

  • Symmetric Encryption: AES-256-CTR (stream encryption, suitable for large files)
  • Key Encryption: RSA-OAEP or ElGamal (for encrypting symmetric keys)

2. Integrity Verification:

  • Hash Function: SHA-256 (for computing file hash value)
  • MAC: HMAC-SHA256 (for authentication)

3. Payment Confidentiality:

  • Commitment Scheme: Pedersen commitment (for hiding payment amount)
Scheme Design

Phase 1: Initialization

  1. Bob Generates Key Pair:

    • Bob generates RSA key pair: (pkB,skB)(pk_B, sk_B)
    • Bob sends public key pkBpk_B to Alice
  2. Alice Generates File Key:

    • Alice randomly generates file encryption key: K{0,1}256K \leftarrow \{0,1\}^{256}
    • Alice encrypts file using KK: C=AES-CTR-Enc(K,File)C = \text{AES-CTR-Enc}(K, \text{File})

Phase 2: Payment Processing

  1. Alice Generates Payment Commitment:

    • Alice selects payment amount pp and random number rr
    • Alice computes payment commitment: Cp=gphrC_p = g^p \cdot h^r (Pedersen commitment)
    • Alice sends CpC_p to Bob (Bob does not know pp)
  2. Payment Verification (optional):

    • If payment verification is needed, Alice can open the commitment, but only under specific conditions
    • Or use zero-knowledge proof to prove payment amount is within reasonable range

Phase 3: File Transfer

  1. Alice Encrypts File Key:

    • Alice encrypts file key using Bob's public key: EK=RSA-Enc(pkB,K)E_K = \text{RSA-Enc}(pk_B, K)
  2. Alice Computes File Hash:

    • Alice computes file hash value: h=SHA-256(File)h = \text{SHA-256}(\text{File})
  3. Alice Generates MAC:

    • Alice uses shared key KMACK_{MAC} (or derived from KK) to compute MAC:
    • M=HMAC-SHA256(KMAC,ChCp)M = \text{HMAC-SHA256}(K_{MAC}, C || h || C_p)
  4. Alice Sends to Bob:

    • Alice sends: (C,EK,h,Cp,M)(C, E_K, h, C_p, M) to Bob

Phase 4: Bob Receives and Verifies

  1. Bob Decrypts File Key:

    • Bob uses private key to decrypt: K=RSA-Dec(skB,EK)K = \text{RSA-Dec}(sk_B, E_K)
  2. Bob Decrypts File:

    • Bob uses KK to decrypt file: File=AES-CTR-Dec(K,C)\text{File} = \text{AES-CTR-Dec}(K, C)
  3. Bob Verifies Integrity:

    • Bob computes file hash: h=SHA-256(File)h' = \text{SHA-256}(\text{File})
    • Bob checks h=hh' = h, if equal, file is intact
  4. Bob Verifies MAC:

    • Bob computes MAC: M=HMAC-SHA256(KMAC,ChCp)M' = \text{HMAC-SHA256}(K_{MAC}, C || h || C_p)
    • Bob checks M=MM' = M, if equal, data has not been tampered with
How Each Requirement is Satisfied

1. 10GB File [Large]:

  • Use AES-CTR Stream Encryption: Can encrypt block by block, no need to load entire file into memory
  • Block Transfer: Can divide file into multiple blocks, encrypt and transfer separately
  • High Efficiency: Symmetric encryption is fast, suitable for large files

2. Payment (No one knows):

  • Use Pedersen Commitment: Cp=gphrC_p = g^p \cdot h^r hides payment amount pp
  • Random Number rr: Ensures commitments of the same amount look different
  • Only Alice knows pp and rr: Bob and others cannot infer pp from CpC_p

3. Integrity:

  • SHA-256 Hash: Computes file hash value to detect any tampering
  • HMAC: Provides authentication, prevents data modification
  • Verification Mechanism: Bob can verify if file is intact

4. Only Bob can check the content:

  • RSA Encrypt File Key: Only Bob's private key can decrypt EKE_K to obtain KK
  • AES Encrypt File: Only Bob who has KK can decrypt the file
  • Access Control: Others cannot obtain file content

Problem 3: ElGamal Voting System

3.1 Computation Flow: Given x, Compute y, C1, C2, r

Problem Construction

Problem: In the ElGamal encryption scheme, given:

  • Group parameters: p=23p = 23, g=5g = 5 (gg is a generator of Z23\mathbb{Z}_{23}^*)
  • Private key: x=7x = 7
  • Message: m=12m = 12
  • Random number: r=3r = 3

Please compute:

  1. Public key yy
  2. Ciphertext (C1,C2)(C_1, C_2)
Knowledge Point Analysis

ElGamal Encryption Scheme:

  • Key Generation: Private key xZpx \in \mathbb{Z}_p^*, public key y=gxmodpy = g^x \bmod p
  • Encryption: Select random rZpr \in \mathbb{Z}_p^*, compute C1=grmodpC_1 = g^r \bmod p, C2=myrmodpC_2 = m \cdot y^r \bmod p
  • Decryption: Compute m=C2(C1x)1modp=C2C1xmodpm = C_2 \cdot (C_1^x)^{-1} \bmod p = C_2 \cdot C_1^{-x} \bmod p
Standard Answer

Step 1: Compute Public Key yy

y=gxmodp=57mod23y = g^x \bmod p = 5^7 \bmod 23

Compute 57mod235^7 \bmod 23:

  • 51=5mod23=55^1 = 5 \bmod 23 = 5
  • 52=25mod23=25^2 = 25 \bmod 23 = 2
  • 54=(52)2=22=4mod23=45^4 = (5^2)^2 = 2^2 = 4 \bmod 23 = 4
  • 57=545251=425=40mod23=175^7 = 5^4 \cdot 5^2 \cdot 5^1 = 4 \cdot 2 \cdot 5 = 40 \bmod 23 = 17

Therefore, y=17y = 17.

Step 2: Compute Ciphertext C1C_1

C1=grmodp=53mod23=125mod23=10C_1 = g^r \bmod p = 5^3 \bmod 23 = 125 \bmod 23 = 10

Step 3: Compute Ciphertext C2C_2

First compute yrmodpy^r \bmod p: yr=173mod23y^r = 17^3 \bmod 23

Compute 173mod2317^3 \bmod 23:

  • 171=17mod23=1717^1 = 17 \bmod 23 = 17
  • 172=289mod23=28912×23=289276=1317^2 = 289 \bmod 23 = 289 - 12 \times 23 = 289 - 276 = 13
  • 173=17217=1317=221mod23=2219×23=221207=1417^3 = 17^2 \cdot 17 = 13 \cdot 17 = 221 \bmod 23 = 221 - 9 \times 23 = 221 - 207 = 14

Therefore, yr=14y^r = 14.

Then compute C2C_2: C2=myrmodp=1214mod23=168mod23=1687×23=168161=7C_2 = m \cdot y^r \bmod p = 12 \cdot 14 \bmod 23 = 168 \bmod 23 = 168 - 7 \times 23 = 168 - 161 = 7

Result Summary:

  • Public key: y=17y = 17
  • Ciphertext: (C1,C2)=(10,7)(C_1, C_2) = (10, 7)
  • Random number: r=3r = 3

Verification (decryption): m=C2(C1x)1modp=7(107)1mod23m' = C_2 \cdot (C_1^x)^{-1} \bmod p = 7 \cdot (10^7)^{-1} \bmod 23

Compute 107mod2310^7 \bmod 23:

  • 101=10mod23=1010^1 = 10 \bmod 23 = 10
  • 102=100mod23=810^2 = 100 \bmod 23 = 8
  • 104=(102)2=82=64mod23=1810^4 = (10^2)^2 = 8^2 = 64 \bmod 23 = 18
  • 107=104102101=18810=1440mod23=144062×23=14401426=1410^7 = 10^4 \cdot 10^2 \cdot 10^1 = 18 \cdot 8 \cdot 10 = 1440 \bmod 23 = 1440 - 62 \times 23 = 1440 - 1426 = 14

Compute 141mod2314^{-1} \bmod 23:

  • Using extended Euclidean algorithm: 141mod23=514^{-1} \bmod 23 = 5 (because 14×5=701(mod23)14 \times 5 = 70 \equiv 1 \pmod{23})

Therefore: m=75mod23=35mod23=12m' = 7 \cdot 5 \bmod 23 = 35 \bmod 23 = 12

Verification successful: m=m=12m' = m = 12


3.2 Voting Homomorphic Encryption: [gb][g^b], b{0,1}b \in \{0,1\}, Draw the Flow

Problem Construction

Problem: Design an ElGamal homomorphic encryption-based voting system, where:

  • Vote value b{0,1}b \in \{0, 1\} (0 = against, 1 = support)
  • Use homomorphic encryption to encrypt votes: [gb][g^b] represents encryption of gbg^b
  • Require drawing the complete voting and tallying flow
Knowledge Point Analysis

ElGamal Homomorphic Encryption:

  • If C1=(gr1,hr1gv1)C_1 = (g^{r_1}, h^{r_1} \cdot g^{v_1}) encrypts gv1g^{v_1}, C2=(gr2,hr2gv2)C_2 = (g^{r_2}, h^{r_2} \cdot g^{v_2}) encrypts gv2g^{v_2}
  • Then C1C2=(gr1+r2,hr1+r2gv1+v2)C_1 \cdot C_2 = (g^{r_1+r_2}, h^{r_1+r_2} \cdot g^{v_1+v_2}) encrypts gv1+v2g^{v_1+v_2}
  • This is multiplicative homomorphism (addition in exponent)

Voting Flow:

  1. Setup phase: Generate key pair
  2. Voting phase: Each voter encrypts vote
  3. Aggregation phase: Aggregate all ciphertexts
  4. Tallying phase: Decrypt aggregated result
Standard Answer

Flow Diagram:

┌─────────────────────────────────────────────────────────────┐
│                    Voting System Flow                        │
└─────────────────────────────────────────────────────────────┘

[Phase 1: System Setup]
┌─────────────┐
│ Tally Center│
│ (Tally)     │
└─────────────┘
      │
      │ 1. Generate key pair
      │    - Select private key x ∈ Zq
      │    - Compute public key h = g^x
      │
      ▼
┌─────────────┐
│ Public Params│
│ (G, q, g, h)│
└─────────────┘
      │
      │ 2. Broadcast public key
      │
      ▼

[Phase 2: Voting Phase]
┌─────────────┐      ┌─────────────┐      ┌─────────────┐
│ Voter 1     │      │ Voter 2     │      │ Voter N     │
│ (Voter 1)   │      │ (Voter 2)   │  ... │ (Voter N)   │
└─────────────┘      └─────────────┘      └─────────────┘
      │                    │                    │
      │ 3. Select vote      │ 3. Select vote    │ 3. Select vote
      │    b₁ ∈ {0,1}      │    b₂ ∈ {0,1}      │    bₙ ∈ {0,1}
      │                    │                    │
      │ 4. Encrypt vote    │ 4. Encrypt vote   │ 4. Encrypt vote
      │    - Select r₁     │    - Select r₂    │    - Select rₙ
      │    - C₁ = (g^r₁,   │    - C₂ = (g^r₂,   │    - Cₙ = (g^rₙ,
      │         h^r₁·g^b₁) │         h^r₂·g^b₂) │         h^rₙ·g^bₙ)
      │                    │                    │
      ▼                    ▼                    ▼
┌─────────────────────────────────────────────────────────┐
│              Ballot Box (All Ciphertexts)                │
│  C₁, C₂, ..., Cₙ                                        │
└─────────────────────────────────────────────────────────┘

[Phase 3: Aggregation Phase]
┌─────────────┐
│ Tally Center│
└─────────────┘
      │
      │ 5. Aggregate ciphertexts
      │    C_agg = (C₁ · C₂ · ... · Cₙ)
      │    = (g^R_total, h^R_total · g^V_total)
      │    where R_total = Σrᵢ, V_total = Σbᵢ
      │
      ▼

[Phase 4: Tallying Phase]
┌─────────────┐
│ Tally Center│
│ (using sk x)│
└─────────────┘
      │
      │ 6. Decrypt aggregated result
      │    - Compute s = (g^R_total)^x = h^R_total
      │    - Compute g^V_total = (h^R_total·g^V_total) / h^R_total
      │
      │ 7. Compute discrete logarithm
      │    - V_total = log_g(g^V_total)
      │    - Use brute force search (because V_total ≤ N)
      │
      ▼
┌─────────────┐
│ Voting Result│
│ V_total     │
│ (Total Yes) │
└─────────────┘

Detailed Step Description:

Step 1: System Setup

  • Tally center selects group GG (prime order qq), generator gg
  • Tally center selects private key xZqx \in \mathbb{Z}_q
  • Tally center computes public key h=gxh = g^x
  • Public parameters: (G,q,g,h)(G, q, g, h)

Step 2: Vote Encryption For each voter ii:

  • Voter selects vote bi{0,1}b_i \in \{0, 1\}
  • Voter selects random number riZqr_i \in \mathbb{Z}_q
  • Voter computes ciphertext:
    • c1,i=gric_{1,i} = g^{r_i}
    • c2,i=hrigbic_{2,i} = h^{r_i} \cdot g^{b_i}
  • Voter submits ciphertext Ci=(c1,i,c2,i)C_i = (c_{1,i}, c_{2,i})

Step 3: Ciphertext Aggregation

  • Tally center computes aggregated ciphertext:
    • c1,agg=i=1Nc1,i=gi=1Nri=gRtotalc_{1,agg} = \prod_{i=1}^N c_{1,i} = g^{\sum_{i=1}^N r_i} = g^{R_{total}}
    • c2,agg=i=1Nc2,i=hi=1Nrigi=1Nbi=hRtotalgVtotalc_{2,agg} = \prod_{i=1}^N c_{2,i} = h^{\sum_{i=1}^N r_i} \cdot g^{\sum_{i=1}^N b_i} = h^{R_{total}} \cdot g^{V_{total}}
  • Where Rtotal=i=1NriR_{total} = \sum_{i=1}^N r_i, Vtotal=i=1NbiV_{total} = \sum_{i=1}^N b_i

Step 4: Decryption and Tallying

  • Tally center uses private key xx to decrypt:
    • Compute s=c1,aggx=(gRtotal)x=hRtotals = c_{1,agg}^x = (g^{R_{total}})^x = h^{R_{total}}
    • Compute gVtotal=c2,aggs=hRtotalgVtotalhRtotal=gVtotalg^{V_{total}} = \frac{c_{2,agg}}{s} = \frac{h^{R_{total}} \cdot g^{V_{total}}}{h^{R_{total}}} = g^{V_{total}}
  • Compute discrete logarithm: Vtotal=logg(gVtotal)V_{total} = \log_g(g^{V_{total}})
  • Since 0VtotalN0 \leq V_{total} \leq N, can use brute force search

3.3 Voting Computation: Provide Numbers

Problem Construction

Problem: In the ElGamal voting system, given:

  • Group parameters: p=23p = 23, g=5g = 5, q=11q = 11 (order of gg is qq)
  • Tally center private key: x=3x = 3
  • Votes from 3 voters:
    • Voter 1: b1=1b_1 = 1, r1=2r_1 = 2
    • Voter 2: b2=0b_2 = 0, r2=5r_2 = 5
    • Voter 3: b3=1b_3 = 1, r3=7r_3 = 7

Please compute:

  1. Public key hh
  2. Each voter's ciphertext (c1,i,c2,i)(c_{1,i}, c_{2,i})
  3. Aggregated ciphertext (c1,agg,c2,agg)(c_{1,agg}, c_{2,agg})
  4. Total votes VtotalV_{total}
Standard Answer

Step 1: Compute Public Key hh

h=gxmodp=53mod23=125mod23=10h = g^x \bmod p = 5^3 \bmod 23 = 125 \bmod 23 = 10

Step 2: Compute Each Voter's Ciphertext

Voter 1 (b1=1b_1 = 1, r1=2r_1 = 2):

  • c1,1=gr1modp=52mod23=25mod23=2c_{1,1} = g^{r_1} \bmod p = 5^2 \bmod 23 = 25 \bmod 23 = 2
  • c2,1=hr1gb1modp=10251mod23=1005mod23=85mod23=40mod23=17c_{2,1} = h^{r_1} \cdot g^{b_1} \bmod p = 10^2 \cdot 5^1 \bmod 23 = 100 \cdot 5 \bmod 23 = 8 \cdot 5 \bmod 23 = 40 \bmod 23 = 17

Voter 2 (b2=0b_2 = 0, r2=5r_2 = 5):

  • c1,2=gr2modp=55mod23c_{1,2} = g^{r_2} \bmod p = 5^5 \bmod 23
    • 52=2mod235^2 = 2 \bmod 23
    • 54=(52)2=22=4mod235^4 = (5^2)^2 = 2^2 = 4 \bmod 23
    • 55=5451=45=20mod235^5 = 5^4 \cdot 5^1 = 4 \cdot 5 = 20 \bmod 23
  • c2,2=hr2gb2modp=10550mod23=1051mod23c_{2,2} = h^{r_2} \cdot g^{b_2} \bmod p = 10^5 \cdot 5^0 \bmod 23 = 10^5 \cdot 1 \bmod 23
    • 102=8mod2310^2 = 8 \bmod 23
    • 104=(102)2=82=64mod23=1810^4 = (10^2)^2 = 8^2 = 64 \bmod 23 = 18
    • 105=104101=1810=180mod23=1807×23=180161=1910^5 = 10^4 \cdot 10^1 = 18 \cdot 10 = 180 \bmod 23 = 180 - 7 \times 23 = 180 - 161 = 19
    • Therefore c2,2=19mod23=19c_{2,2} = 19 \bmod 23 = 19

Voter 3 (b3=1b_3 = 1, r3=7r_3 = 7):

  • c1,3=gr3modp=57mod23c_{1,3} = g^{r_3} \bmod p = 5^7 \bmod 23
    • From previous calculation: 57=17mod235^7 = 17 \bmod 23
  • c2,3=hr3gb3modp=10751mod23c_{2,3} = h^{r_3} \cdot g^{b_3} \bmod p = 10^7 \cdot 5^1 \bmod 23
    • 107=105102=198=152mod23=1526×23=152138=1410^7 = 10^5 \cdot 10^2 = 19 \cdot 8 = 152 \bmod 23 = 152 - 6 \times 23 = 152 - 138 = 14
    • Therefore c2,3=145=70mod23=703×23=7069=1c_{2,3} = 14 \cdot 5 = 70 \bmod 23 = 70 - 3 \times 23 = 70 - 69 = 1

Step 3: Compute Aggregated Ciphertext

c1,agg=c1,1c1,2c1,3modp=22017mod23=680mod23=68029×23=680667=13c_{1,agg} = c_{1,1} \cdot c_{1,2} \cdot c_{1,3} \bmod p = 2 \cdot 20 \cdot 17 \bmod 23 = 680 \bmod 23 = 680 - 29 \times 23 = 680 - 667 = 13

c2,agg=c2,1c2,2c2,3modp=17191mod23=323mod23=32314×23=323322=1c_{2,agg} = c_{2,1} \cdot c_{2,2} \cdot c_{2,3} \bmod p = 17 \cdot 19 \cdot 1 \bmod 23 = 323 \bmod 23 = 323 - 14 \times 23 = 323 - 322 = 1

Step 4: Decrypt and Compute Total Votes

Decryption:

  • s=c1,aggxmodp=133mod23s = c_{1,agg}^x \bmod p = 13^3 \bmod 23
    • 132=169mod23=1697×23=169161=813^2 = 169 \bmod 23 = 169 - 7 \times 23 = 169 - 161 = 8
    • 133=132131=813=104mod23=1044×23=10492=1213^3 = 13^2 \cdot 13^1 = 8 \cdot 13 = 104 \bmod 23 = 104 - 4 \times 23 = 104 - 92 = 12
  • gVtotal=c2,aggsmodp=112mod23g^{V_{total}} = \frac{c_{2,agg}}{s} \bmod p = \frac{1}{12} \bmod 23

Compute 121mod2312^{-1} \bmod 23:

  • Using extended Euclidean algorithm: 121mod23=212^{-1} \bmod 23 = 2 (because 12×2=241(mod23)12 \times 2 = 24 \equiv 1 \pmod{23})

Therefore: gVtotal=12=2mod23g^{V_{total}} = 1 \cdot 2 = 2 \bmod 23

Compute Discrete Logarithm:

  • Need to find VtotalV_{total} such that gVtotal=5Vtotal2(mod23)g^{V_{total}} = 5^{V_{total}} \equiv 2 \pmod{23}
  • Try: 50=15^0 = 1, 51=55^1 = 5, 52=25^2 = 2
  • Therefore Vtotal=2V_{total} = 2

Verification:

  • Vtotal=b1+b2+b3=1+0+1=2V_{total} = b_1 + b_2 + b_3 = 1 + 0 + 1 = 2

Result Summary:

  • Public key: h=10h = 10
  • Voter 1 ciphertext: (2,17)(2, 17)
  • Voter 2 ciphertext: (20,19)(20, 19)
  • Voter 3 ciphertext: (17,1)(17, 1)
  • Aggregated ciphertext: (13,1)(13, 1)
  • Total votes: Vtotal=2V_{total} = 2 (2 yes votes, 1 no vote)

3.4 If Someone Lies: Use ZK Proof that Their bb is Not 0,1

Problem Construction

Problem: In the ElGamal voting system, malicious voters may try to encrypt values other than 0 or 1 (e.g., b=5b = 5) to manipulate results. Design a zero-knowledge proof protocol that proves a voter's ciphertext C=(c1,c2)C = (c_1, c_2) encrypts 0 or 1, without revealing which one. If a voter lies (b{0,1}b \notin \{0,1\}), the proof should fail.

Knowledge Point Analysis

OR Proof:

  • Need to prove: (g,h,c1,c2)(g, h, c_1, c_2) is a Diffie-Hellman tuple OR (g,h,c1,c2g1)(g, h, c_1, c_2 \cdot g^{-1}) is a Diffie-Hellman tuple
  • If b=0b = 0, then c2=hrc_2 = h^r, so (g,h,c1,c2)(g, h, c_1, c_2) is a DH tuple
  • If b=1b = 1, then c2=hrgc_2 = h^r \cdot g, so c2g1=hrc_2 \cdot g^{-1} = h^r, therefore (g,h,c1,c2g1)(g, h, c_1, c_2 \cdot g^{-1}) is a DH tuple
Standard Answer

Protocol Design:

Public Input: (g,h,c1,c2)(g, h, c_1, c_2)

Prover's Secret: rr (such that c1=grc_1 = g^r)

Prover's Goal: Prove b{0,1}b \in \{0, 1\}, i.e.:

  • Case 1: b=0b = 0, then (g,h,c1,c2)(g, h, c_1, c_2) is a Diffie-Hellman tuple
  • Case 2: b=1b = 1, then (g,h,c1,c2g1)(g, h, c_1, c_2 \cdot g^{-1}) is a Diffie-Hellman tuple

Protocol Steps:

Step 1: Commit

The prover needs to generate commitments for both cases:

For the real case (assume b=0b = 0, i.e., (g,h,c1,c2)(g, h, c_1, c_2) is a Diffie-Hellman tuple):

  • Prover knows rr such that c1=grc_1 = g^r and c2=hrc_2 = h^r
  • Prover selects random number k0Zqk_0 \leftarrow \mathbb{Z}_q
  • Compute commitment: a0=gk0a_0 = g^{k_0}, b0=hk0b_0 = h^{k_0}
  • Send (a0,b0)(a_0, b_0) to verifier

For the simulated case (b=1b = 1 case):

  • Prover does not know rr' such that c1=grc_1 = g^{r'} and c2g1=hrc_2 \cdot g^{-1} = h^{r'}
  • Prover selects random number k1Zqk_1 \leftarrow \mathbb{Z}_q and random challenge c1Zqc_1 \leftarrow \mathbb{Z}_q
  • Compute simulated response: z1Zqz_1 \leftarrow \mathbb{Z}_q
  • Compute simulated commitment: a1=gz1c1c1a_1 = g^{z_1} \cdot c_1^{-c_1}, b1=hz1(c2g1)c1b_1 = h^{z_1} \cdot (c_2 \cdot g^{-1})^{-c_1}
  • Send (a1,b1)(a_1, b_1) to verifier

Step 2: Challenge

Verifier selects random challenge cZqc \leftarrow \mathbb{Z}_q, sends to prover.

Step 3: Response

Prover needs to distribute challenge:

For the real case (b=0b = 0):

  • Prover sets: c0=cc1(modq)c_0 = c - c_1 \pmod{q}
  • Compute response: z0=k0+c0r(modq)z_0 = k_0 + c_0 \cdot r \pmod{q}
  • Send (c0,z0,c1,z1)(c_0, z_0, c_1, z_1) to verifier

For the simulated case (b=1b = 1):

  • If b=1b = 1, then prover knows rr such that c1=grc_1 = g^r and c2g1=hrc_2 \cdot g^{-1} = h^r
  • Similarly, prover will generate real proof for v=1v = 1 case and simulated proof for v=0v = 0 case

Step 4: Verify

Verifier checks:

  1. Challenge Distribution: c0+c1c(modq)c_0 + c_1 \equiv c \pmod{q}

  2. For Case 0 ((g,h,c1,c2)(g, h, c_1, c_2) is a Diffie-Hellman tuple):

    • gz0=a0c1c0g^{z_0} = a_0 \cdot c_1^{c_0}
    • hz0=b0c2c0h^{z_0} = b_0 \cdot c_2^{c_0}
  3. For Case 1 ((g,h,c1,c2g1)(g, h, c_1, c_2 \cdot g^{-1}) is a Diffie-Hellman tuple):

    • gz1=a1c1c1g^{z_1} = a_1 \cdot c_1^{c_1}
    • hz1=b1(c2g1)c1h^{z_1} = b_1 \cdot (c_2 \cdot g^{-1})^{c_1}

If all checks pass, verifier accepts the proof.

If Someone Lies (b{0,1}b \notin \{0,1\}):

  • Voter cannot generate real proof for b=0b = 0 or b=1b = 1
  • Can only generate two simulated proofs
  • But simulated proofs cannot pass verification (because challenge distribution is incorrect)
  • Verifier detects invalid proof and rejects vote

Problem 4: Schnorr Signature Insecurity Proof

4.1 Prove Schnorr Signature Insecurity: (R, Z) Inverse Cancellation

Problem Construction

Problem: In a variant of Schnorr signature, if the signature is (R,Z)(R, Z) instead of (R,s)(R, s), where Z=s1modqZ = s^{-1} \bmod q (modular inverse of ss), prove that this variant is insecure.

Given standard Schnorr signature:

  • Signature generation: s=r+cxmodqs = r + cx \bmod q, signature is (R,s)(R, s), where R=grR = g^r
  • Verification: Check gs=Rycg^s = R \cdot y^c

Variant signature:

  • Signature generation: s=r+cxmodqs = r + cx \bmod q, Z=s1modqZ = s^{-1} \bmod q, signature is (R,Z)(R, Z)
  • Verification: Need to derive verification equation
Knowledge Point Analysis

Standard Form of Schnorr Signature:

  • Signature: (R,s)(R, s), where R=grR = g^r, s=r+cxmodqs = r + cx \bmod q
  • Verification: gs=Rycg^s = R \cdot y^c

Security Issues of Variant:

  • If signature is (R,Z)(R, Z) where Z=s1Z = s^{-1}, attacker may forge signatures by manipulating ZZ
  • Key issue: How to recover ss from ZZ, and how to modify verification equation
Standard Answer

Derivation of Variant Signature Verification Equation:

Since Z=s1modqZ = s^{-1} \bmod q, we have s=Z1modqs = Z^{-1} \bmod q.

Standard verification equation: gs=Rycg^s = R \cdot y^c

Substitute s=Z1s = Z^{-1}: gZ1=Rycg^{Z^{-1}} = R \cdot y^c

Raise both sides to the ZZ-th power: (gZ1)Z=(Ryc)Z(g^{Z^{-1}})^Z = (R \cdot y^c)^Z

That is: g=(Ryc)Z=RZycZg = (R \cdot y^c)^Z = R^Z \cdot y^{cZ}

Therefore, the variant's verification equation is: g=RZycZg = R^Z \cdot y^{cZ}

Attack Method: Inverse Cancellation Attack

Attack Scenario:

  • Attacker AA observes two valid signatures: (R1,Z1)(R_1, Z_1) and (R2,Z2)(R_2, Z_2)
  • Both signatures are for different messages m1m_1 and m2m_2, but use the same random number rr (i.e., R1=R2=R=grR_1 = R_2 = R = g^r)

Attack Steps:

Step 1: Observe Two Signatures

  • Signature 1: (R,Z1)(R, Z_1), where Z1=s11Z_1 = s_1^{-1}, s1=r+c1xmodqs_1 = r + c_1 x \bmod q
  • Signature 2: (R,Z2)(R, Z_2), where Z2=s21Z_2 = s_2^{-1}, s2=r+c2xmodqs_2 = r + c_2 x \bmod q
  • Note: RR is the same, meaning rr is the same

Step 2: Exploit Inverse Relationship

Since Z1=s11Z_1 = s_1^{-1} and Z2=s21Z_2 = s_2^{-1}, we have:

  • s1=Z11modqs_1 = Z_1^{-1} \bmod q
  • s2=Z21modqs_2 = Z_2^{-1} \bmod q

Step 3: Compute Private Key xx

From the two signatures:

  • s1=r+c1xmodqs_1 = r + c_1 x \bmod q
  • s2=r+c2xmodqs_2 = r + c_2 x \bmod q

Compute s1s2s_1 - s_2: s1s2=(r+c1x)(r+c2x)=(c1c2)x(modq)s_1 - s_2 = (r + c_1 x) - (r + c_2 x) = (c_1 - c_2) x \pmod{q}

If c1c2c_1 \neq c_2, then: x=(s1s2)(c1c2)1(modq)x = (s_1 - s_2) \cdot (c_1 - c_2)^{-1} \pmod{q}

Since s1=Z11s_1 = Z_1^{-1} and s2=Z21s_2 = Z_2^{-1}: x=(Z11Z21)(c1c2)1(modq)x = (Z_1^{-1} - Z_2^{-1}) \cdot (c_1 - c_2)^{-1} \pmod{q}

Step 4: Attack Successful

Once the attacker obtains private key xx, they can forge signatures for any message.

Why the Variant is Insecure:

  1. Inverse Operation Breaks Security: Using Z=s1Z = s^{-1} instead of ss allows attackers to extract private keys by observing multiple signatures
  2. Nonce Reuse More Easily Exploited: Even if rr is reused, standard Schnorr signature requires two different challenges to extract private key; but in the variant, the inverse relationship makes attacks easier
  3. Verification Equation Problem: The product relationship between ZZ and cc in verification equation g=RZycZg = R^Z \cdot y^{cZ} may be exploited

Conclusion: The variant using (R,Z)(R, Z) where Z=s1Z = s^{-1} is insecure, because attackers can recover private keys by observing multiple signatures and exploiting the inverse relationship.


4.2 rr Only Takes Values from {r1,r2,r3}\{r_1, r_2, r_3\}, Prove Insecurity

Problem Construction

Problem: In Schnorr signature, if random number rr is not uniformly selected from the entire Zq\mathbb{Z}_q, but only from a small set {r1,r2,r3}\{r_1, r_2, r_3\}, prove that this variant is insecure.

Given:

  • Standard Schnorr signature: s=r+cxmodqs = r + cx \bmod q, signature is (R,s)(R, s), where R=grR = g^r
  • Variant: rr only selected from {r1,r2,r3}\{r_1, r_2, r_3\}
Knowledge Point Analysis

Importance of Random Number Space:

  • In Schnorr signature, rr must be uniformly selected from the entire Zq\mathbb{Z}_q
  • If rr's space is small, attackers can brute force search rr to recover private key

Small Space Attack:

  • If rr has only 3 possible values, attacker only needs to try 3 times to find the correct rr
  • Once rr is found, private key can be extracted from signature
Standard Answer

Attack Method: Small Space Brute Force Search

Attack Scenario:

  • Attacker AA knows signer only selects rr from {r1,r2,r3}\{r_1, r_2, r_3\}
  • Attacker can query signature oracle to obtain signature (R,s)(R, s) for message mm

Attack Steps:

Step 1: Query Signature

  • Attacker queries signature for message mm, obtains (R,s)(R, s)
  • Where R=grR = g^r, s=r+cxmodqs = r + cx \bmod q, c=H(mR)c = H(m || R)

Step 2: Brute Force Search rr

Since r{r1,r2,r3}r \in \{r_1, r_2, r_3\}, attacker tries all possible values:

For each ri{r1,r2,r3}r_i \in \{r_1, r_2, r_3\}:

  1. Compute Ri=grimodpR_i = g^{r_i} \bmod p
  2. If Ri=RR_i = R, then found the used rir_i

Step 3: Recover Private Key xx

Once rir_i is found, from signature equation: s=ri+cxmodqs = r_i + cx \bmod q

Therefore: x=(sri)c1modqx = (s - r_i) \cdot c^{-1} \bmod q

Step 4: Attack Successful

After obtaining private key xx, attacker can forge signatures for any message.

Success Probability Analysis:

Standard Case (rr selected from entire Zq\mathbb{Z}_q):

  • rr has qq possible values (qq is large, e.g., 22562^{256})
  • Attacker needs to try qq times, success probability is 1/q1/q (negligible)

Variant Case (rr only selected from {r1,r2,r3}\{r_1, r_2, r_3\}):

  • rr has only 3 possible values
  • Attacker only needs to try 3 times, success probability is 11 (after querying enough times)

Computational Complexity:

Standard Case:

  • Time complexity: O(q)O(q) (infeasible, because qq is large)
  • Success probability: Negligible

Variant Case:

  • Time complexity: O(3)=O(1)O(3) = O(1) (constant time)
  • Success probability: 11 (after one query)

Conclusion:

  • If rr is only selected from {r1,r2,r3}\{r_1, r_2, r_3\}, attacker can recover private key in constant time
  • Therefore, this variant is insecure
  • Key Lesson: Schnorr signature requires rr to be uniformly selected from the entire Zq\mathbb{Z}_q, any restriction on rr's space breaks security

Problem 5: Zero-Knowledge Proof

5.1 ZK AND Proof (Describe What Type of Proof It Is)

Problem Construction

Problem: Given a diagram of an AND proof (original PPT diagram), describe what type of proof this is and explain how it works.

Knowledge Point Analysis

Basic Concept of AND Proof:

  • AND proof is used to prove that prover knows multiple secrets simultaneously
  • For example: Prove knowledge of x1x_1 and x2x_2 such that y1=g1x1y_1 = g_1^{x_1} and y2=g2x2y_2 = g_2^{x_2}

Protocol Structure of AND Proof:

  • This is a Sigma protocol (3-round interactive protocol)
  • Contains: Commit, Challenge, Response
Standard Answer

Proof Type:

This is a Zero-Knowledge AND Proof, used to prove that the prover knows two discrete logarithms simultaneously.

Specifically:

  • Prover wants to prove: Know x1x_1 and x2x_2 such that y1=g1x1y_1 = g_1^{x_1} and y2=g2x2y_2 = g_2^{x_2}
  • This is a Proof of Knowledge, proving that the prover "possesses" this knowledge
  • It is also Zero-Knowledge, verifier cannot obtain information about x1x_1 and x2x_2

Protocol Description (based on standard AND proof):

Public Input: (g1,g2,y1,y2)(g_1, g_2, y_1, y_2)

Prover's Secret: (x1,x2)(x_1, x_2)

Protocol Steps:

  1. Commit:

    • Prover selects random numbers r1,r2Zqr_1, r_2 \leftarrow \mathbb{Z}_q
    • Prover computes: a1=g1r1a_1 = g_1^{r_1}, a2=g2r2a_2 = g_2^{r_2}
    • Prover sends (a1,a2)(a_1, a_2) to verifier
  2. Challenge:

    • Verifier selects random challenge cZqc \leftarrow \mathbb{Z}_q
    • Verifier sends cc to prover
  3. Response:

    • Prover computes: z1=r1+cx1modqz_1 = r_1 + cx_1 \bmod q, z2=r2+cx2modqz_2 = r_2 + cx_2 \bmod q
    • Prover sends (z1,z2)(z_1, z_2) to verifier
  4. Verify:

    • Verifier checks:
      • g1z1=a1y1cg_1^{z_1} = a_1 \cdot y_1^c
      • g2z2=a2y2cg_2^{z_2} = a_2 \cdot y_2^c
    • If both checks pass, verifier accepts proof

Key Properties:

  1. AND Property: Must satisfy both relations simultaneously, neither can be missing
  2. Proof of Knowledge: If prover does not know x1x_1 or x2x_2, cannot pass verification
  3. Zero-Knowledge: Verifier cannot obtain information about x1x_1 and x2x_2 from the proof process

5.2 ZK Soundness Proof (Prove AND Proof Satisfies Soundness Property)

Problem Construction

Problem: Prove that the AND proof in zero-knowledge proof satisfies the Soundness property.

Given: Prover wants to prove knowledge of x1x_1 and x2x_2 such that y1=g1x1y_1 = g_1^{x_1} and y2=g2x2y_2 = g_2^{x_2}.

Please prove: If prover does not know x1x_1 or x2x_2, then verifier rejects the proof with high probability.

Knowledge Point Analysis

Definition of Soundness:

  • If prover does not know the secret, verifier rejects proof with high probability
  • Formal: Pr[Verifier acceptsProver does not know secret]ϵ\Pr[\text{Verifier accepts} | \text{Prover does not know secret}] \leq \epsilon, where ϵ\epsilon is a negligible function

Soundness of AND Proof:

  • Must know both x1x_1 and x2x_2 to pass verification
  • If does not know x1x_1 or x2x_2, cannot construct valid response
Standard Answer

AND Proof Protocol Review:

Protocol Steps:

  1. Commit: Prover sends (a1,a2)(a_1, a_2), where a1=g1r1a_1 = g_1^{r_1}, a2=g2r2a_2 = g_2^{r_2}, r1,r2Zqr_1, r_2 \leftarrow \mathbb{Z}_q
  2. Challenge: Verifier sends cZqc \leftarrow \mathbb{Z}_q
  3. Response: Prover sends (z1,z2)(z_1, z_2), where z1=r1+cx1modqz_1 = r_1 + cx_1 \bmod q, z2=r2+cx2modqz_2 = r_2 + cx_2 \bmod q
  4. Verify: Verifier checks g1z1=a1y1cg_1^{z_1} = a_1 \cdot y_1^c and g2z2=a2y2cg_2^{z_2} = a_2 \cdot y_2^c

Soundness Proof:

Proof Idea:

Use proof by contradiction: Assume there exists an attacker that can pass verification with non-negligible probability, even without knowing x1x_1 or x2x_2. We will prove this contradicts the hardness of the discrete logarithm problem.

Case Analysis:

Case 1: Prover Does Not Know x1x_1

Assume prover does not know x1x_1, but knows x2x_2.

Attacker Strategy:

  • Attacker can correctly compute z2=r2+cx2z_2 = r_2 + cx_2 (because knows x2x_2)
  • But cannot correctly compute z1=r1+cx1z_1 = r_1 + cx_1 (because does not know x1x_1)

Verification Failure Analysis:

  • Verifier checks: g1z1=a1y1cg_1^{z_1} = a_1 \cdot y_1^c
  • If attacker does not know x1x_1, cannot compute correct z1z_1
  • Assume attacker guesses z1z_1', then: g1z1a1y1c=g1r1(g1x1)c=g1r1+cx1g_1^{z_1'} \neq a_1 \cdot y_1^c = g_1^{r_1} \cdot (g_1^{x_1})^c = g_1^{r_1 + cx_1}
  • Verification failure probability: Pr[Verification fails]1ϵ\Pr[\text{Verification fails}] \geq 1 - \epsilon, where ϵ\epsilon is negligible

Case 2: Prover Does Not Know x2x_2

Similarly, if prover does not know x2x_2, cannot correctly compute z2z_2, verification fails.

Case 3: Prover Does Not Know x1x_1 and x2x_2

If prover knows neither x1x_1 nor x2x_2, cannot correctly compute z1z_1 and z2z_2, verification must fail.

Formal Proof:

Assumption: There exists attacker AA that can pass verification with non-negligible probability δ\delta, even without knowing x1x_1 or x2x_2.

Construct Algorithm BB to Solve Discrete Logarithm Problem:

Given discrete logarithm problem instance: (g1,y1)(g_1, y_1), compute x1=logg1y1x_1 = \log_{g_1} y_1.

Algorithm BB:

  1. Set g2g_2 and y2=g2x2y_2 = g_2^{x_2} (BB knows x2x_2)
  2. Run AND proof protocol as verifier
  3. If attacker AA passes verification, extract information from response

Key Observation:

  • If AA can pass verification, then g1z1=a1y1cg_1^{z_1} = a_1 \cdot y_1^c
  • That is g1z1=g1r1y1cg_1^{z_1} = g_1^{r_1} \cdot y_1^c
  • Therefore z1=r1+clogg1y1modqz_1 = r_1 + c \cdot \log_{g_1} y_1 \bmod q
  • If BB knows r1r_1 and cc, can compute: logg1y1=(z1r1)c1modq\log_{g_1} y_1 = (z_1 - r_1) \cdot c^{-1} \bmod q

Problem: BB does not know r1r_1 (because a1=g1r1a_1 = g_1^{r_1} is sent by attacker)

Use Rewinding Technique:

  1. BB runs protocol, obtains (a1,a2)(a_1, a_2), sends challenge cc, obtains (z1,z2)(z_1, z_2)
  2. BB rewinds protocol, uses same (a1,a2)(a_1, a_2), but sends different challenge cc'
  3. If AA passes verification again, obtains (z1,z2)(z_1', z_2')
  4. From two responses:
    • z1=r1+cx1modqz_1 = r_1 + cx_1 \bmod q
    • z1=r1+cx1modqz_1' = r_1 + c'x_1 \bmod q
    • Therefore: z1z1=(cc)x1modqz_1 - z_1' = (c - c')x_1 \bmod q
    • If ccc \neq c', then: x1=(z1z1)(cc)1modqx_1 = (z_1 - z_1') \cdot (c - c')^{-1} \bmod q

Success Probability:

  • If AA can pass verification with probability δ\delta
  • Then BB can solve discrete logarithm problem with probability at least δ2\delta^2
  • If δ\delta is non-negligible, then δ2\delta^2 is also non-negligible
  • This contradicts the hardness of discrete logarithm problem

Conclusion:

  • If prover does not know x1x_1 or x2x_2, cannot generate valid AND proof
  • Verifier rejects proof with probability 1ϵ\geq 1 - \epsilon, where ϵ\epsilon is a negligible function
  • Therefore, AND proof satisfies Soundness property

5.3 ZK OR Proof: Prove Alice Has One of [g1,g2][g_1, g_2] and One of [g3,g4][g_3, g_4]

Problem Construction

Problem: Design a zero-knowledge OR proof that proves Alice has one of the following knowledge:

  • Know x1x_1 such that y1=g1x1y_1 = g_1^{x_1} OR know x2x_2 such that y2=g2x2y_2 = g_2^{x_2}
  • AND know x3x_3 such that y3=g3x3y_3 = g_3^{x_3} OR know x4x_4 such that y4=g4x4y_4 = g_4^{x_4}

That is: Alice has one discrete logarithm of [g1,g2][g_1, g_2] AND one discrete logarithm of [g3,g4][g_3, g_4].

Knowledge Point Analysis

Basic Idea of OR Proof:

  • OR proof is used to prove knowledge of one of multiple relations
  • For unknown relations, use simulated proof
  • Use forking technique to distribute challenge

Composite OR Proof:

  • This problem needs to prove: (g1 OR g2) AND (g3 OR g4)(g_1 \text{ OR } g_2) \text{ AND } (g_3 \text{ OR } g_4)
  • This can be decomposed as: Generate proof for each OR relation, then combine
Standard Answer

Protocol Design:

Public Input: (g1,g2,g3,g4,y1,y2,y3,y4)(g_1, g_2, g_3, g_4, y_1, y_2, y_3, y_4)

Prover's Secret:

  • Alice knows xix_i such that yi=gixiy_i = g_i^{x_i}, where i{1,2}i \in \{1,2\} is one AND j{3,4}j \in \{3,4\} is one
  • Assume Alice knows x1x_1 and x3x_3 (other cases similar)

Protocol Steps:

Step 1: Commit

Alice needs to generate commitments for four relations:

For Real Relations (g1g_1 and g3g_3):

  • Alice knows x1x_1 such that y1=g1x1y_1 = g_1^{x_1}
  • Alice knows x3x_3 such that y3=g3x3y_3 = g_3^{x_3}
  • Alice selects random numbers r1,r3Zqr_1, r_3 \leftarrow \mathbb{Z}_q
  • Alice computes: a1=g1r1a_1 = g_1^{r_1}, a3=g3r3a_3 = g_3^{r_3}
  • Alice sends (a1,a3)(a_1, a_3) to verifier

For Simulated Relations (g2g_2 and g4g_4):

  • Alice does not know x2x_2 and x4x_4
  • Alice selects random numbers r2,r4Zqr_2, r_4 \leftarrow \mathbb{Z}_q and random challenges c2,c4Zqc_2, c_4 \leftarrow \mathbb{Z}_q
  • Alice computes simulated responses: z2,z4Zqz_2, z_4 \leftarrow \mathbb{Z}_q
  • Alice computes simulated commitments:
    • a2=g2z2y2c2a_2 = g_2^{z_2} \cdot y_2^{-c_2}
    • a4=g4z4y4c4a_4 = g_4^{z_4} \cdot y_4^{-c_4}
  • Alice sends (a2,a4,c2,c4)(a_2, a_4, c_2, c_4) to verifier

Step 2: Challenge

Verifier selects random challenge cZqc \leftarrow \mathbb{Z}_q, sends to Alice.

Step 3: Response

Alice needs to distribute challenge:

For Real Relations (g1g_1 and g3g_3):

  • Alice sets: c1=cc2(modq)c_1 = c - c_2 \pmod{q}, c3=cc4(modq)c_3 = c - c_4 \pmod{q}
  • Alice computes responses:
    • z1=r1+c1x1(modq)z_1 = r_1 + c_1 \cdot x_1 \pmod{q}
    • z3=r3+c3x3(modq)z_3 = r_3 + c_3 \cdot x_3 \pmod{q}
  • Alice sends (c1,z1,c3,z3)(c_1, z_1, c_3, z_3) to verifier

For Simulated Relations (g2g_2 and g4g_4):

  • Alice has already sent (c2,z2,c4,z4)(c_2, z_2, c_4, z_4)

Step 4: Verify

Verifier checks:

  1. Challenge Distribution:

    • c1+c2c(modq)c_1 + c_2 \equiv c \pmod{q}
    • c3+c4c(modq)c_3 + c_4 \equiv c \pmod{q}
  2. For g1g_1 Relation (if Alice knows x1x_1):

    • g1z1=a1y1c1g_1^{z_1} = a_1 \cdot y_1^{c_1}
  3. For g2g_2 Relation (simulated):

    • g2z2=a2y2c2g_2^{z_2} = a_2 \cdot y_2^{c_2}
  4. For g3g_3 Relation (if Alice knows x3x_3):

    • g3z3=a3y3c3g_3^{z_3} = a_3 \cdot y_3^{c_3}
  5. For g4g_4 Relation (simulated):

    • g4z4=a4y4c4g_4^{z_4} = a_4 \cdot y_4^{c_4}

If all checks pass, verifier accepts proof.

Complete Protocol Flow:

  1. Alice → Verifier: (a1,a2,a3,a4,c2,c4)(a_1, a_2, a_3, a_4, c_2, c_4) (commitments and partial challenges)

  2. Verifier → Alice: cc (random challenge)

  3. Alice → Verifier: (c1,z1,z2,c3,z3,z4)(c_1, z_1, z_2, c_3, z_3, z_4) (challenge distribution and responses)

  4. Verifier Verifies:

    • c1+c2c(modq)c_1 + c_2 \equiv c \pmod{q} and c3+c4c(modq)c_3 + c_4 \equiv c \pmod{q}
    • g1z1=a1y1c1g_1^{z_1} = a_1 \cdot y_1^{c_1} and g2z2=a2y2c2g_2^{z_2} = a_2 \cdot y_2^{c_2}
    • g3z3=a3y3c3g_3^{z_3} = a_3 \cdot y_3^{c_3} and g4z4=a4y4c4g_4^{z_4} = a_4 \cdot y_4^{c_4}

Security:

  • Completeness: If Alice knows x1x_1 and x3x_3 (or corresponding combinations), honest Alice can always pass verification
  • Soundness: If Alice does not know one of [g1,g2][g_1, g_2] OR does not know one of [g3,g4][g_3, g_4], cannot pass verification
  • Zero-Knowledge: Verifier cannot know whether Alice knows g1g_1 or g2g_2, and whether g3g_3 or g4g_4

Key Observations:

  1. AND Combination: Must satisfy both OR relations simultaneously
  2. OR Proof: Each OR relation uses standard OR proof technique
  3. Challenge Distribution: Use forking technique to ensure correct challenge distribution

Summary

Key Knowledge Points Review

  1. Concept Explanation: Basic concepts and applications of Hash Function, 1-n OT, IBE, MPC
  2. Scheme Design: Large file transfer, payment confidentiality, integrity, access control
  3. ElGamal Voting: Homomorphic encryption, ciphertext aggregation, zero-knowledge proof
  4. Schnorr Signature Security: Inverse attack, small space attack
  5. Zero-Knowledge Proof: AND proof, OR proof, Soundness proof

Exam Answering Tips

  1. Concept Questions: Answer according to Form, Background, Scenario, Benefit structure
  2. Scheme Design Questions: Clearly state tool selection, detailed process, explain how each requirement is satisfied
  3. Computation Questions: Clear steps, verify results
  4. Proof Questions: Rigorous logic, use proof by contradiction or reduction techniques