an introduction to cryptographybanach.millersville.edu/~bob/presentations/spotlight2009.pdf ·...

61
An Introduction to Cryptography Spotlight on Science J. Robert Buchanan Department of Mathematics 25 March 2009 J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 1 / 33

Upload: others

Post on 10-Jan-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

An Introduction to CryptographySpotlight on Science

J. Robert Buchanan

Department of Mathematics

25 March 2009

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 1 / 33

Page 2: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Introduction

What is Cryptography?

cryptography: study of methods for sending messages in a form thatonly be understood by the recipient.

cryptanalysis: study of methods for defeating cryptography.cryptology: study of both cryptography and cryptanalysis.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 2 / 33

Page 3: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Introduction

Cryptology Throughout History (1 of 3)

Subject as old as recorded history.

Julius Caesar used substitution ciphers for military and personalcommunication.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 3 / 33

Page 4: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Introduction

Cryptology Throughout History (1 of 3)

Subject as old as recorded history.Julius Caesar used substitution ciphers for military and personalcommunication.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 3 / 33

Page 5: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Introduction

History (2 of 3)

Enigma was patented by ArthurScherbius in 1918 and became thefoundation of German andJapanese codes during WWII.(Photo credit: JRB)

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 4 / 33

Page 6: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Introduction

History (3 of 3)

Since WWII the foundation of cryptology has been mathematics,particularly number theory.

(Photo credit: JRB)

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 5 / 33

Page 7: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Introduction

Terminology

Plaintext: the un-encrypted, clearly readable form of a message.Ciphertext: the encrypted form of the plaintext, readable only with the

key to the cipher.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 6 / 33

Page 8: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography

Public Key Cryptography

In some cryptographic systems, the key used to encipher the messagemust be kept hidden from the public and should be known only by thesender and recipient of the message.

There are other cryptographic systems in which each party has aprivate key (which they keep secret) and a public key which theypublish so that others may send them encrypted messages which onlythey can decrypt. The public key functions as the recipient’scryptographic “telephone number”.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 7 / 33

Page 9: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography

Overview of Public Key Cryptography

Suppose Alice wants to send Bob a message which only Bob will beable to read.

1 Alice looks up Bob’s public key and enciphers the plaintext usinghis public key.

2 Alice sends Bob the ciphertext (or even publishes it in thenewspaper!).

3 Bob decrypts the ciphertext using his private key.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 8 / 33

Page 10: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography

Overview of Public Key Cryptography

Suppose Alice wants to send Bob a message which only Bob will beable to read.

1 Alice looks up Bob’s public key and enciphers the plaintext usinghis public key.

2 Alice sends Bob the ciphertext (or even publishes it in thenewspaper!).

3 Bob decrypts the ciphertext using his private key.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 8 / 33

Page 11: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography

Overview of Public Key Cryptography

Suppose Alice wants to send Bob a message which only Bob will beable to read.

1 Alice looks up Bob’s public key and enciphers the plaintext usinghis public key.

2 Alice sends Bob the ciphertext (or even publishes it in thenewspaper!).

3 Bob decrypts the ciphertext using his private key.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 8 / 33

Page 12: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography RSA

Outline

1 Introduction

2 Public Key CryptographyRSAEuclidean Algorithm and FriendsEuler Phi FunctionHow it all works

3 For More Information

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 9 / 33

Page 13: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography RSA

RSA Public Key Cryptography

One of the most popular public key cryptographic systems is known asRSA.

It was developed by

Adi Shamir Ronald Rivest Leonard Adelman.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 10 / 33

Page 14: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography RSA

A Little Number Theory I

DefinitionA prime number is a whole number p greater than 1 whose onlydivisors are p and 1. An integer which is not prime is called acomposite number.

DefinitionIf a and b are positive integers, the greatest common divisor of a andb is number denoted gcd(a,b) and is the positive integer d satisfyingboth of the following properties:

d divides a and d divides b,if c is an integer and c divides a and c divides b, then c divides d .

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 11 / 33

Page 15: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography RSA

A Little Number Theory II

DefinitionIf gcd(a,b) = 1 we say that a and b are relatively prime.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 12 / 33

Page 16: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography RSA

Examples

Example

4 = gcd(16,60)

13 = gcd(13,65)

? = gcd(72,81)

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 13 / 33

Page 17: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography Euclidean Algorithm and Friends

Outline

1 Introduction

2 Public Key CryptographyRSAEuclidean Algorithm and FriendsEuler Phi FunctionHow it all works

3 For More Information

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 14 / 33

Page 18: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography Euclidean Algorithm and Friends

Euclidean Algorithm

To find the gcd(a,b):

1 If b divides a evenly, gcd(a,b) = b.2 If not, replace a by b and replace b by the remainder of a÷ b and

go back to step 1.

A Java applet implementing the Euclidean Algorithm is also available.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 15 / 33

Page 19: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography Euclidean Algorithm and Friends

Example

Example

Find gcd(105,56) using the Euclidean Algorithm.

a b105 5656 4949 7

gcd(105,56) = 7

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 16 / 33

Page 20: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography Euclidean Algorithm and Friends

Example

Example

Find gcd(105,56) using the Euclidean Algorithm.

a b105 5656 4949 7

gcd(105,56) = 7

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 16 / 33

Page 21: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography Euclidean Algorithm and Friends

Linear Combinations

DefinitionIf a and b are integers, then an expression of the from ax + by where xand y are also integers is called a linear combination of a and b.

TheoremIf a and b are integers, then gcd(a,b) is the smallest positive integerwhich can be written as a linear combination of a and b.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 17 / 33

Page 22: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography Euclidean Algorithm and Friends

Linear Combinations

DefinitionIf a and b are integers, then an expression of the from ax + by where xand y are also integers is called a linear combination of a and b.

TheoremIf a and b are integers, then gcd(a,b) is the smallest positive integerwhich can be written as a linear combination of a and b.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 17 / 33

Page 23: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography Euclidean Algorithm and Friends

Modular Arithmetic

DefinitionTwo integers n and m are congruent modulo k (or equivalentmodulo k ) written symbolically as

n ≡ m (mod k)

when k divides n −m evenly.

Example

65 ≡ 13 (mod 26) since65− 13

26= 2.

CorollaryIf a and b are relatively prime then b has a multiplicative inversemodulo a.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 18 / 33

Page 24: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography Euclidean Algorithm and Friends

Modular Arithmetic

DefinitionTwo integers n and m are congruent modulo k (or equivalentmodulo k ) written symbolically as

n ≡ m (mod k)

when k divides n −m evenly.

Example

65 ≡ 13 (mod 26) since65− 13

26= 2.

CorollaryIf a and b are relatively prime then b has a multiplicative inversemodulo a.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 18 / 33

Page 25: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography Euclidean Algorithm and Friends

Extended Euclidean Algorithm

To find x and y such that

gcd(a,b) = ax + by

use the tabular method.

Start the table like this:

x y d1 0 a0 1 b? ? ?

To fill in the next row:1 Find q and r such that

ab

= q +rb

.

2 Multiply next to last row by qand subtract from third to lastrow.

3 Keep appending rows to thetable until r = 0.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 19 / 33

Page 26: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography Euclidean Algorithm and Friends

Extended Euclidean Algorithm

To find x and y such that

gcd(a,b) = ax + by

use the tabular method.

Start the table like this:

x y d1 0 a0 1 b? ? ?

To fill in the next row:1 Find q and r such that

ab

= q +rb

.

2 Multiply next to last row by qand subtract from third to lastrow.

3 Keep appending rows to thetable until r = 0.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 19 / 33

Page 27: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography Euclidean Algorithm and Friends

Example

x y d1 0 1050 1 561 −1 49−1 2 7

(−1)(105) + (2)(56) = 7

A Java applet implementing the Extended Euclidean Algorithm is alsoavailable.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 20 / 33

Page 28: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography Euclidean Algorithm and Friends

Finding a Multiplicative Inverse

Verify that 23 and 29 are relatively prime and find the multiplicativeinverse of 29 modulo 23.

x y d1 0 290 1 231 −1 6−3 4 54 −5 1

1 ≡ (4)(29) + (−5)(23) (mod 23)

1 ≡ (4)(29) (mod 23)

So 4 is the multiplicative inverse of 29 modulo 23.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 21 / 33

Page 29: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography Euler Phi Function

Outline

1 Introduction

2 Public Key CryptographyRSAEuclidean Algorithm and FriendsEuler Phi FunctionHow it all works

3 For More Information

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 22 / 33

Page 30: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography Euler Phi Function

More Number Theory

DefinitionIf N is the set of all positive integers then for each positive integer ndefine φ(n) to be the number of positive integers less than or equal ton which are relatively prime to n. Such a function φ is called the Eulerphi function.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 23 / 33

Page 31: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography Euler Phi Function

Euler Phi Function (1 of 2)

Do you notice a pattern?

20 40 60 80 100n

20

40

60

80

ΦHnL

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 24 / 33

Page 32: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography Euler Phi Function

Euler Phi Function (2 of 2)

n φ(n) n φ(n)

1 1 6 22 1 7 63 2 8 44 2 9 65 4 10 4

LemmaIf p is prime, then φ(p) = p − 1.

LemmaIf p and q are distinct primes, then

φ(pq) = φ(p)φ(q) = (p − 1)(q − 1).

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 25 / 33

Page 33: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography Euler Phi Function

Euler Phi Function (2 of 2)

n φ(n) n φ(n)

1 1 6 22 1 7 63 2 8 44 2 9 65 4 10 4

LemmaIf p is prime, then φ(p) = p − 1.

LemmaIf p and q are distinct primes, then

φ(pq) = φ(p)φ(q) = (p − 1)(q − 1).

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 25 / 33

Page 34: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography Euler Phi Function

Euler Phi Function (2 of 2)

n φ(n) n φ(n)

1 1 6 22 1 7 63 2 8 44 2 9 65 4 10 4

LemmaIf p is prime, then φ(p) = p − 1.

LemmaIf p and q are distinct primes, then

φ(pq) = φ(p)φ(q) = (p − 1)(q − 1).

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 25 / 33

Page 35: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography How it all works

Outline

1 Introduction

2 Public Key CryptographyRSAEuclidean Algorithm and FriendsEuler Phi FunctionHow it all works

3 For More Information

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 26 / 33

Page 36: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography How it all works

Getting Public and Private Keys

A public agency (call it the “Key Utility”)

1 selects two large primes p andq,

2 forms the product n = pq,3 computes φ(n),4 selects integer e such that

gcd(e, φ(n)) = 1,5 finds the multiplicative inverse

d of e (mod φ(n)),6 private key is d , public key is

(e,n).

1 let p = 1009 and q = 2003.

2 n = 20210273 φ(2021027) = (1009−

1)(2003− 1) = 20180164 e = 1003 (for example)5 d = 1311811 (for this e)6 private key is 1311811, public

key is (1003,2021027).

Remark: only the Key Utility knows p and q.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 27 / 33

Page 37: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography How it all works

Getting Public and Private Keys

A public agency (call it the “Key Utility”)

1 selects two large primes p andq,

2 forms the product n = pq,

3 computes φ(n),4 selects integer e such that

gcd(e, φ(n)) = 1,5 finds the multiplicative inverse

d of e (mod φ(n)),6 private key is d , public key is

(e,n).

1 let p = 1009 and q = 2003.2 n = 2021027

3 φ(2021027) = (1009−1)(2003− 1) = 2018016

4 e = 1003 (for example)5 d = 1311811 (for this e)6 private key is 1311811, public

key is (1003,2021027).

Remark: only the Key Utility knows p and q.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 27 / 33

Page 38: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography How it all works

Getting Public and Private Keys

A public agency (call it the “Key Utility”)

1 selects two large primes p andq,

2 forms the product n = pq,3 computes φ(n),

4 selects integer e such thatgcd(e, φ(n)) = 1,

5 finds the multiplicative inversed of e (mod φ(n)),

6 private key is d , public key is(e,n).

1 let p = 1009 and q = 2003.2 n = 20210273 φ(2021027) = (1009−

1)(2003− 1) = 2018016

4 e = 1003 (for example)5 d = 1311811 (for this e)6 private key is 1311811, public

key is (1003,2021027).

Remark: only the Key Utility knows p and q.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 27 / 33

Page 39: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography How it all works

Getting Public and Private Keys

A public agency (call it the “Key Utility”)

1 selects two large primes p andq,

2 forms the product n = pq,3 computes φ(n),4 selects integer e such that

gcd(e, φ(n)) = 1,

5 finds the multiplicative inversed of e (mod φ(n)),

6 private key is d , public key is(e,n).

1 let p = 1009 and q = 2003.2 n = 20210273 φ(2021027) = (1009−

1)(2003− 1) = 20180164 e = 1003 (for example)

5 d = 1311811 (for this e)6 private key is 1311811, public

key is (1003,2021027).

Remark: only the Key Utility knows p and q.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 27 / 33

Page 40: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography How it all works

Getting Public and Private Keys

A public agency (call it the “Key Utility”)

1 selects two large primes p andq,

2 forms the product n = pq,3 computes φ(n),4 selects integer e such that

gcd(e, φ(n)) = 1,5 finds the multiplicative inverse

d of e (mod φ(n)),

6 private key is d , public key is(e,n).

1 let p = 1009 and q = 2003.2 n = 20210273 φ(2021027) = (1009−

1)(2003− 1) = 20180164 e = 1003 (for example)5 d = 1311811 (for this e)

6 private key is 1311811, publickey is (1003,2021027).

Remark: only the Key Utility knows p and q.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 27 / 33

Page 41: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography How it all works

Getting Public and Private Keys

A public agency (call it the “Key Utility”)

1 selects two large primes p andq,

2 forms the product n = pq,3 computes φ(n),4 selects integer e such that

gcd(e, φ(n)) = 1,5 finds the multiplicative inverse

d of e (mod φ(n)),6 private key is d , public key is

(e,n).

1 let p = 1009 and q = 2003.2 n = 20210273 φ(2021027) = (1009−

1)(2003− 1) = 20180164 e = 1003 (for example)5 d = 1311811 (for this e)6 private key is 1311811, public

key is (1003,2021027).

Remark: only the Key Utility knows p and q.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 27 / 33

Page 42: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography How it all works

Getting Public and Private Keys

A public agency (call it the “Key Utility”)

1 selects two large primes p andq,

2 forms the product n = pq,3 computes φ(n),4 selects integer e such that

gcd(e, φ(n)) = 1,5 finds the multiplicative inverse

d of e (mod φ(n)),6 private key is d , public key is

(e,n).

1 let p = 1009 and q = 2003.2 n = 20210273 φ(2021027) = (1009−

1)(2003− 1) = 20180164 e = 1003 (for example)5 d = 1311811 (for this e)6 private key is 1311811, public

key is (1003,2021027).

Remark: only the Key Utility knows p and q.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 27 / 33

Page 43: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography How it all works

Exchanging Messages

Suppose Alice and Bob have the following keys.

Key Holder Public Key Private KeyAlice (ea,na) = (1003,2021027) da = 1311811Bob (eb,nb) = (10007,2021027) db = 1197863

Private key da is known only to Alice (and the Key Utility), while privatekey db is known only to Bob (and the Key Utility).

If Alice wants to send the message “hi” to Bob, she looks up Bob’spublic key (eb,nb) and must do two things.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 28 / 33

Page 44: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography How it all works

Exchanging Messages

Suppose Alice and Bob have the following keys.

Key Holder Public Key Private KeyAlice (ea,na) = (1003,2021027) da = 1311811Bob (eb,nb) = (10007,2021027) db = 1197863

Private key da is known only to Alice (and the Key Utility), while privatekey db is known only to Bob (and the Key Utility).

If Alice wants to send the message “hi” to Bob, she looks up Bob’spublic key (eb,nb) and must do two things.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 28 / 33

Page 45: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography How it all works

Exchanging Messages

Suppose Alice and Bob have the following keys.

Key Holder Public Key Private KeyAlice (ea,na) = (1003,2021027) da = 1311811Bob (eb,nb) = (10007,2021027) db = 1197863

Private key da is known only to Alice (and the Key Utility), while privatekey db is known only to Bob (and the Key Utility).

If Alice wants to send the message “hi” to Bob, she looks up Bob’spublic key (eb,nb) and must do two things.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 28 / 33

Page 46: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography How it all works

Encrypting Using RSA

1 Alice converts “hi” to a number, m.Letter h i

ASCII Code 104 105m = 104105

2 Alice creates the ciphertext c using the formula

c ≡ meb (mod nb)

c = 10410510007 (mod 2021027)

c = 1086444

and sends it to Bob. Alice can try this Java applet if she needshelp with modular exponentiation.

Remark: if m > nb Alice breaks the m into chunks smaller than nb.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 29 / 33

Page 47: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography How it all works

Encrypting Using RSA

1 Alice converts “hi” to a number, m.Letter h i

ASCII Code 104 105m = 104105

2 Alice creates the ciphertext c using the formula

c ≡ meb (mod nb)

c = 10410510007 (mod 2021027)

c = 1086444

and sends it to Bob. Alice can try this Java applet if she needshelp with modular exponentiation.

Remark: if m > nb Alice breaks the m into chunks smaller than nb.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 29 / 33

Page 48: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography How it all works

Encrypting Using RSA

1 Alice converts “hi” to a number, m.Letter h i

ASCII Code 104 105m = 104105

2 Alice creates the ciphertext c using the formula

c ≡ meb (mod nb)

c = 10410510007 (mod 2021027)

c = 1086444

and sends it to Bob. Alice can try this Java applet if she needshelp with modular exponentiation.

Remark: if m > nb Alice breaks the m into chunks smaller than nb.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 29 / 33

Page 49: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography How it all works

Bob Decrypts the Ciphertext

When Bob receives the ciphertext c he uses his private key db andcomputes

m′ ≡ cdb (mod nb)

m′ = 10864441197863 (mod 2021027)

m′ = 104105.

ASCII Code 104 105Letter h i

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 30 / 33

Page 50: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography How it all works

Bob Decrypts the Ciphertext

When Bob receives the ciphertext c he uses his private key db andcomputes

m′ ≡ cdb (mod nb)

m′ = 10864441197863 (mod 2021027)

m′ = 104105.

ASCII Code 104 105Letter h i

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 30 / 33

Page 51: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography How it all works

Is RSA Secure?

The security of RSA depends on the difficulty in factoring largenumbers like n.

If n = pq where p and q are prime numbers with more than 500digits each then n has more than 1000 digits.It takes approximately 4.7× 1022 years to factor a 500-digitcomposite number using today’s computers.As computers get faster, we can keep increasing n.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 31 / 33

Page 52: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography How it all works

Is RSA Secure?

The security of RSA depends on the difficulty in factoring largenumbers like n.If n = pq where p and q are prime numbers with more than 500digits each then n has more than 1000 digits.

It takes approximately 4.7× 1022 years to factor a 500-digitcomposite number using today’s computers.As computers get faster, we can keep increasing n.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 31 / 33

Page 53: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography How it all works

Is RSA Secure?

The security of RSA depends on the difficulty in factoring largenumbers like n.If n = pq where p and q are prime numbers with more than 500digits each then n has more than 1000 digits.It takes approximately 4.7× 1022 years to factor a 500-digitcomposite number using today’s computers.

As computers get faster, we can keep increasing n.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 31 / 33

Page 54: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography How it all works

Is RSA Secure?

The security of RSA depends on the difficulty in factoring largenumbers like n.If n = pq where p and q are prime numbers with more than 500digits each then n has more than 1000 digits.It takes approximately 4.7× 1022 years to factor a 500-digitcomposite number using today’s computers.As computers get faster, we can keep increasing n.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 31 / 33

Page 55: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography How it all works

Will We Run Out of Primes?

TheoremThere are infinitely many prime numbers.

Proof.Suppose there are only finitely many primes p1 < p2 < · · · < pk .

Form the number q = (p1)(p2) · · · (pk ) + 1 > pk . This number iseither prime or composite.1 ≡ q (mod pi)

No (known) prime evenly divides q.Either q itself is prime or there is a prime larger than pk whichdivides q.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 32 / 33

Page 56: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography How it all works

Will We Run Out of Primes?

TheoremThere are infinitely many prime numbers.

Proof.Suppose there are only finitely many primes p1 < p2 < · · · < pk .

Form the number q = (p1)(p2) · · · (pk ) + 1 > pk . This number iseither prime or composite.1 ≡ q (mod pi)

No (known) prime evenly divides q.Either q itself is prime or there is a prime larger than pk whichdivides q.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 32 / 33

Page 57: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography How it all works

Will We Run Out of Primes?

TheoremThere are infinitely many prime numbers.

Proof.Suppose there are only finitely many primes p1 < p2 < · · · < pk .Form the number q = (p1)(p2) · · · (pk ) + 1 > pk . This number iseither prime or composite.

1 ≡ q (mod pi)

No (known) prime evenly divides q.Either q itself is prime or there is a prime larger than pk whichdivides q.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 32 / 33

Page 58: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography How it all works

Will We Run Out of Primes?

TheoremThere are infinitely many prime numbers.

Proof.Suppose there are only finitely many primes p1 < p2 < · · · < pk .Form the number q = (p1)(p2) · · · (pk ) + 1 > pk . This number iseither prime or composite.1 ≡ q (mod pi)

No (known) prime evenly divides q.Either q itself is prime or there is a prime larger than pk whichdivides q.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 32 / 33

Page 59: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography How it all works

Will We Run Out of Primes?

TheoremThere are infinitely many prime numbers.

Proof.Suppose there are only finitely many primes p1 < p2 < · · · < pk .Form the number q = (p1)(p2) · · · (pk ) + 1 > pk . This number iseither prime or composite.1 ≡ q (mod pi)

No (known) prime evenly divides q.

Either q itself is prime or there is a prime larger than pk whichdivides q.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 32 / 33

Page 60: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

Public Key Cryptography How it all works

Will We Run Out of Primes?

TheoremThere are infinitely many prime numbers.

Proof.Suppose there are only finitely many primes p1 < p2 < · · · < pk .Form the number q = (p1)(p2) · · · (pk ) + 1 > pk . This number iseither prime or composite.1 ≡ q (mod pi)

No (known) prime evenly divides q.Either q itself is prime or there is a prime larger than pk whichdivides q.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 32 / 33

Page 61: An Introduction to Cryptographybanach.millersville.edu/~bob/presentations/Spotlight2009.pdf · 2014-12-23 · Introduction Cryptology Throughout History (1 of 3) Subject as old as

For More Information

Where Can You Learn More?

The modern language of cryptology is mathematics. Major inmathematics in college. Take a course in number theory.The National Security Agency employs and educatescryptologists.The National Cryptologic Museum has exhibits on ancient andmodern cryptography.

J. Robert Buchanan (Millersville Univ.) An Introduction to Cryptography 25 March 2009 33 / 33