5
$\begingroup$

I was introduced to the QR-protocol that shows that a number y is a quadratic residue modulo x through an interactive protocol. The protocol is perfect zero-knowledge but it also proves that the prover P knows the square root w (a witness) of y modulo x, meaning it is a zero-knowledge proof of knowledge. By interacting with the prover multiple times an extractor algorithm that runs in expected polynomial time is able to extract w from its interaction with P. Why does this not contradict that the protocol is perfect zero-knowledge?

$\endgroup$

1 Answer 1

7
$\begingroup$

The knowledge extraction algorithm has more power than a verifier who participates in the ZK interaction -- it can rewind time.

Consider a typical ZK protocol with 3 messages, where the prover sends the first one:

  1. Prover: send $M_1$ to verifier
  2. Verifier: send $M_2$ to prover
  3. Prover: send $M_3$ to verifier.

A typical knowledge extraction algorithm works by doing the following:

  1. Run the prover until it produces $M_1$
  2. Choose $M_2$ and give it to the prover
  3. Run the prover until it produces $M_3$
  4. Return the prover to the internal state it had after step 1
  5. Choose a different $M'_2$ and give it to the prover
  6. Run the prover until it produces $M'_3$
  7. From the combination of these values, compute the witness

You can think of the knowledge extraction algorithm as running the prover inside a virtual machine, and restoring the VM image to an earlier state -- from the perspective of the prover, rewinding time and attempting a different timeline.

A verifier cannot cause the same thing to happen in a typical interaction with the prover. Even if the verifier interacts with the prover multiple times, there is a subtle difference:

  1. Interact with the prover and receive $M_1$ from it
  2. Choose $M_2$ and give it to the prover
  3. Receive $M_3$ from the prover
  4. Ask the prover to prove the same thing again. This time, the prover sends $M'_1$
  5. Choose $M'_2$ and give it to the prover
  6. Receive $M'_3$ from the prover

The verifier sees two transcripts $(M_1, M_2, M_3)$ and $(M'_1, M'_2, M'_3)$, where $M_1$ and $M'_1$ are chosen independently (by the prover). But the knowledge extraction algorithm sees two transcripts $(M_1, M_2, M_3)$ and $(M_1, M_2', M_3')$ with the same $M_1$! The verifier cannot say "please prove the same thing again, and don't forget to use the same $M_1$ as last time" because the protocol instructs the prover to generate $M_1$ fresh for each interaction.

This is precisely the advantage that typical knowledge extraction algorithms use to extract the witness, and why the regular verifier cannot do the same thing. I recommend that you read about Schnorr's identification protocol, which is the simplest protocol whose extraction works in this way.

$\endgroup$
1
  • $\begingroup$ Thanks for the great explanation and the recommendation! $\endgroup$
    – Niko Wolf
    Commented Jul 17 at 10:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.