43
POON TENG HIN

POON TENG HIN. RSA Shamir’s Three-Pass Protocol Other issues

Embed Size (px)

Citation preview

Page 1: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

POON TENG HIN

Page 2: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

RSA

Shamir’s Three-Pass Protocol

Other issues

Page 3: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues
Page 4: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

The locks in computer network

1-1 mapping function f so that c = f(m)

Page 5: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

The keys in computer network

so that  f-1(c) = f-1(f(m)) = (f-1f)(m) = m

Page 6: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

Function Modulo Operation Greatest Common Divisor Multiplicative Inverse Number theory  Prime number

Page 7: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

(x × y) mod n = 1.

The integer y is called a multiplicative inverse of x, usually denoted x−1 (it

is unique if it exists).

Page 8: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

People keep finding large prime numbers for computer Security.

How the prime number areused?

Page 9: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

RSA is an algorithm for public-key cryptography

By Ron Rivest, Adi Shamir, Leonard Adleman

Page 10: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

Because of security, high strength Encryption Digital signatures E.g electronic transactions, software certification.

Page 11: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

Encryption: C = Me mod n

Decryption: M = Cd mod n

Page 12: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

ABCDEFGHIJKLMNOPQRSTUVWXYZ 1234…………………………………26 Public key: n = 35, e = 5 C = Me mod n Private key: d = 5 M = Cd mod n My word: “17 21 14 33 8” “ 6 30 11” Also, try to give me your words

Page 13: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

p, q, (n) must be kept secret. It is believed that determine (n) given n is

equivalent to factoring n. With presently known algorithms,

determining d given e and n, appears to be at least as time-consuming as the factoring problem.

So use factoring as the benchmark for security evaluation.

Page 14: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

http://www.cs.drexel.edu/~jpopyack/IntroCS/HW/ASCII.html

A website of ASCII code

Page 15: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

Plaintext: M ( M = {0,1}*)Cipher text: C (C = {0,1}*)

It needs two distinct primes p and qΦ(n) = (p-1)(q-1)select an integer e such that gcd(e, Φ(n)) = 1 Where n = pq, n>MCompute the d where ed = 1 (mod Φ(n))Public key: (e,n)Private key: d

Page 16: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

Randomly choose p and q And n = p X q

A sample n from http://www.rsa.com/rsalabs/node.asp?id=2093 RSA-576:

188198812920607963838697239461650439807163563379417382700763356422988859715234665485319060606504743045317388011303396716199692321205734031879550656996221305168759307650257059

Page 17: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

gcd(e, Φ(n)) = 1 and e > 1

A table to find e and d:

Page 18: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

Φ(n) is the number of positive integers less than n that is relative prime to n

Example Φ(6) : the GCD(x,6) = 1 when x = 1,5 so Φ(6) = 2

Page 19: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

Φ(p) = p-1 for any prime number p

Φ(pq) = (p-1)(q-1) for any two distinct primes p and q

Page 20: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

Euler’s: For every integer a and n that are relatively prime,

aΦ(n)mod n = 1Fermat’s :If n = p is prime, ap-1 mod p = 1

Page 21: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

ed = 1 (mod Φ(n)) or d = e-1 mod n Such that ex + Φ(n) y = 1 and d is the value

of x

One of the method is Euclidean algorithm

http://www.di-mgt.com.au/euclidean.html

Page 22: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

Fo example Φ(n) =20, e =3Firstly, gcd(20,3) = 1 if the inverse exists.We use Euclidean algorithm:20 = 3 x 6 +2 3 = 2 x 1 + 11 = 3 – 1X2 = 3 – 1 X (20 – 6 X 3) = -1 X 20 + 7 X 3 (ex + ny = 1) so d = 7

Page 23: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

66 = 1 × 35 + 31 gcd(35, 31) 35 = 1 × 31 + 4 gcd(31, 4) 31 = 7 × 4 + 3 gcd(4, 3) 4 = 1 × 3 + 1 gcd(3, 1) 3 = 3 × 1 + 0 gcd(1, 0) So, gcd(66, 35) = gcd(35, 31) = gcd(31, 4) =

gcd(4, 3) = gcd(3, 1) = gcd(1, 0) = 1.

Page 24: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

Encryption: C = Me mod n Decryption: M = Cd mod nNeeds two distinct primes p and qAnd Φ(n) = (p-1)(q-1)select an integer e such that gcd(e, Φ(n)) = 1 Where n = pq, n>MCompute the d where ed = 1 (mod Φ(n))Public key: (e,n)Private key: d

Page 25: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

http://www-cs-students.stanford.edu/~tjw/jsbn/rsa2.html

http://www.cs.drexel.edu/~jpopyack/IntroCS/HW/RSAWorksheet.html

Page 26: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues
Page 27: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues
Page 28: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues
Page 29: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

1.A lock the box by his lock A

2.A------------- B (Box with lock A) 3.B lock the box by his lock B

4.B---------------A (Box with lock A & B) 5.A unlock his lock A

6.A --------------- B (Box with lock B) 7. B unlock his lock B ~ ~finish~

Page 30: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

This is the protocol similar to the answer of the IQ question

This is different to RSA In this protocol, we need a prime p which is

a public knowledge.

Page 31: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

A selects a random number a with gcd(a, p-1) = 1 B selects a random number b with gcd(b,p-1) = 1

a-1 and b-1

are the inverse of a and b of mod p-1

Page 32: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

A computes k1 = ka mod p and send k1 to B B computes k2 = k1

b mod p and send k2 to A A computes k3 = k2

a-1mod p and send k3 to B

Finally, B computes k = k3b-1 mod p

and get k.

Page 33: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

Q1.Using slide 13, what is the message under:

“12 21 10 24 20 4 15 14” “15 14 10” “”4 24 “6 4 14 4 24 8 10 9”

Q2. Find d if Φ(n) = 58, e = 27 (use Euclidean algorithm)

Page 34: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

Others issues I would like to share. I suggest you may think about them.

Page 35: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

Computer and Communications Security COMP364

By Prof. Cunsheng Ding

Page 36: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

People like math will like this game.

Page 37: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

Encryption: c = Ek(m), where Ek is usually applied to blocks of the plaintext m.

Decryption: m = Dk(c), where Dk is usually applied to blocks or characters of the ciphertext c.

Page 38: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

Example: Let d = 4 and define f by i : 0 1 2 3 f(i) : 2 0 3 1 Then f is a permutation of Z4. The inverse permutation f−1 is given by i : 0 1 2 3 f-1(i) : 1 3 0 2

Page 39: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

E.g

Page 40: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues
Page 41: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues
Page 42: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

A B C1| plan1 plan3 plan22| plan2 plan1 plan33| plan3 plan2 plan1Conclusion:Most people think that: plan1 is better than plan2plan2 is better than plan3plan3 is better than plan1

Page 43: POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues

ByeBye