Presentation is loading. Please wait.

Presentation is loading. Please wait.

95-712 OOP/Java1 Public Key Crytography From: Introduction to Algorithms Cormen, Leiserson and Rivest.

Similar presentations


Presentation on theme: "95-712 OOP/Java1 Public Key Crytography From: Introduction to Algorithms Cormen, Leiserson and Rivest."— Presentation transcript:

1 95-712 OOP/Java1 Public Key Crytography From: Introduction to Algorithms Cormen, Leiserson and Rivest

2 95-712 OOP/Java2 Purpose Privacy: to send encrypted messages over an insecure channel. Authentication: To digitally sign messages. Public Key Cryptography was first introduced by Diffie and Hellman in 1976.

3 95-712 OOP/Java3 The RSA Public-Key Cryptosystem Developed by Rivest, Shamir, and Aldeman in 1977 Since then the field of cryptography has blossomed

4 95-712 OOP/Java4 The Cast of Characters Eve - always peeking at messages she should not be seeing. Mallory - always trying to manipulate messages she has no business manipulating. Bob and Alice - always trying to communicate over insecure channels. Trent - A trusted third party who tries to help Bob and Alice.

5 95-712 OOP/Java5 The RSA Public-Key Cryptosystem 1.Select at random two large prime numbers p and q. These numbers would normally be about 500 digits in length. 2.Compute n by the equation n = p X q. 3.Compute  (n) = (p –1) X (q –1) 4.Select a small odd integer e that is relatively prime to  (n)

6 95-712 OOP/Java6 The RSA Public-Key Cryptosystem 5. Compute d as the multiplicative inverse of e modulo  (n). A theorem in number theory asserts that d exists and is uniquely defined. 6. Publish the pair P = (e,n) as the RSA public key. 7. Keep secret the pair S = (d,n) as the RSA secret key.

7 95-712 OOP/Java7 The RSA Public-Key Cryptosystem 8. To encrypt a message M compute C = M e (mod n) 9. To decrypt a message C compute M = C d (mod n)

8 95-712 OOP/Java8 Key Selection Phase 1.Select at random two large prime numbers p and q. These numbers would normally be about 500 digits in length. p = 3 q = 11 2.Compute n by the equation n = p X q. n = 33 3. Compute  (n) = (p –1) X (q –1)  (n) = (2) X (10) = 20

9 95-712 OOP/Java9 Key Selection Phase 4. Select a small odd integer e that is relatively prime to  (n) p = 3 q = 11 n = 33  (n) = 20 e = 3

10 95-712 OOP/Java10 Key Selection Phase 5. Compute d as the multiplicative inverse of e, modulo  (n). A theorem in number theory asserts that d exists and is uniquely defined (since e and  (n) are relatively prime). We need a d so that ed mod  = 1 Let’s try 1. 3 X 1 mod 20 = 3 mod 20 = 3. Nope. p = 3 q = 11 n = 33  (n) = 20 e = 3

11 95-712 OOP/Java11 Key Selection Phase We need a d so that ed mod  = 1 Let’s try 2. 3 X 2 mod 20 = 6 mod 20 = 6. Nope. Let’s try 7. 3 X 7 mod 20 = 21 mod 20 = 1. We found it! We need a better way….we’ll see this soon. p = 3 q = 11 n = 33  (n) = 20 e = 3

12 95-712 OOP/Java12 Key Selection Phase 6. Publish the pair P = (e,n) as the RSA public key. “Hey everyone, my key pair is 3 and 33” 7. Keep secret the pair S = (d,n) as the RSA secret key. “I’m not telling anyone about 7 and 33!!” p = 3 q = 11 n = 33  (n) = 20 e = 3 d = 7

13 95-712 OOP/Java13 Message encoding phase e = 3 n = 33Bob’s public keys are Alice wants to send the letter ‘d’ to Bob. Suppose that we have a public code where ‘a’ = 0 ‘b’ = 1 ‘c’ = 2 ‘d’ = 3 and so on… Alice’s software knows that 8. To encrypt a message M compute C = M e (mod n) = 3 3 mod 33 = 27 mod 33 = 27

14 95-712 OOP/Java14 Message decoding phase d = 7 n = 33Bob’s private keys are Bob receives a 27 from Alice: 9. To decrypt a message C compute M = C d (mod n) = 27 7 mod 33 = 10460353203 mod 33 = 3 (which is ‘d’)


Download ppt "95-712 OOP/Java1 Public Key Crytography From: Introduction to Algorithms Cormen, Leiserson and Rivest."

Similar presentations


Ads by Google