0
11kviews
A and B decide to use Diffie Hellman algorithm to share a key. They choose p=23 and g=5 as the public parameters. The secret keys are 6 and 15 respectively. Compute the secret key that they share.
1 Answer
4
1.0kviews
  • The two prime numbers are p=23 and g=5 (in textbooks you might find q & a)
  • The random secret keys of A and B are:
    • A chooses $x_A=6$
    • B chooses $x_B=15$ ….. given data
  • Now compute the public key of each individual using the secret key

    • A’s public key using its secret key xA:

      $y_A = g^{xA} mod p$

      $y_A = 56 mod 23 =[(52 mod 23) * (52 mod 23) * (52 mod 23)]mod 23$

      $y_A = [2 * 2 * 2]mod 23= 8$

      $y_A = 8$

    • B’s public key using its secret key $x_B$:

      $y_B = g^{xB} mod p$

      $y_B = 515 mod 23= [ (56 mod 23)* (56 mod 23)*( 53 mod 23)]mod 23$

      $y_B =[8 * 8 *10]mod 23=640 mod 23= 19$

      $y_B =19$…. Here since we already had the powers of 5^6 from previous step, we used those…

  • The above two public keys are now exchanged by both A and B. Now we shall compute the session keys as:

    • A will compute the session key using B’s public key:

      $K_{AB}= y_B^{xA}$ mod p

      $K_{AB}= 196 mod 23 = [(192 mod 23)*( 192 mod 23)*( 192 mod 23)]mod 23$

      $K_{AB}= 2$

    • B will compute session key using A’s public key:

      $K_{AB}= y_A^{xB}$ mod p = 815 mod 23 =2

    (Remember: both the session keys value will have to be the same …. )

    In this manner Diffie –Hellman KEY EXCHANGE protocol works. This protocol cannot be used for exchanging messages, only key are exchanged.

Diagramatic representation

enter image description here

Please log in to add an answer.