In this problem, we explore the Diffie-Hellman (DH) public-key encryption algorithm, which allows two entities to agree on a shared key. The DH algorithm makes use of a large prime number p and another large number g less than p. Both p and g are made public (so that an attacker would know them). In DH, Alice and Bob each independently choose secret keys, SA and S B , respectively. Alice then computes her public key, TA , by raising g to SA and then taking mod p. Bob similarly computes his own public key T B by raising g to SB and then taking mod p. Alice and Bob then exchange their public keys over the Internet. Alice then calculates the shared secret key S by raising TB to
SA and then taking mod p. Similarly, Bob calculates the shared key S ́ by raising T A to S B and then taking mod p.
a. Prove that, in general, Alice and Bob obtain the same symmetric key, that is, prove S = S'.
b. With p = 11 and g = 2, suppose Alice and Bob choose private keys SA = 5 and S B = 12, respectively. Calculate Alice’s and Bob’s public keys, T A and T B . Show all work.
c. Following up on part (b), now calculate S as the shared symmetric key. Show all work.
d. Provide a timing diagram that shows how Diffie-Hellman can be attacked by a man-in-the-middle. The timing diagram should have three vertical lines, one for Alice, one for Bob, and one for the attacker Trudy.
a.
To prove that Alice and Bob pobtain the same symmetric key, we need to show that S = S'.
Alice's calculation:
Bob's calculation:
To prove S = S', we need to show that
We know that Alice's public key is
mod p and
Bob's public key is
Substituting these values into the equation, we have:
Since is equivalent to , we can conclude that S = S', and Alice and Bob obtain the same symmetric key.
b.
With p = 11 and g = 2, and Alice choosing SA = 5 and Bob choosing SB = 12:
Alice's public key:
Bob's public key:
c.
Calculating the shared symmetric key S:
Alice's calculation:
Bob's calculation:
Therefore, the shared symmetric key for Alice and Bob is S = S' = 9.
d.
Timing diagram for Diffie-Hellman with a man-in-the-middle attack:
Time Alice Bob Trudy
-------------------------------------------
1 SA SB
2 TA TB
3 Intercept TB, replace with TM
4 TM Intercept TA, replace with TB
5 Calculate S as (TB^SA) mod p
6 TB Intercept TM, replace with TA
7 Calculate S as