# 15.3: ElGamal Encryption

- Page ID
- 7413

ElGamal encryption is a public-key encryption scheme that is based on DHKA

**construction 15.6: ElGamal**

*The public parameters are a choice of cyclic group* ? *with n elements and generator g.*

The scheme satisfies correctness, since for all *M*:

**Security**

Imagine an adversary who is interested in attacking an ElGamal scheme. This adversary sees the public key *A* = *g ^{a}* and a ciphertext (

*g*) go by. Intuitively, the Decisional Diffie-Hellman assumption says that the value

^{b},M g^{ab}*g*looks random, even to someone who has seen

^{ab}*g*and

^{a}*g*. Thus, the message

^{b}*M*is masked with a pseudorandom group element — as we’ve seen before, this is a lot like masking the message with a random pad as in one-time pad. The only change here is that instead of the XOR operation, we are using the group operation in ?.

More formally, we can prove the security of ElGamal under the DDH assumption:

**Claim 15.7**

*If the DDH assumption in group* ? *is true, then ElGamal in group* ? *is CPA$-secure.*

**Proof**

It suffices to show that ElGamal has pseudorandom ciphertexts when the calling program sees only a single ciphertext. In other words, we will show that ℒ_{pk-ots$-real} ≋ ℒ_{pk-ots$-rand}, where these libraries are the ℒ_{pk-cpa$-*} libraries from __ Definition 15.2__ but with the singleciphertext restriction used in

__. It is left as an exercise to show that ℒ__

__Definition 15.4___{pk-ots$-real}≋ ℒ

_{pk-ots$-rand}implies CPA$ security (which in turn implies CPA security); the proof is very similar to that of

__.__

__Claim 15.5__The sequence of hybrid libraries is given below:

The starting point is the ℒ_{pk-ots$-real} library, shown here with the details of ElGamal filled in.

The main body of QUERY computes some intermediate values *B* and *A ^{b}* . But since those lines are only reachable one time, it does not change anything to pre-compute them at initialization time.

We can factor out the generation of *A*,*B*,*C* in terms of the ℒ_{dh-real} library from the Decisional Diffie-Hellman security definition (__ Definition 14.5__).

Applying the security of DDH, we can replace ℒ_{dh-real} with ℒ_{dh-rand}.

The call to DHQUERY has been inlined.

As before, since the main body of QUERY is only reachable once, we can move the choice of *B* and *C* into that subroutine instead of at initialization time.

When *b* is sampled uniformly from ℤ_{n}, the expression *B* = *g ^{b}* is a uniformly distributed element of ?. Also recall that when

*C*is a uniformly distributed element of ?, then

*M*·

*C*is uniformly distributed — this is analogous to the one-time pad property (see

__). Applying this change gives the library to the left.__

__Exercise 2.1__In the final hybrid, the response to QUERY is a pair of uniformly distributed group elements (*B,X*). Hence that library is exactly ℒ_{pk-ots$-rand, as desired.}