Crypto Unit-Iii CSIT
Crypto Unit-Iii CSIT
(53 * 53 #53 + 53 « 53) mod 23 = (19? + 19? « 19) mod 23
> (10+ 10+ 10 + 10+ 10) = (16 * 16 +16)
> (10? * 10? + 10)mod 23 => (16? + 16) mod 23
= (8+ 8+ 10) > (3 +16)
= (64+ 10) mod 23 = 48 mod 23
= (18+ 10) 32
= 180 mod 23
S19
Collegenote Prepared By: Jayanta PoudelSEEM Crprography Reference Note
Solution:
i) Here,p = 11 &g =2
2° mod 11 = 2mod 11 =2
2? mod 11=4mod 11=4
23 mod 11 = 8mod 11=8
2* mod 11 = 16 mod 11 = 5
25 mod 11 = 32 mod 11 = 10
26 mod 11 = 64 mod 11 =9
27 mod 11 = 128 mod 11
2® mod 11 = 256 mod 11
2° mod 11 = 512 mod 11
2! mod 11 = 1024 mod 11
Here all values are distinct and consists of integers 1 to 10 (ie. 1 to p — 1). Hence, 2 is a
primitive root of 11
ii) User A’s public key Yq =
A’s private key Xq =?
We have,
Y4 = g*4mod p
9 = 24 mod 11
From this equation,
X, =6, because 2° mod 11 =9
+ A's private key X, =6.
iii) B’s public key Yg = 3
Now,
K = (¥)*4 mod p
3° mod 11
29 mod 11
2 Shared key K =3.
Collegenote Prepared By: Jayanta PoudelCryptography Reference Note
Man-In-Middle Attack
A man-in-middle attack is a form of eavesdropping where communication between two users
is monitored and modified by an unauthorized party. Generally, the attacker actively
eavesdrops by intercepting public key message exchanged and retransmit the message while
replacing the requested key with his own.
Diffie-Hellman key exchange is insecure against a man-in-the-middle attack. Suppose Alice
and Bob wish to exchange keys aud Darth is adversary. The attack proceeds as follows:
1. Darth prepares for attack by generating two random private key’s Xp; & Xpp and then
computing the corresponding public keys Yp1&¥p2. [Yp, = g*tmod p &Yp2 =
g*??mod p ].
Alice transmits ¥q to Bob.
Darth intercepts Y4 and transmits ¥,, to Bob. Darth also calculates K, = (¥4)*2? mod p
Bob receives ¥p, and calculates K, = (Yp1)*® mod p.
Bob transmits ¥, to Alice
Darth intercepts ¥p and transinits ¥p> to Alice. Darth calculates K, = (¥g)** mod p.
Alice receives ¥p. and calculates K, = (Yp2)*4 mod p.
At this point, Bob and Alice think that they share a secret key but instead Bob and Darth share
secret key K, and Alice and Darth share sectet key Kp.
Example
Let p=11&g=2
Let Alice's private key Xq = 5.
Yq = g*4 mod p = 25 mod 11 = 10
Let Bob’s private key Xq = 3.
Yq = 9*8 mod p = 2? mod 11 =
Nw ABN
I. Darth’s two private keys: Let Xp; = 6 &Xpp =
Darth calculates Yp, = g*°! mod p = 2°mod11=9 and Yp2 = g*?? mod p =
2° mod 11 = 6
2. Alice transmits ¥; = 10 to Bob.
3. Darth intercepts Yq and transmits Yp,=9 to Bob. And Darth calculates K, =
(a)*?? mod p = 10° mod 11 = 10.
4. Bobreceives ¥>, = 9 and calculates Ky = (Yp1)** mod p = 9" mod 11 = 3.
5. Bob transmits ¥, = 8 to Alice.
6. Darth intercepts Yp and transmits Yp,=6 to Alice. And Darth calculates K, =
(¥g)*! mod p = 8° mod 11 = 3.
7. Alice receives ¥p2 = 6 and calculates K = (Yp2)*4 mod p = 65 mod 11 = 10.
Here Bob and Darth share secret key Ki, = 3 & Alice and Darth share secret key K = 10
Collegenote Prepared By: Jayanta PoudelEEN Cryptography Reference Note
- RSA algorithm is public key cryptography i.e. it works on two different keys ie. public
‘key and private key.
- The public key can be known to everyone and is used for encrypting message. Message
encrypted with the public key can only be decrypted using the private key.
Algorithm
RSA key generation:
2. Choose two distinct large prime numbers p and q.
2. Compute n = pq, nis used as modulus for both public and private keys.
3. Compute the totient: 6(n) = (p - 1)(q - 1).
4, Choose an integer e such that 1 You might also like