`
Explain Diffie-Hellman based key agreement protocol.
What is Diffie-Hellman protocol?- Differ-Hellman key exchange is a method for two computer users to generate a shared private key with which they can exchange the information across insecure channel.
- It is a method of securely exchanging cryptographic keys over a public channel.
- It was one of the first public-key-protocols.
- It was developed by Ralph Merkle and named after Whitefield Diffie and Martine Hellman.
- This protocol is used to secure a variety of Internet services.
- It establishes a shared secret between two parties which can be used for secret communication for exchanging data over a public network.
Diffie-Hellman based key agreement protocol- The first stage of the key agreement process is to compute a shared secret number, called ZZ. When the same originator and recipient public/private key pairs are used, the same ZZ value will result. The ZZ value is then converted into a shared symmetric cryptographic key. When the originator employs a static private/public key pair, the introduction of a public random value ensures that the resulting symmetric key will be different for each key agreement.
Procedure of Diffie-Hellman protocol
Step 1: Unnati chooses a large random number x and calculates R
1 = g
x mod p.
Step 2: Pankaj chooses another large random number y and calculates R
2 = g
y mod p.
Step 3: Unnati sends R
1 to Pankaj. Note that Unnati does not send the value of x, she sends only R
1.
Step 4: Pankaj sends R
2 to Unnati. Again note that Pankaj does not send the value of y, he sends only R
2.
Step 5: Unnati calculates K =(R
2)
x mod p.
Step 6: Pankaj calculates K = (R
1)
ymod p.
The symmetric key for the session is K
(gx mod p)y mod p = (gy mod p)x mod p = gxy mod p
Pankaj has calculated K = (R1)
y mod p = (g
x mod p)
y mod p = g
xy mod p.
Unnati has calculated K = (R2)
x mod p = (g
y mod p)
x mod p = g
xy mod p.
Both have reached the same value without Pankaj knowing the value of x and without Unnati knowing the value of y.
The symmetric key in the Diffie-Hellman protocol is
K = gxy mod p.
Example
Let us give a trivial example to make the procedure clear. Assume g = 7 and p = 23. (Note that in real situation, the numbers are very large). The steps are as follows:
1. Unnati chooses x = 3 and calculates R
1 = 7
3 mod 23 = 21.
2. Pankaj chooses y = 6 and calculates R
2 = 7
4 mod 23 = 4.
3. Unnati sends the number 21 to Pankaj.
4. Pankaj sends the number 4 to Unnati.
5. Unnati calculates the symmetric key K = 4
3 mod 23 = 18.
6. Pankaj calculates the symmetric key K = 21
6 mod 23 = 18.
The value of K is the same for both Pankaj and Unnati;
gxy mod p = 718 mod 35 = 18.