ElGamal Public Key Cryptosystem
Alice and Bob agree on a large prime number p and on an element g of Fp∗ with a large prime order.
Alice chooses a private key a, with 1<a<p−1, and publishes A=gamodp.
Bob chooses a random ephemeral key k.
He uses Alice's public key A to compute c1=gkmodp and c2=mAkmodp, where m is the plaintext.
He then send (c1,c2) to Alice.
To recover the plaintext m, Alice computes m=(c1a)−1c2modp. This works because (c1a)−1c2=g−akmgak=mmodp.
An eavesdropper has to find k from c1 (discrete logarithm problem).
A middle-man can easily manipulte c2; for example, to replace m by 2m all that is necessary is to replace c2 by 2c2modp.
This public key cryptosystem, implemented exactly as above, has some security problems.
Last updated