The Diffie-Hellman Key Exchange
Learn about the Diffie-Hellman algorithm in this lesson.
We'll cover the following
What is the Diffie-Hellman key exchange protocol?
The Diffie-Hellman Key Exchange (DHKE) protocol was the first publicly published algorithm for public key exchange, which offered an elegant solution to Alice’s and Bob’s dilemma, who want to share a joint common, secret key for a symmetric cipher, whereas their only possible communication channel is insecure and eavesdropped on by Eve.
The DHKE solves this problem by making use of the difficulty of computing the so-called discrete logarithm over the finite field . To use Diffie-Hellman, Alice and Bob have to choose a cyclic group. The classic Diffie-Hellman key exchange protocol works in the multiplicative group . In summary, the Diffie-Hellman protocol is a cryptographic protocol that allows Alice and Bob to establish a shared secret over an insecure channel.
In the first step, Alice and Bob agree on specific domain parameters, namely on a large prime and an integer , where should have a large order, ideally is a generator of the multiplicative group , and publish these parameters. Now, they can generate a joint secret key with the DHKE protocol as follows:
Alice picks a secret integer and computes
and Bob chooses a secret integer and computes
Now, Alice and Bob exchange these values, i.e., Alice sends to Bob whilst Bob sends to Alice. At this point, Eve notices these values since she’s eavesdropping on the insecure channel over which these computations are sent. Finally, they again use their secret integers, whereas Alice computes
and Bob computes
As we can see, Alice and Bob computed the same value , and this shared value is their exchanged joint key , which can be used to establish a secure communication by using as a secret key for a symmetric cipher.
Note that Eve knows and since these are public knowledge, and she also knows the computed values and and hence and . But she doesn’t know the shared secret value , and this is exactly the problem Eve has to solve in order to acquire the key. This problem is known as the Diffie-Hellman problem (
Get hands-on with 1200+ tech skills courses.