Diffie-Hellman Key Exchange Algorithm
Diffie-Hel...
> >Diffie-Hellman key agreement was invented in 1976 during a collaboration between Whitfield Diffie and Martin Hellman and was the first practical method for establishing a shared secret over an unsecure communications channel.
The beauty of this scheme is that the two parties can agree on a symmetric key using this technique. This key can then be used for encryption and decryption.
After completing all the calculations, K1 is equal to K2.
In the above table, only small prime numbers and integers are chosen.
Mathematically, it is extremely difficult to find out x and y (and hence K1 and K2) from p, g, A and B if p, x and y are sufficiently large numbers.
If p is a prime of at least 300 digits, and x and y are at least 100 digits long, then it is not feasible to find the keys by using all computers in the world. Note that g need not be large at all, and in practice is usually either 2, 3 or 5.
This method does not provide authentication. It is vulnerable to a man-in-the-middle attack.
A person in the middle can establish one exchange with Alice and the other with Bob.
This allows the attacker to decrypt and then re-encrypt the messages passed between them.