KEMBAR78
Cryptography and Network security # Lecture 6 | PPTX
Lec-6: Cryptography & Network
Security
Mr. Islahuddin Jalal
MS (Cyber Security) – UKM Malaysia
Research Title – 3C-CSIRT Model for Afghanistan
BAKHTAR UNIVERSITY ‫باخترپوهنتون‬ ‫د‬
Bakhtar University 1
Diffie-Helman Key Exchange Algorithm
Used to exchange the secret key
E.g
Saghar and suraya want to communicate over a channel which is not secured.
Where khkula wanted to listen the conversation of saghar and suraya
Then they decided to use a mechanism where khkula should not understand the
communication. They agreed on secret conversation.
Problem: how to exchange the key for secret conversation
Solution: Diffie Hellman key exchange algrorithm
There are several steps involved……………………
Step 1
Saghar and Suraya agree on a prime number P.
 P = 5
Step 2
Saghar and Suraya agree on a primitive root of their prime
number.
A primitive root is simply a number that has a special relationship with a
prime number causing it to generate a random sequence.
 Primitive roots are hard to find, so we must manually check if the number
we choose generates a list of random numbers.
Continued….
If it does, then it is a primitive root. Suppose g is a primitive root,
here g=3
 Let us test if the number 3 is a primitive root of 5.
We do this by getting the exponentiation/powers of our prime for
every positive whole number less than our prime number (basically
between 0 and 5 excluding 0 and 5).
3^1=3
 3^2=9
 3^3=27
 3^4=81
Continued…
 Then we set our upper limit of our output to the value of our prime,
by getting the remainder after division.
3 mod 5 = 3
9 mod 5 = 4
 27 mod 5 = 2 81 mod 5 = 1
 Notice that the numbers 3, 4, 2 and 1 are all unique (this is called a
full period). Also notice that the order of the numbers is not
sequential. This is the random property we were taking about earlier.
So now that we have found our primitive root we will note its value. g
= 3
Step 3
Saghar chooses a positive whole number as his secret key.
 a = 6
Step 4
Saghar computes his public key and sends it to Suraya.
 A = g^a mod P or 4 = 3^6 mod 5
A = 4
Note: This formula is the same one we used earlier to find our
primitive root and we are using the same values for g and P. This
means that whatever number Saghar chose for his private key, the
output will be one of the random numbers from our list. This
randomness is very important.
Step 5
Suraya chooses a positive whole number as her secret key.
b = 7
Step 6
Suraya compute her public key and sends it to saghar.
B = g^b mod P or 2 = 3^7 mod 5
B = 2
Step 7
Saghar and Suraya now compute
 a shared secret key [Shared Key] = [other persons public key]^[their own secret key]
mod P
Suraya:
Secret Key = S = B^a mod p (B=public key of Saghar, a=secret key of Suraya, q is the
primitive root)
S = 4^7 mod 5
S=4
Saghar:
Secret Key = S = B^a mod p (B=public key of Suraya, a=secret key of Saghar, q is the
primitive root)
S = 2^6 mod 5
 S = 4
Thank You
For Your Patience
Bakhtar University 12

Cryptography and Network security # Lecture 6

  • 1.
    Lec-6: Cryptography &Network Security Mr. Islahuddin Jalal MS (Cyber Security) – UKM Malaysia Research Title – 3C-CSIRT Model for Afghanistan BAKHTAR UNIVERSITY ‫باخترپوهنتون‬ ‫د‬ Bakhtar University 1
  • 2.
    Diffie-Helman Key ExchangeAlgorithm Used to exchange the secret key E.g Saghar and suraya want to communicate over a channel which is not secured. Where khkula wanted to listen the conversation of saghar and suraya Then they decided to use a mechanism where khkula should not understand the communication. They agreed on secret conversation. Problem: how to exchange the key for secret conversation Solution: Diffie Hellman key exchange algrorithm There are several steps involved……………………
  • 3.
    Step 1 Saghar andSuraya agree on a prime number P.  P = 5
  • 4.
    Step 2 Saghar andSuraya agree on a primitive root of their prime number. A primitive root is simply a number that has a special relationship with a prime number causing it to generate a random sequence.  Primitive roots are hard to find, so we must manually check if the number we choose generates a list of random numbers.
  • 5.
    Continued…. If it does,then it is a primitive root. Suppose g is a primitive root, here g=3  Let us test if the number 3 is a primitive root of 5. We do this by getting the exponentiation/powers of our prime for every positive whole number less than our prime number (basically between 0 and 5 excluding 0 and 5). 3^1=3  3^2=9  3^3=27  3^4=81
  • 6.
    Continued…  Then weset our upper limit of our output to the value of our prime, by getting the remainder after division. 3 mod 5 = 3 9 mod 5 = 4  27 mod 5 = 2 81 mod 5 = 1  Notice that the numbers 3, 4, 2 and 1 are all unique (this is called a full period). Also notice that the order of the numbers is not sequential. This is the random property we were taking about earlier. So now that we have found our primitive root we will note its value. g = 3
  • 7.
    Step 3 Saghar choosesa positive whole number as his secret key.  a = 6
  • 8.
    Step 4 Saghar computeshis public key and sends it to Suraya.  A = g^a mod P or 4 = 3^6 mod 5 A = 4 Note: This formula is the same one we used earlier to find our primitive root and we are using the same values for g and P. This means that whatever number Saghar chose for his private key, the output will be one of the random numbers from our list. This randomness is very important.
  • 9.
    Step 5 Suraya choosesa positive whole number as her secret key. b = 7
  • 10.
    Step 6 Suraya computeher public key and sends it to saghar. B = g^b mod P or 2 = 3^7 mod 5 B = 2
  • 11.
    Step 7 Saghar andSuraya now compute  a shared secret key [Shared Key] = [other persons public key]^[their own secret key] mod P Suraya: Secret Key = S = B^a mod p (B=public key of Saghar, a=secret key of Suraya, q is the primitive root) S = 4^7 mod 5 S=4 Saghar: Secret Key = S = B^a mod p (B=public key of Suraya, a=secret key of Saghar, q is the primitive root) S = 2^6 mod 5  S = 4
  • 12.
    Thank You For YourPatience Bakhtar University 12