spring 12 berg jake

22
History Modular Arithmetic Your own RSA system Example Proof An Introduction to the RSA Encryption Method Jake Salterberg April 17, 2012 Jake Salterberg An Introduction to the RSA Encryption Method

Upload: sumit-ray

Post on 21-Jul-2016

214 views

Category:

Documents


0 download

DESCRIPTION

awesome book about humour

TRANSCRIPT

Page 1: Spring 12 Berg Jake

HistoryModular Arithmetic

Your own RSA systemExample

Proof

An Introduction to the RSA Encryption Method

Jake Salterberg

April 17, 2012

Jake Salterberg An Introduction to the RSA Encryption Method

Page 2: Spring 12 Berg Jake

HistoryModular Arithmetic

Your own RSA systemExample

Proof

Outline

1 History

2 Modular Arithmetic

3 Your own RSA system

4 Example

5 Proof

Jake Salterberg An Introduction to the RSA Encryption Method

Page 3: Spring 12 Berg Jake

HistoryModular Arithmetic

Your own RSA systemExample

Proof

History

RSA stands for Rivest, Shamir, and Adelman, the last namesof the designers

It was first published in 1978 as one of the first public-keycrytographic systems

A public-key system means the algorithm for encrypting amessage is publicly known but the algorithm to decrypt themessage is only privately known (by the person who set up thesystem)

Jake Salterberg An Introduction to the RSA Encryption Method

Page 4: Spring 12 Berg Jake

HistoryModular Arithmetic

Your own RSA systemExample

Proof

Modular Arithmetic Review

Definition

a ≡ b (mod c) ⇐⇒ a = b + kc for some integer k.

Example

1 21 ≡ 1 (mod 4) because 21 = 1 + (5)4

2 52 ≡ 3 (mod 11) because 25 = 3 + (2)11

3 −1 ≡ 7 (mod 8) because −1 = 7 + (−1)8

4 713 ≡ 7 (mod 8)713 ≡ (−1)13 ≡ −1 ≡ 7 (mod 8)

Jake Salterberg An Introduction to the RSA Encryption Method

Page 5: Spring 12 Berg Jake

HistoryModular Arithmetic

Your own RSA systemExample

Proof

Modular Arithmetic Review

Definition

a ≡ b (mod c) ⇐⇒ a = b + kc for some integer k.

Example

1 21 ≡ 1 (mod 4) because 21 = 1 + (5)4

2 52 ≡ 3 (mod 11) because 25 = 3 + (2)11

3 −1 ≡ 7 (mod 8) because −1 = 7 + (−1)8

4 713 ≡ 7 (mod 8)713 ≡ (−1)13 ≡ −1 ≡ 7 (mod 8)

Jake Salterberg An Introduction to the RSA Encryption Method

Page 6: Spring 12 Berg Jake

HistoryModular Arithmetic

Your own RSA systemExample

Proof

Modular Arithmetic Review

Definition

a ≡ b (mod c) ⇐⇒ a = b + kc for some integer k.

Example

1 21 ≡ 1 (mod 4) because 21 = 1 + (5)4

2 52 ≡ 3 (mod 11) because 25 = 3 + (2)11

3 −1 ≡ 7 (mod 8) because −1 = 7 + (−1)8

4 713 ≡

7

(mod 8)

713 ≡ (−1)13 ≡ −1 ≡ 7 (mod 8)

Jake Salterberg An Introduction to the RSA Encryption Method

Page 7: Spring 12 Berg Jake

HistoryModular Arithmetic

Your own RSA systemExample

Proof

Modular Arithmetic Review

Definition

a ≡ b (mod c) ⇐⇒ a = b + kc for some integer k.

Example

1 21 ≡ 1 (mod 4) because 21 = 1 + (5)4

2 52 ≡ 3 (mod 11) because 25 = 3 + (2)11

3 −1 ≡ 7 (mod 8) because −1 = 7 + (−1)8

4 713 ≡

7

(mod 8)713 ≡ (−1)13

≡ −1 ≡ 7 (mod 8)

Jake Salterberg An Introduction to the RSA Encryption Method

Page 8: Spring 12 Berg Jake

HistoryModular Arithmetic

Your own RSA systemExample

Proof

Modular Arithmetic Review

Definition

a ≡ b (mod c) ⇐⇒ a = b + kc for some integer k.

Example

1 21 ≡ 1 (mod 4) because 21 = 1 + (5)4

2 52 ≡ 3 (mod 11) because 25 = 3 + (2)11

3 −1 ≡ 7 (mod 8) because −1 = 7 + (−1)8

4 713 ≡

7

(mod 8)713 ≡ (−1)13 ≡ −1

≡ 7 (mod 8)

Jake Salterberg An Introduction to the RSA Encryption Method

Page 9: Spring 12 Berg Jake

HistoryModular Arithmetic

Your own RSA systemExample

Proof

Modular Arithmetic Review

Definition

a ≡ b (mod c) ⇐⇒ a = b + kc for some integer k.

Example

1 21 ≡ 1 (mod 4) because 21 = 1 + (5)4

2 52 ≡ 3 (mod 11) because 25 = 3 + (2)11

3 −1 ≡ 7 (mod 8) because −1 = 7 + (−1)8

4 713 ≡

7

(mod 8)713 ≡ (−1)13 ≡ −1 ≡ 7 (mod 8)

Jake Salterberg An Introduction to the RSA Encryption Method

Page 10: Spring 12 Berg Jake

HistoryModular Arithmetic

Your own RSA systemExample

Proof

Modular Arithmetic Review

Definition

a ≡ b (mod c) ⇐⇒ a = b + kc for some integer k.

Example

1 21 ≡ 1 (mod 4) because 21 = 1 + (5)4

2 52 ≡ 3 (mod 11) because 25 = 3 + (2)11

3 −1 ≡ 7 (mod 8) because −1 = 7 + (−1)8

4 713 ≡ 7 (mod 8)713 ≡ (−1)13 ≡ −1 ≡ 7 (mod 8)

Jake Salterberg An Introduction to the RSA Encryption Method

Page 11: Spring 12 Berg Jake

HistoryModular Arithmetic

Your own RSA systemExample

Proof

Necessary Theorems for RSA - φ(n)

Definition

If n is a positive integer, then Euler’s phi function, φ(n), returnsthe number of integers k in the range 1 ≤ k ≤ n for whichgcd(n, k) = 1.

Theorem (Euler’s Theorem)

If n > 0 and a are relatively prime integers, thenaφ(n) ≡ 1 (mod n).

Corollary

If b1 ≡ b2 (mod φ(n)), then ab1 ≡ ab2 (mod n).

Jake Salterberg An Introduction to the RSA Encryption Method

Page 12: Spring 12 Berg Jake

HistoryModular Arithmetic

Your own RSA systemExample

Proof

Necessary Theorems for RSA - φ(n)

Definition

If n is a positive integer, then Euler’s phi function, φ(n), returnsthe number of integers k in the range 1 ≤ k ≤ n for whichgcd(n, k) = 1.

Theorem (Euler’s Theorem)

If n > 0 and a are relatively prime integers, thenaφ(n) ≡ 1 (mod n).

Corollary

If b1 ≡ b2 (mod φ(n)), then ab1 ≡ ab2 (mod n).

Jake Salterberg An Introduction to the RSA Encryption Method

Page 13: Spring 12 Berg Jake

HistoryModular Arithmetic

Your own RSA systemExample

Proof

Necessary Theorems for RSA - φ(n)

Definition

If n is a positive integer, then Euler’s phi function, φ(n), returnsthe number of integers k in the range 1 ≤ k ≤ n for whichgcd(n, k) = 1.

Theorem (Euler’s Theorem)

If n > 0 and a are relatively prime integers, thenaφ(n) ≡ 1 (mod n).

Corollary

If b1 ≡ b2 (mod φ(n)), then ab1 ≡ ab2 (mod n).

Jake Salterberg An Introduction to the RSA Encryption Method

Page 14: Spring 12 Berg Jake

HistoryModular Arithmetic

Your own RSA systemExample

Proof

Setting up your own RSA system

Pick p and q to be large prime numbers, and let n = pq.Then pick an e such that gcd(e, φ(n)) = 1. e is yourencryption exponent.

Now, solve for d where ed ≡ 1 (mod φ(n)). This can be donewith something called the Extended Euclidean Algorithm, orby solving the Linear Diophantine Equation: ed = 1 + kφ(n).d is your decryption exponent.

You now have your own RSA system!

Public Key - (n, e)Private Key - (d)

Jake Salterberg An Introduction to the RSA Encryption Method

Page 15: Spring 12 Berg Jake

HistoryModular Arithmetic

Your own RSA systemExample

Proof

Setting up your own RSA system

Pick p and q to be large prime numbers, and let n = pq.Then pick an e such that gcd(e, φ(n)) = 1. e is yourencryption exponent.

Now, solve for d where ed ≡ 1 (mod φ(n)). This can be donewith something called the Extended Euclidean Algorithm, orby solving the Linear Diophantine Equation: ed = 1 + kφ(n).d is your decryption exponent.

You now have your own RSA system!

Public Key - (n, e)Private Key - (d)

Jake Salterberg An Introduction to the RSA Encryption Method

Page 16: Spring 12 Berg Jake

HistoryModular Arithmetic

Your own RSA systemExample

Proof

Setting up your own RSA system

Pick p and q to be large prime numbers, and let n = pq.Then pick an e such that gcd(e, φ(n)) = 1. e is yourencryption exponent.

Now, solve for d where ed ≡ 1 (mod φ(n)). This can be donewith something called the Extended Euclidean Algorithm, orby solving the Linear Diophantine Equation: ed = 1 + kφ(n).d is your decryption exponent.

You now have your own RSA system!

Public Key - (n, e)Private Key - (d)

Jake Salterberg An Introduction to the RSA Encryption Method

Page 17: Spring 12 Berg Jake

HistoryModular Arithmetic

Your own RSA systemExample

Proof

Using your RSA system

When someone wants to send you a message they:

1 Convert their message into a number in a simple agreed uponway such as a=01, b=02, c=03 . . .

2 Compute the ciphertext c ≡ me (mod n)

3 Send you c

To decrypt their message you:

1 Compute m ≡ cd (mod n)

2 Convert their message back into letters and words

Jake Salterberg An Introduction to the RSA Encryption Method

Page 18: Spring 12 Berg Jake

HistoryModular Arithmetic

Your own RSA systemExample

Proof

Using your RSA system

When someone wants to send you a message they:

1 Convert their message into a number in a simple agreed uponway such as a=01, b=02, c=03 . . .

2 Compute the ciphertext c ≡ me (mod n)

3 Send you c

To decrypt their message you:

1 Compute m ≡ cd (mod n)

2 Convert their message back into letters and words

Jake Salterberg An Introduction to the RSA Encryption Method

Page 19: Spring 12 Berg Jake

HistoryModular Arithmetic

Your own RSA systemExample

Proof

Example (Set-Up and Encryption)

First, set up your RSA system.

Pick p = 5, q =11. Let n = pq = 55. Now pick e = 3.

Then ed ≡ 1 (mod φ(n)) =⇒ d = 27. Since3 ∗ 27 ≡ 81 ≡ 1 (mod 40).

Your RSA system is now set up. Make n and e public.

Let’s say that your friend wants to send you the message m=18.

They will compute c where c ≡ me (mod n).c ≡ me ≡ 183 ≡ 5832 ≡ 2 (mod 55) because183 = 5832 = 2 + (106)55.

Your friend will send you the ciphertext c = 2.

Jake Salterberg An Introduction to the RSA Encryption Method

Page 20: Spring 12 Berg Jake

HistoryModular Arithmetic

Your own RSA systemExample

Proof

Example (Set-Up and Encryption)

First, set up your RSA system.

Pick p = 5, q =11. Let n = pq = 55. Now pick e = 3.

Then ed ≡ 1 (mod φ(n)) =⇒ d = 27. Since3 ∗ 27 ≡ 81 ≡ 1 (mod 40).

Your RSA system is now set up. Make n and e public.

Let’s say that your friend wants to send you the message m=18.

They will compute c where c ≡ me (mod n).c ≡ me ≡ 183 ≡ 5832 ≡ 2 (mod 55) because183 = 5832 = 2 + (106)55.

Your friend will send you the ciphertext c = 2.

Jake Salterberg An Introduction to the RSA Encryption Method

Page 21: Spring 12 Berg Jake

HistoryModular Arithmetic

Your own RSA systemExample

Proof

Example (Decryption)

You just recieved c = 2 from your friend.

Use your private key, d = 27, to compute their message m.m ≡ cd ≡ 227 ≡ 134217728 ≡ 18 (mod 55) because227 = 134217728 = 18 + (2440322)55.

So your friend sent you the message m = 18.

Jake Salterberg An Introduction to the RSA Encryption Method

Page 22: Spring 12 Berg Jake

HistoryModular Arithmetic

Your own RSA systemExample

Proof

RSA Proof

Why does m ≡ cd (mod n) work to get you back the originalmessage m?

Proof.

Let p and q be prime, n = pq, ed ≡ 1 (mod φ(n)). Then ∃k ∈ Zsuch that ed = 1 + kφ(n).Also let m < n be a message and let c ≡ me (mod n). Then,cd ≡ (me)d ≡ med ≡ m1+kφ(n) ≡ m (mod n).

Jake Salterberg An Introduction to the RSA Encryption Method