The Diffie-Hellman key exchange algorithm is usually described as an active exchange of keys by two parties:
one party chooses x, and transmits A^x mod P,
the other party chooses y, and transmits A^y mod P,
and then both parties communicate using A^xy mod P as their session key.
Nothing, however, prevents the second party placing A^y mod P on file as its public key, allowing anyone else to send a message which the second party can read by choosing an x, and sending A^x mod P along with the message, encrypted using A^xy mod P as the key.
El Gamal could be considered to be a special case of this.
In El Gamal, to send a message to a party whose public key is A^y mod P, we send our own public key, A^x mod P, and in addition the message is enciphered by multiplying it by A^xy mod P, the multiplication also being modulo P.
Table of Contents