**If not redirected, please click here https://www.thesecuritybuddy.com/encryption/how-does-diffie-hellman-key-exchange-protocol-work/**

**Diffie - Hellman Key Exchange Protocol**is a key agreement protocol that allows authenticated parties to exchange keying material across an insecure connection.

This protocol is significantly used in protocols like IPSec or SSL/TLS. Using this protocol, sending and receiving devices in the network shares public key.

To establish a secure connection over the unsecured internet, two hosts need to agree on a few parameters like the secret keys using which the data is encrypted and then transferred. The secret parameters cannot be transferred between the hosts as the attacker may eavesdrop them. So, both the hosts need to derive the secret parameters, without transferring the secret parameters themselves. And so,

**Diffie-Hellman Key Exchange Protocol**is used.###
**How does Diffie-Hellman Key Exchange Protocol work ?**

Let's first understand this in simple
English.

- Let's assume, Alice and Bob wants to share a color between them secretly.
- The process begins by Alice and Bob agreeing on a common color, that need not be kept secret. Let's assume, that agreed on common color is yellow.
- Now, each of them selects a secret color, red and aqua respectively. This secret color they do not share with each other.
- Now, they mix up their respective secret colors with the common color yellow. So, Alice will get orange and Bob will get a yellow and blue mixture.
- Alice and Bob now share these mixed colors, orange and blue mixture, with each other publicly.
- Now, Alice and Bob should mix up the colors they received with their secret color. So, Alice will mix up aqua and red to get brown. And Bob will mix up orange and aqua to get brown.
- Hence, their agreed on secret color is brown. Please note that, it is impossible for any third party listening to their conversation to determine the common secret color.

###
**Implementation**

In the original implementation of the protocol, multiplicative group of integers modulo a prime number is used.

Please note that, if p is a prime, g a primitive root of p, and a and b two secret integers here.

^{a}mod p

B = g

^{b}mod p

C = A

Here, p and g are analogous to agreed on common color yellow.

a and b are analogous to Alice' and Bob's secret color red and aqua respectively.

A and B are analogous to their mutually shared color, orange and blue mixture respectively.

And C is analogous to their secret common color brown.

So, that would mean :

So, this is the basis of internet key exchange protocol !

^{b}mod p = B^{a }mod p = g^{ab}mod pHere, p and g are analogous to agreed on common color yellow.

a and b are analogous to Alice' and Bob's secret color red and aqua respectively.

A and B are analogous to their mutually shared color, orange and blue mixture respectively.

And C is analogous to their secret common color brown.

So, that would mean :

- Alice will compute A = g
^{a}mod p and send g, p and A to Bob. - Bob will compute B = g
^{b}mod p and send B to Alice. - Alice will compute K = B
^{a }mod p - Bob will compute K = A
^{b}mod p - Alice and Bob both have derived K without directly sending K to each other. So, even if an attacker eavesdrop the communication between Alice and Bob and grabs the value of A, B, g and p, it will be computationally infeasible for the attacker to derive the value of K
- Now, Alice and Bob are free to encrypt the data with the secret key K and transfer between them.

So, this is the basis of internet key exchange protocol !

## No comments:

## Post a Comment