ElGamal Public Key Cryptosystem

  1. Alice and Bob agree on a large prime number pp and on an element gg of Fp\mathbb{F}^*_p with a large prime order.

  2. Alice chooses a private key aa, with 1<a<p11 \lt a \lt p-1, and publishes A=gamodpA = g^a mod p.

  3. Bob chooses a random ephemeral key kk.

  4. He uses Alice's public key AA to compute c1=gkmodpc_1 = g ^k modp and c2=mAkmodpc_2 = mA^kmodp, where mm is the plaintext.

  5. He then send (c1,c2)(c_1,c_2) to Alice.

  6. To recover the plaintext mm, Alice computes m=(c1a)1c2modpm = (c^a_1)^{-1}c_2modp. This works because (c1a)1c2=gakmgak=mmodp(c^a_1)^{-1}c_2 = g ^{-ak}mg^{ak} = m mod p.

  7. An eavesdropper has to find kk from c1c_1 (discrete logarithm problem).

  8. A middle-man can easily manipulte c2c_2; for example, to replace mm by 2m2m all that is necessary is to replace c2c_2 by 2c2modp2c_2 mod p.

  9. This public key cryptosystem, implemented exactly as above, has some security problems.

Last updated