If the quadratic residuosity problem is hard relative to , then the Goldwasser–Micali encryption scheme is CPA-secure.
:
Let denote the Goldwasser–Micali encryption scheme. Let be an arbitrary probabilistic polynomial-time adversary. Consider the following PPT adversary that attempts to solve the quadratic residuosity problem relative to :
Algorithm :
The algorithm is given and as input, and its goal is to determine if or .
Let us analyze the behavior of There are two cases to consider:
Case 1: Say the input to was generated by running to obtain and then choosing a uniform Then runs on a public key constructed exactly as in , and we see that in this case the view of when run as a subroutine by is distributed identically to 's view in experiment . Since outputs 1 exactly when the output of is equal to , we have
where represents a uniform element of .
Case 2: Say the input to was generated by running to obtain and then choosing a uniform . We claim that the view of in this case is independent of the bit . To see this, note that the ciphertext given to is a uniform quadratic residue regardless of whether a 0 or a 1 is encrypted:
Since 's view is independent of , the probability that in this case is exactly . That is,
where represents a uniform element of . Thus,
By the assumption that the quadratic residuosity problem is hard relative to , there is a negligible function such that
thus, . This completes the proof.