You are on page 1of 11

Cryptography and Network Security

Presented By
Presented By
Md.
Md.Yousuf
YousufAli
Ali
ID:173311006
ID:173311006
Department
DepartmentofofComputer
ComputerScience
Science&&Engineering
Engineering
Varendra
VarendraUniversity
University
RSA Algorithm Math
9.2 Perform encryption and decryption using RSA algorithm where

a) p = 3, q = 11, e = 7, M=5 Solution: Encryption:


We know that; n = p * q C = Me mod n
= 3 * 11 = 33 = Me mod 33
Ø(n) = (p-1) * (q-1) = 57 mod 33
= (3-1) * (11-1) = 78,125 mod 33
= 2 * 10 = 20 = 14
Determine d: de = 1 mod 20 Decryption:
3 * 7 = 1 mod 20 M = Cd mod n
= Cd mod 33
Here: d = 3
= 143 mod 33
Public Key, KU = {e, n} = {7, 33} Private = 2744 mod 33
=5
Key, KR = {d, p, q} = {3, 3, 11}
9.3 In a public key system using RSA, you intercept the cypher text C = 10
sent to a user whose public key is e = 5, n = 35. What is the plaintext?
Solution:
We know that, n = p * q
Decryption:
35 = p * q M = Cd mod n
35 = 5 * 7 = Cd mod 35
So we find that: p = 5, q = 7 = 105 mod 35
Ø(n) = (p-1) * (q-1) = 100000 mod 35
= (5-1) * (7-1) =5
=4*6
= 24
Determine d: de = 1 mod 24

5 * 5 = 1 mod 24
Here: d = 5
Comparison between public key authority and public key certificate

Public key authority Public key certificate


Key back is not possible as the authority Key backup, it is possible as all keys are
never stores the keys it only sends to the stores in the certification authority.
corresponding request.
Key pairs are required as there is double There is no need of pair of key as only
encryption first with the authority and one key is require to encrypt the
second by initiator or responder which certificate which reduces the complexity.
increases the complexity.

Not possible as no record saved. Possible as each and every key is store
with the certificate.
Comparison between cipher feedback and output feedback

Cipher Feedback
Cipher Feedback (CFB) mode is very similar to CBC; the primary difference is CFB is
a stream mode. It uses feedback (the name for chaining when used in stream modes) to
destroy patterns. Like CBC, CFB uses an initialization vector and destroys patterns,
and errors propagate.

Output Feedback
Output Feedback (OFB) mode differs from CFB in the way feedback is accomplished.
CFB uses the previous ciphertext for feedback. The previous ciphertext is the subkey
XORed to the plaintext. OFB uses the subkey before it is XORed to the plaintext.
Since the subkey is not affected by encryption errors, errors will not propagate.
Man-in-the-Middle Attack

XA USER A
YA USER B XB
KAD1=* YB
KBD2=#

KAD1= YD1^XA
K(BD2)= YD2^XB
XD2
XD1
D YD2
YD1
KBD2=
KAD1=* KBD2= YB^XD2
KAD1= YA^XD1 #
Diffie-Hellman key exchange technique
Users A and B use the Diffie-Hellman key exchange technique with a
common prime q = 71 and a primitive root .
a. If user A has private key ,what is A’s public key ?
b. b. If user B has private key ,what is B’s public key ?
c. c. What is the shared secret key?
SOLUTION:
GIVEN THAT, AGREE ON PRIME NUMBER Q=71,
Α=7,XA=5,XB=12.
COMPUTE PUBLIC KEYS:
5
A’S PUBLIC KEY : YA = 7 MOD 71 = 51
12
B’S PUBLIC KEY :YB = 7 MOD 71 = 4

COMPUTE SHARED SECRET KEY AS:


XA 5
KAB= YB MOD Q = 4 MOD 71 = 30
XB 12
KAB= YA MOD Q = 51 MOD 71 = 30
Diffie-Hellman key exchange technique
Consider a Diffie-Hellman scheme with a common prime q = 11 and a primitive root α = 2 .
a. Show that 2 is a primitive root of 11.
b. b. If user A has public key ,what is A’s private key ?
c. c. If user B has public key ,what is the secret key shared with A?
SOLUTION:
2 4 8 5 10 9 7 3 6 1

GIVEN THAT, AGREE ON PRIME NUMBER


Q=11,Α=2,YA=9,YB=3.

X
WE KNOW THAT : YA = Α A MOD Q
IF 2^6 MOD 11 = 9 THEN
PRIVATE KEY: XA= 6

COMPUTE SHARED SESSION KEY AS:


XA 6
KAB= YB MOD Q = 3 MOD 11 = 3
Problem: If the prime number q = 19. It has primitive roots {2, 3, 10, 13, 14, 15},
We choose α=2

SOLUTION:
GENERATES A KEY PAIR AS FOLLOWS
1.PRIVATE KEY, XA = 16 4.S2 = K^(-1)(m-XAS1) mod (q-1)
2.YA = Α ^ XA MOD Q = Α ^16 MOD 19 = 5 = 11 ( 14 -(16)(13) ) mod 18
= - 2134 mod 18
3. PUBLIC KEY, YA = 4 =8
Verify the Signature as follows:
WANT TO SIGN A MESSAGE WITH HASH VALUE, M = 14 V1 = α^m mod q = 2^14 mod 19 = 6
1.SECRET KEY, K = 5 ,WHICH IS RELATIVELY PRIME TO Q- V2 = (YA)^S1(S1)^S2 mod q
= (5^13)*(13^8) mod 19
1 = 18
= (17*16) mod 19 = 272 mod 19 = 6
2.S1 = Α^K MOD Q = 2^5 MOD 19 = 13 Thus, the signature is valid.

3.K^ (-1) MOD (Q-1) = 5^(-1) MOD 18 = 1


Basic Uses of Message Authentication code (MAC)
THANK
YOU

You might also like