Meri Leeworthy

Diffie-Hellman key exchange

Monash

This algorithm is named after its founders and the main purpose of the algorithm, as the name suggests, is to perform the exchange of the secret key between two communicating users. Once the key exchange has been done, the users can then securely communicate using any algorithm with the shared secret key.

The foundational premise of the key exchange algorithm is based on the difficulty to compute discrete logarithms. The discrete logarithm problem states that it is possible for us to and a unique exponent i, given any integer b, that has a primitive root a of a prime number p, such that the following holds true:

$$b \equiv a^i\mod p | 0 \leq i \leq (p-1)$$ The exponent i is called the discrete logarithm of b for the base a, mod p

Key exchange algorithm

To begin, the algorithm defines two known integer values $q$ a prime number and $\alpha$ a primitive root of q.

We assume that two users A and B wish to communicate using this algorithm to exchange the key. In order to do so, each user must perform specific actions, as follows:

User A must first compute the following based on the defined conditions:

$$Y_A = a^{X_A}\mod q | X_A < q\text{ and }X_A\text{, is randomly selected}$$ Similarly, User B, independent of User A, must compute the following based on the defined conditions:

$$Y_B = a^{X_B}\mod q | X_B < q\text{ and }X_B\text{, is randomly selected}$$ Both users must keep their randomly selected number X secret and does not share it. However, the computed Y value is shared with the other user publicly.

Once the Y value has been received from User B, in order to determine the shared key K, User A must compute the following: $$K = (Y_B)^{X_A} \mod q$$ Similarly, User B, on receiving the Y value from User A, must compute the following to obtain the shared key K: $$K = (Y_A)^{X_B} \mod q$$ By the rules of modular arithmetic, both the above calculations will produce the same result. $$K = (Y_B)^{X_A} \mod q$$ $$K = (\alpha^{X_B} \mod q)^{X_A} \mod q$$ $$K = (\alpha^{X_B})^{X_A} \mod q$$ $$K = \alpha^{X_B^{X_A}} \mod q$$ $$K = (\alpha^{X_A})^{X_B} \mod q$$ $$K = (\alpha^{X_A} \mod q)^{X_B} \mod q$$ $$K = (Y_A)^{X_B} \mod q$$ As you can see, using the above algorithm, both users have successfully managed to compute the value of the shared key K, which can then be used for future communication via a symmetric algorithm instead. Since the values of X are kept secret by both A and B, any adversary must compute the discrete logarithm as follows: $$X_B = d\log_{\alpha, q}(Y_B)$$ The challenge for the adversary is that calculating the discrete logarithm for a large prime is infeasible.

Key exchange protocols

An example scenario of using the Diffie-Hellman key exchange protocol has been shown in the image below: For a network of users, residing on a LAN, the common values of α and q can be stored in a central repository accessible to each user==. In order for each user to communicate to another, each user can ==locally generate and store a long-lasting private value for X. Each user wanting to communicate, then initiated the communication with another user and sends them the value of Y obtained using their private value of X. The second user will then use that value of Y along with their private value of X to obtain the shared key K. And in doing so, the second user will compute their own value of Y using their private value of X to send to the first user, who can then compute the share key K as well.

It is important to note that this key exchange scheme is not without flaws. It is prone to attacks such as Man-in-the-middle and others that can compromise the overall security of the key exchange scheme. You will see these in more detail in later lessons.

4o:

1. Public Key Exchange with Shared Secret

2. Based on Hard Mathematical Problems

3. Ephemeral or Long-Term Keys

4. Vulnerability to Man-in-the-Middle (MitM) Attacks

5. Asymmetry of Public and Private Components

6. No Message Confidentiality or Integrity by Itself

7. Suitability for Symmetric Key Generation

8. Compatibility with Multiple Curves (in Elliptic Curve Diffie-Hellman)

I live and work on the land of the Wurundjeri people of the Kulin Nation. I pay respect to their elders past and present and acknowledge that sovereignty was never ceded. Always was, always will be Aboriginal land.

This site uses open source typefaces, including Sligoil by Ariel Martín Pérez, and Vercetti by Filippos Fragkogiannis