PromleeBlog

posting thumbnail
Diffie–Hellman Key Exchange

📅

Key exchange 🔗

A method for securely establishing a common key for communication.
Alice and Bob exchange data over a
public channel
to generate a shared secret key.
A third party cannot learn the key merely by intercepting the data sent over that channel.

Diffie–Hellman key exchange 🔗

A public-key technique for exchanging a secret key securely.
Previously shared parameters: A prime pp, a primitive root gg, and the finite group Zp∗\mathbb{Z}_p^*.
Alice and Bob proceed as follows.
KAB=Ba=(gb)a=gab=(ga)b=Ab=KBAK_{AB} = B^a = (g^b)^a = g^{ab} = (g^a)^b = A^b = K_{BA}

Diffie–Hellman example 🔗

p=31p = 31, g=3g = 3.
Key-exchange results:

Security of Diffie–Hellman key exchange 🔗

Man-in-the-middle attacks.
👨‍💻
Computational Diffie–Hellman (CDH)

A man-in-the-middle attack scenario 🔗

  1. Alice and Bob perform a key exchange.
  2. Eve sits between them.
  3. Eve sends geg^e to Alice.
  4. Eve sends gfg^f to Bob.
  5. Alice and Bob calculate gefg^{ef}.
  6. Eve calculates gefg^{ef} and intercepts their communication.

Explaining and preventing a man-in-the-middle attack 🔗

Attack explanation 🔗

  1. Eve generates a private key ee and calculates E=gemod  pE = g^e \mod p.
  2. Alice and Bob send AA and BB to one another.
  3. Eve intercepts them and sends EE to both parties.
  4. Alice and Bob receive EE and calculate:
    KAE=Ea=geamod  pK_{AE} = E^a = g^{ea} \mod p, KBE=Eb=gebmod  pK_{BE} = E^b = g^{eb} \mod p.

Prevention 🔗

Man-in-the-middle summary 🔗

    Diffie–Hellman Key Exchange | PromleeBlog