SHARE
SPREAD
HELP

The Tradition of Sharing

Help your friends and juniors by posting answers to the questions that you know. Also post questions that are not available.


To start with, Sr2Jr’s first step is to reduce the expenses related to education. To achieve this goal Sr2Jr organized the textbook’s question and answers. Sr2Jr is community based and need your support to fill the question and answers. The question and answers posted will be available free of cost to all.

 

#
Authors:
James F. Kurose, Keith W. Ross
Chapter:
Security In Computer Networks
Exercise:
Problems
Question:9 | ISBN:9780132856201 | Edition: 6

Question

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.

TextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbook

Answer

a.

To prove that Alice and Bob pS = (T_B^SA) mod pobtain the same symmetric key, we need to show that S = S'.

Alice's calculation:

Bob's calculation: S' = (T_A^SB) mod p

To prove S = S', we need to show that (T_B^SA) mod p = (T_A^SB) mod p.

We know that Alice's public key is

TA = (g^SA) mod p and

Bob's public key is TB = (g^SB) mod p.

Substituting these values into the equation, we have:

(T_B^SA) mod p = ((g^SB)^SA) mod p = (g^(SB * SA)) mod p = (g^(SA * SB)) mod p (since multiplication is commutative) = ((g^SA)^SB) mod p = (TA^SB) mod p

Since (TA^SB) mod p is equivalent to (T_A^SB) mod p, 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: TA = (g^SA) mod p = (2^5) mod 11 = 32 mod 11 = 10

Bob's public key:

TB = (g^SB) mod p = (2^12) mod 11 = 4096 mod 11 = 4

 

c.

Calculating the shared symmetric key S:

Alice's calculation: S = (TB^SA) mod p = (4^5) mod 11 = 1024 mod 11 = 9

Bob's calculation:S' = (TA^SB) mod p = (10^12) mod 11 = 1000000000000 mod 11 = 9

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  (TA^SB) mod p(TA^SB) mod p

  • In this timing diagram, Trudy intercepts the public keys exchanged between Alice and Bob (Steps 3 and 4) and replaces them with her own public key (TM).
  • As a result, Alice and Bob unknowingly compute the shared symmetric keys with Trudy instead of each other.
  • This allows Trudy to eavesdrop on their communication and potentially decrypt any encrypted messages.
0 0

Discussions

Post the discussion to improve the above solution.