Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to...

141
Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics & Computer Science Colorado College February 15, 2014

Transcript of Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to...

Page 1: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Cryptography in the Computer AgeHow to use number theory to take over the world

Dr. Stefan EricksonDept. of Mathematics & Computer Science

Colorado College

February 15, 2014

Page 2: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

What role does cryptography play in your life?

Page 3: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

What is Cryptography?

“The practice of the enciphering and deciphering of messages insecret code in order to render them unintelligible to all but theintended receiver.” - Encyclopedia Britannica Online

Cryptosystem = Method of encrypting information

Cryptography = Making cryptosystems

Cryptanalysis = Breaking cryptosystems

Cryptology = Cryptography + Cryptanalysis

Page 4: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

What is Cryptography?

“The practice of the enciphering and deciphering of messages insecret code in order to render them unintelligible to all but theintended receiver.” - Encyclopedia Britannica Online

Cryptosystem = Method of encrypting information

Cryptography = Making cryptosystems

Cryptanalysis = Breaking cryptosystems

Cryptology = Cryptography + Cryptanalysis

Page 5: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

What is Cryptography?

“The practice of the enciphering and deciphering of messages insecret code in order to render them unintelligible to all but theintended receiver.” - Encyclopedia Britannica Online

Cryptosystem = Method of encrypting information

Cryptography = Making cryptosystems

Cryptanalysis = Breaking cryptosystems

Cryptology = Cryptography + Cryptanalysis

Page 6: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

What is Cryptography?

“The practice of the enciphering and deciphering of messages insecret code in order to render them unintelligible to all but theintended receiver.” - Encyclopedia Britannica Online

Cryptosystem = Method of encrypting information

Cryptography = Making cryptosystems

Cryptanalysis = Breaking cryptosystems

Cryptology = Cryptography + Cryptanalysis

Page 7: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

What is Cryptography?

“The practice of the enciphering and deciphering of messages insecret code in order to render them unintelligible to all but theintended receiver.” - Encyclopedia Britannica Online

Cryptosystem = Method of encrypting information

Cryptography = Making cryptosystems

Cryptanalysis = Breaking cryptosystems

Cryptology = Cryptography + Cryptanalysis

Page 8: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Caesar Cipher

Page 9: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Caesar Cipher

Page 10: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Caesar Cipher

Page 11: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Enigma Machine

Page 12: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Bletchley Park

Page 13: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Substitution and Transposition Ciphers

Substitution

Transposition

Most modern cryptosystems use substitution and transposition.

Page 14: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Substitution and Transposition Ciphers

Substitution Transposition

Most modern cryptosystems use substitution and transposition.

Page 15: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Substitution and Transposition Ciphers

Substitution Transposition

Most modern cryptosystems use substitution and transposition.

Page 16: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Private Key Encryption

Page 17: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Private Key Encryption

Private Key: Random string of 0s and 1s.

Key = 10111001 01010011 11111011 . . .

Key is combined with Message using �:

0� 0 = 0 0� 1 = 1

1� 0 = 1 1� 1 = 0

Page 18: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Private Key Encryption

Private Key: Random string of 0s and 1s.

Key = 10111001 01010011 11111011 . . .

Key is combined with Message using �:

0� 0 = 0 0� 1 = 1

1� 0 = 1 1� 1 = 0

Page 19: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Enciphering and Deciphering

Enciphering

Message: 01010111 01001001 01001110 . . .� Key: 10111001 01010011 11111011 . . .

Cipher: 11101110 00011010 10110101 . . .

Deciphering

Cipher: 11101110 00011010 10110101 . . .� Key: 10111001 01010011 11111011 . . .

Message: 01010111 01001001 01001110 . . .

Page 20: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Enciphering and Deciphering

Enciphering

Message: 01010111 01001001 01001110 . . .� Key: 10111001 01010011 11111011 . . .

Cipher: 11101110 00011010 10110101 . . .

Deciphering

Cipher: 11101110 00011010 10110101 . . .� Key: 10111001 01010011 11111011 . . .

Message: 01010111 01001001 01001110 . . .

Page 21: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Advanced Encryption Standard (AES, 2001)

1. AddRoundKey

2. SubBytes

3. ShiftRows

4. MixColumns

I Process is repeated 10, 12, or 14 times.

I Encryption / Decryption is very fast (700MB/s per thread)

I 2128, 2192, or 2256 keys

I Number of particles in the universe ⇡ 2240

Page 22: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Advanced Encryption Standard (AES, 2001)

1. AddRoundKey

2. SubBytes

3. ShiftRows

4. MixColumns

I Process is repeated 10, 12, or 14 times.

I Encryption / Decryption is very fast (700MB/s per thread)

I 2128, 2192, or 2256 keys

I Number of particles in the universe ⇡ 2240

Page 23: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Advanced Encryption Standard (AES, 2001)

1. AddRoundKey

2. SubBytes

3. ShiftRows

4. MixColumns

I Process is repeated 10, 12, or 14 times.

I Encryption / Decryption is very fast (700MB/s per thread)

I 2128, 2192, or 2256 keys

I Number of particles in the universe ⇡ 2240

Page 24: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Advanced Encryption Standard (AES, 2001)

1. AddRoundKey

2. SubBytes

3. ShiftRows

4. MixColumns

I Process is repeated 10, 12, or 14 times.

I Encryption / Decryption is very fast (700MB/s per thread)

I 2128, 2192, or 2256 keys

I Number of particles in the universe ⇡ 2240

Page 25: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Advanced Encryption Standard (AES, 2001)

1. AddRoundKey

2. SubBytes

3. ShiftRows

4. MixColumns

I Process is repeated 10, 12, or 14 times.

I Encryption / Decryption is very fast (700MB/s per thread)

I 2128, 2192, or 2256 keys

I Number of particles in the universe ⇡ 2240

Page 26: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Advanced Encryption Standard (AES, 2001)

1. AddRoundKey

2. SubBytes

3. ShiftRows

4. MixColumns

I Process is repeated 10, 12, or 14 times.

I Encryption / Decryption is very fast (700MB/s per thread)

I 2128, 2192, or 2256 keys

I Number of particles in the universe ⇡ 2240

Page 27: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Advanced Encryption Standard (AES, 2001)

1. AddRoundKey

2. SubBytes

3. ShiftRows

4. MixColumns

I Process is repeated 10, 12, or 14 times.

I Encryption / Decryption is very fast (700MB/s per thread)

I 2128, 2192, or 2256 keys

I Number of particles in the universe ⇡ 2240

Page 28: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Advanced Encryption Standard (AES, 2001)

1. AddRoundKey

2. SubBytes

3. ShiftRows

4. MixColumns

I Process is repeated 10, 12, or 14 times.

I Encryption / Decryption is very fast (700MB/s per thread)

I 2128, 2192, or 2256 keys

I Number of particles in the universe ⇡ 2240

Page 29: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Private Key Exchange

How can private keys be safely transmitted over insecure channels(such as the Internet)?

Public Key Encryption

Key Exchange Protocols

But first: Number Theory!

Page 30: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Private Key Exchange

How can private keys be safely transmitted over insecure channels(such as the Internet)?

Public Key Encryption

Key Exchange Protocols

But first: Number Theory!

Page 31: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Private Key Exchange

How can private keys be safely transmitted over insecure channels(such as the Internet)?

Public Key Encryption

Key Exchange Protocols

But first: Number Theory!

Page 32: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Private Key Exchange

How can private keys be safely transmitted over insecure channels(such as the Internet)?

Public Key Encryption

Key Exchange Protocols

But first: Number Theory!

Page 33: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

What is Number Theory?

Number theory is the study of the whole numbers.

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, . . .

I Integer solutions to equations (Pythagorean Triples)

I Patterns in sequences of numbers (Fibonacci Numbers,Pascal’s Triangle)

I Properties of the integers (Prime Numbers)

Page 34: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

What is Number Theory?

Number theory is the study of the whole numbers.

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, . . .

I Integer solutions to equations (Pythagorean Triples)

I Patterns in sequences of numbers (Fibonacci Numbers,Pascal’s Triangle)

I Properties of the integers (Prime Numbers)

Page 35: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

What is Number Theory?

Number theory is the study of the whole numbers.

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, . . .

I Integer solutions to equations (Pythagorean Triples)

I Patterns in sequences of numbers (Fibonacci Numbers,Pascal’s Triangle)

I Properties of the integers (Prime Numbers)

Page 36: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

What is Number Theory?

Number theory is the study of the whole numbers.

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, . . .

I Integer solutions to equations (Pythagorean Triples)

I Patterns in sequences of numbers (Fibonacci Numbers,Pascal’s Triangle)

I Properties of the integers (Prime Numbers)

Page 37: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Modular Arithmetic

One way to study the (infinite) integers is to reduce it to a (finite)set of remainders.

We say that “a is congruent to b modulo n,”or

a ⌘ b (mod n)

if a and b have the same remainder whendivided by n. Equivalently, for some integer k ,

a = b + k · n.

Can perform most arithmetic operations (+, �, ⇥) modulo n.

Page 38: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Modular Arithmetic

One way to study the (infinite) integers is to reduce it to a (finite)set of remainders.

We say that “a is congruent to b modulo n,”or

a ⌘ b (mod n)

if a and b have the same remainder whendivided by n. Equivalently, for some integer k ,

a = b + k · n.

Can perform most arithmetic operations (+, �, ⇥) modulo n.

Page 39: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Modular Arithmetic

One way to study the (infinite) integers is to reduce it to a (finite)set of remainders.

We say that “a is congruent to b modulo n,”or

a ⌘ b (mod n)

if a and b have the same remainder whendivided by n. Equivalently, for some integer k ,

a = b + k · n.

Can perform most arithmetic operations (+, �, ⇥) modulo n.

Page 40: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Modular Arithmetic

One way to study the (infinite) integers is to reduce it to a (finite)set of remainders.

We say that “a is congruent to b modulo n,”or

a ⌘ b (mod n)

if a and b have the same remainder whendivided by n. Equivalently, for some integer k ,

a = b + k · n.

Can perform most arithmetic operations (+, �, ⇥) modulo n.

Page 41: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Powers Modulo n, Prime n

Modulo 7

11 ⌘ 1 21 ⌘ 2 31 ⌘ 3 41 ⌘ 4 51 ⌘ 5 61 ⌘ 612 ⌘ 1 22 ⌘ 4 32 ⌘ 2 42 ⌘ 2 52 ⌘ 4 62 ⌘ 113 ⌘ 1 23 ⌘ 1 33 ⌘ 6 43 ⌘ 1 53 ⌘ 6 63 ⌘ 614 ⌘ 1 24 ⌘ 2 34 ⌘ 4 44 ⌘ 4 54 ⌘ 2 64 ⌘ 115 ⌘ 1 25 ⌘ 4 35 ⌘ 5 45 ⌘ 2 55 ⌘ 3 65 ⌘ 616 ⌘ 1 26 ⌘ 1 36 ⌘ 1 46 ⌘ 1 56 ⌘ 1 66 ⌘ 1

......

......

......

Page 42: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Powers Modulo n, Prime n

Modulo 7

11 ⌘ 1 21 ⌘ 2 31 ⌘ 3 41 ⌘ 4 51 ⌘ 5 61 ⌘ 612 ⌘ 1 22 ⌘ 4 32 ⌘ 2 42 ⌘ 2 52 ⌘ 4 62 ⌘ 113 ⌘ 1 23 ⌘ 1 33 ⌘ 6 43 ⌘ 1 53 ⌘ 6 63 ⌘ 614 ⌘ 1 24 ⌘ 2 34 ⌘ 4 44 ⌘ 4 54 ⌘ 2 64 ⌘ 115 ⌘ 1 25 ⌘ 4 35 ⌘ 5 45 ⌘ 2 55 ⌘ 3 65 ⌘ 616 ⌘ 1 26 ⌘ 1 36 ⌘ 1 46 ⌘ 1 56 ⌘ 1 66 ⌘ 1

......

......

......

Powers will eventually reach 1.

Page 43: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Powers Modulo n, Prime n

Modulo 7

11 ⌘ 1 21 ⌘ 2 31 ⌘ 3 41 ⌘ 4 51 ⌘ 5 61 ⌘ 612 ⌘ 1 22 ⌘ 4 32 ⌘ 2 42 ⌘ 2 52 ⌘ 4 62 ⌘ 113 ⌘ 1 23 ⌘ 1 33 ⌘ 6 43 ⌘ 1 53 ⌘ 6 63 ⌘ 614 ⌘ 1 24 ⌘ 2 34 ⌘ 4 44 ⌘ 4 54 ⌘ 2 64 ⌘ 115 ⌘ 1 25 ⌘ 4 35 ⌘ 5 45 ⌘ 2 55 ⌘ 3 65 ⌘ 616 ⌘ 1 26 ⌘ 1 36 ⌘ 1 46 ⌘ 1 56 ⌘ 1 66 ⌘ 1

......

......

......

Powers will eventually reach 1.

Page 44: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Fermat’s Little Theorem

Theorem (Fermat, 1640)

For any prime p and integer a not divisible by p,

ap�1 ⌘ 1 (mod p)

Page 45: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Primality Testing

Fermat’s Little Theorem: ap�1 ⌘ 1 (mod p)

If an�1 6⌘ 1 (mod n) for some integer a, then n is composite.

Unfortunately, there are composites called absolute pseudoprimessuch that an�1 ⌘ 1 (mod n) for all integers a relatively prime to n.(First example is n = 561.)

Variations on this test can quickly identify primes hundred of digits long.

Page 46: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Primality Testing

Fermat’s Little Theorem: ap�1 ⌘ 1 (mod p)

If an�1 6⌘ 1 (mod n) for some integer a, then n is composite.

Unfortunately, there are composites called absolute pseudoprimessuch that an�1 ⌘ 1 (mod n) for all integers a relatively prime to n.(First example is n = 561.)

Variations on this test can quickly identify primes hundred of digits long.

Page 47: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Primality Testing

Fermat’s Little Theorem: ap�1 ⌘ 1 (mod p)

If an�1 6⌘ 1 (mod n) for some integer a, then n is composite.

Unfortunately, there are composites called absolute pseudoprimessuch that an�1 ⌘ 1 (mod n) for all integers a relatively prime to n.(First example is n = 561.)

Variations on this test can quickly identify primes hundred of digits long.

Page 48: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Powers Modulo n, Composite n

Modulo 10

11 ⌘ 1 31 ⌘ 3 71 ⌘ 7 91 ⌘ 912 ⌘ 1 32 ⌘ 9 72 ⌘ 9 92 ⌘ 113 ⌘ 1 33 ⌘ 7 73 ⌘ 3 93 ⌘ 914 ⌘ 1 34 ⌘ 1 74 ⌘ 1 94 ⌘ 1

......

......

Page 49: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Powers Modulo n, Composite n

Modulo 10

11 ⌘ 1 31 ⌘ 3 71 ⌘ 7 91 ⌘ 912 ⌘ 1 32 ⌘ 9 72 ⌘ 9 92 ⌘ 113 ⌘ 1 33 ⌘ 7 73 ⌘ 3 93 ⌘ 914 ⌘ 1 34 ⌘ 1 74 ⌘ 1 94 ⌘ 1

......

......

If the integer a is relatively prime to n, the powers of a willeventually reach 1.

Page 50: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Powers Modulo n, Composite n

Modulo 10

11 ⌘ 1 31 ⌘ 3 71 ⌘ 7 91 ⌘ 912 ⌘ 1 32 ⌘ 9 72 ⌘ 9 92 ⌘ 113 ⌘ 1 33 ⌘ 7 73 ⌘ 3 93 ⌘ 914 ⌘ 1 34 ⌘ 1 74 ⌘ 1 94 ⌘ 1

......

......

If the integer a is relatively prime to n, the powers of a willeventually reach 1.

Page 51: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Euler’s Theorem

Theorem (Euler, 1763)

For any integer n and integer a relatively prime to n,

a�(n) ⌘ 1 (mod n)

where �(n) is the number of integers between 1 and n with nocommon factors with n.

�(n) depends on the prime factorization of n.In particular, if n = p · q for two primes p and q, then

�(n) = (p � 1) · (q � 1)

Page 52: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Euler’s Theorem

Theorem (Euler, 1763)

For any integer n and integer a relatively prime to n,

a�(n) ⌘ 1 (mod n)

where �(n) is the number of integers between 1 and n with nocommon factors with n.

�(n) depends on the prime factorization of n.In particular, if n = p · q for two primes p and q, then

�(n) = (p � 1) · (q � 1)

Page 53: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Public Key Encryption

Page 54: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

RSA (Rivest, Shamir, Adleman, 1978)

Alice’s Public KeyChooses two random primes p, q.

Computes n = p · q and'(n) = (p � 1) · (q � 1).

Chooses some encrypting key e.Solve d · e ⌘ 1 (mod '(n)).

BobWants to send message M.Computes C ⌘ Me (mod n).

Sends C to Alice.Alice

Computes M ⌘ Cd (mod n).

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

Why does it work? Euler’s Theorem:

Cd ⌘ (Me)d ⌘ Md ·e ⌘ M1+k·�(n)

⌘ M1 ·�M�(n)

�k ⌘ M · (1)k ⌘ M (mod n)

Page 55: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

RSA (Rivest, Shamir, Adleman, 1978)

Alice’s Public KeyChooses two random primes p, q.

Computes n = p · q and'(n) = (p � 1) · (q � 1).

Chooses some encrypting key e.Solve d · e ⌘ 1 (mod '(n)).

BobWants to send message M.Computes C ⌘ Me (mod n).

Sends C to Alice.Alice

Computes M ⌘ Cd (mod n).

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

Why does it work? Euler’s Theorem:

Cd ⌘ (Me)d ⌘ Md ·e ⌘ M1+k·�(n)

⌘ M1 ·�M�(n)

�k ⌘ M · (1)k ⌘ M (mod n)

Page 56: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

RSA (Rivest, Shamir, Adleman, 1978)

Alice’s Public KeyChooses two random primes p, q.

Computes n = p · q and'(n) = (p � 1) · (q � 1).

Chooses some encrypting key e.

Solve d · e ⌘ 1 (mod '(n)).

BobWants to send message M.Computes C ⌘ Me (mod n).

Sends C to Alice.Alice

Computes M ⌘ Cd (mod n).

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

Why does it work? Euler’s Theorem:

Cd ⌘ (Me)d ⌘ Md ·e ⌘ M1+k·�(n)

⌘ M1 ·�M�(n)

�k ⌘ M · (1)k ⌘ M (mod n)

Page 57: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

RSA (Rivest, Shamir, Adleman, 1978)

Alice’s Public KeyChooses two random primes p, q.

Computes n = p · q and'(n) = (p � 1) · (q � 1).

Chooses some encrypting key e.Solve d · e ⌘ 1 (mod '(n)).

BobWants to send message M.Computes C ⌘ Me (mod n).

Sends C to Alice.Alice

Computes M ⌘ Cd (mod n).

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

Why does it work? Euler’s Theorem:

Cd ⌘ (Me)d ⌘ Md ·e ⌘ M1+k·�(n)

⌘ M1 ·�M�(n)

�k ⌘ M · (1)k ⌘ M (mod n)

Page 58: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

RSA (Rivest, Shamir, Adleman, 1978)

Alice’s Public KeyChooses two random primes p, q.

Computes n = p · q and'(n) = (p � 1) · (q � 1).

Chooses some encrypting key e.Solve d · e ⌘ 1 (mod '(n)).

BobWants to send message M.Computes C ⌘ Me (mod n).

Sends C to Alice.Alice

Computes M ⌘ Cd (mod n).

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

Why does it work? Euler’s Theorem:

Cd ⌘ (Me)d ⌘ Md ·e ⌘ M1+k·�(n)

⌘ M1 ·�M�(n)

�k ⌘ M · (1)k ⌘ M (mod n)

Page 59: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

RSA (Rivest, Shamir, Adleman, 1978)

Alice’s Public KeyChooses two random primes p, q.

Computes n = p · q and'(n) = (p � 1) · (q � 1).

Chooses some encrypting key e.Solve d · e ⌘ 1 (mod '(n)).

BobWants to send message M.Computes C ⌘ Me (mod n).

Sends C to Alice.Alice

Computes M ⌘ Cd (mod n).

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

Why does it work? Euler’s Theorem:

Cd ⌘ (Me)d ⌘ Md ·e ⌘ M1+k·�(n)

⌘ M1 ·�M�(n)

�k ⌘ M · (1)k ⌘ M (mod n)

Page 60: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

RSA Problem

RSA Problem: Given n and e, solve d · e ⌘ 1 (mod '(n)).

Note: This is very easy if you know the prime factors of n, usingthe Euclidean Algorithm.

Factoring Problem: Given n = p · q, find p and q.

Best known factoring algorithm: General Number Field Sieve

Page 61: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

RSA Problem

RSA Problem: Given n and e, solve d · e ⌘ 1 (mod '(n)).

Note: This is very easy if you know the prime factors of n, usingthe Euclidean Algorithm.

Factoring Problem: Given n = p · q, find p and q.

Best known factoring algorithm: General Number Field Sieve

Page 62: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

RSA Problem

RSA Problem: Given n and e, solve d · e ⌘ 1 (mod '(n)).

Note: This is very easy if you know the prime factors of n, usingthe Euclidean Algorithm.

Factoring Problem: Given n = p · q, find p and q.

Best known factoring algorithm: General Number Field Sieve

Page 63: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

RSA Problem

RSA Problem: Given n and e, solve d · e ⌘ 1 (mod '(n)).

Note: This is very easy if you know the prime factors of n, usingthe Euclidean Algorithm.

Factoring Problem: Given n = p · q, find p and q.

Best known factoring algorithm: General Number Field Sieve

Page 64: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Factoring Large Numbers

Largest number ever factored is 232 digits (December 12, 2009):

1230186684530117755130494958384962720772853569595334792197

3224521517264005072636575187452021997864693899564749427740

6384592519255732630345373154826850791702612214291346167042

9214311602221240479274737794080665351419597459856902143413

=

3347807169895689878604416984821269081770479498371376856891

2431388982883793878002287614711652531743087737814467999489

⇥3674604366679959042824463379962795263227915816434308764267

6032283815739666511279233373417143396810270092798736308917

For secure RSA, n must be at least 300 digits long, 600 digits arerecommended.

Page 65: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Factoring Large Numbers

Largest number ever factored is 232 digits (December 12, 2009):

1230186684530117755130494958384962720772853569595334792197

3224521517264005072636575187452021997864693899564749427740

6384592519255732630345373154826850791702612214291346167042

9214311602221240479274737794080665351419597459856902143413

=

3347807169895689878604416984821269081770479498371376856891

2431388982883793878002287614711652531743087737814467999489

⇥3674604366679959042824463379962795263227915816434308764267

6032283815739666511279233373417143396810270092798736308917

For secure RSA, n must be at least 300 digits long, 600 digits arerecommended.

Page 66: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Factoring Large Numbers

Largest number ever factored is 232 digits (December 12, 2009):

1230186684530117755130494958384962720772853569595334792197

3224521517264005072636575187452021997864693899564749427740

6384592519255732630345373154826850791702612214291346167042

9214311602221240479274737794080665351419597459856902143413

=

3347807169895689878604416984821269081770479498371376856891

2431388982883793878002287614711652531743087737814467999489

⇥3674604366679959042824463379962795263227915816434308764267

6032283815739666511279233373417143396810270092798736308917

For secure RSA, n must be at least 300 digits long, 600 digits arerecommended.

Page 67: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Key Exchange Protocol

Page 68: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Di�e-Hellman Key Exchange (1976)

Alice and Bob decide on a large prime p and a base number g .

AliceChooses random number a.Calculates A ⌘ ga (mod p).

Sends A to Bob.

BobChooses random number b.Calculates B ⌘ gb (mod p).

Sends B to Alice.

Calculates K ⌘ Ba (mod p). Calculates K ⌘ Ab (mod p).

Secret Key: K ⌘ Ba ⌘ Ab ⌘ gab (mod p)

Di�e-Hellman ProblemGiven p, g , A ⌘ ga,B ⌘ gb (mod p), find gab (mod p).

Discrete Logarithm ProblemGiven p, g , and A ⌘ ga (mod p), find a.

Page 69: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Di�e-Hellman Key Exchange (1976)

Alice and Bob decide on a large prime p and a base number g .

AliceChooses random number a.Calculates A ⌘ ga (mod p).

Sends A to Bob.

BobChooses random number b.Calculates B ⌘ gb (mod p).

Sends B to Alice.

Calculates K ⌘ Ba (mod p). Calculates K ⌘ Ab (mod p).

Secret Key: K ⌘ Ba ⌘ Ab ⌘ gab (mod p)

Di�e-Hellman ProblemGiven p, g , A ⌘ ga,B ⌘ gb (mod p), find gab (mod p).

Discrete Logarithm ProblemGiven p, g , and A ⌘ ga (mod p), find a.

Page 70: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Di�e-Hellman Key Exchange (1976)

Alice and Bob decide on a large prime p and a base number g .

AliceChooses random number a.Calculates A ⌘ ga (mod p).

Sends A to Bob.

BobChooses random number b.Calculates B ⌘ gb (mod p).

Sends B to Alice.

Calculates K ⌘ Ba (mod p). Calculates K ⌘ Ab (mod p).

Secret Key: K ⌘ Ba ⌘ Ab ⌘ gab (mod p)

Di�e-Hellman ProblemGiven p, g , A ⌘ ga,B ⌘ gb (mod p), find gab (mod p).

Discrete Logarithm ProblemGiven p, g , and A ⌘ ga (mod p), find a.

Page 71: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Di�e-Hellman Key Exchange (1976)

Alice and Bob decide on a large prime p and a base number g .

AliceChooses random number a.Calculates A ⌘ ga (mod p).

Sends A to Bob.

BobChooses random number b.Calculates B ⌘ gb (mod p).

Sends B to Alice.

Calculates K ⌘ Ba (mod p). Calculates K ⌘ Ab (mod p).

Secret Key: K ⌘ Ba ⌘ Ab ⌘ gab (mod p)

Di�e-Hellman ProblemGiven p, g , A ⌘ ga,B ⌘ gb (mod p), find gab (mod p).

Discrete Logarithm ProblemGiven p, g , and A ⌘ ga (mod p), find a.

Page 72: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Di�e-Hellman Key Exchange (1976)

Alice and Bob decide on a large prime p and a base number g .

AliceChooses random number a.Calculates A ⌘ ga (mod p).

Sends A to Bob.

BobChooses random number b.Calculates B ⌘ gb (mod p).

Sends B to Alice.

Calculates K ⌘ Ba (mod p). Calculates K ⌘ Ab (mod p).

Secret Key: K ⌘ Ba ⌘ Ab ⌘ gab (mod p)

Di�e-Hellman ProblemGiven p, g , A ⌘ ga,B ⌘ gb (mod p), find gab (mod p).

Discrete Logarithm ProblemGiven p, g , and A ⌘ ga (mod p), find a.

Page 73: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Di�e-Hellman Key Exchange (1976)

Alice and Bob decide on a large prime p and a base number g .

AliceChooses random number a.Calculates A ⌘ ga (mod p).

Sends A to Bob.

BobChooses random number b.Calculates B ⌘ gb (mod p).

Sends B to Alice.

Calculates K ⌘ Ba (mod p). Calculates K ⌘ Ab (mod p).

Secret Key: K ⌘ Ba ⌘ Ab ⌘ gab (mod p)

Di�e-Hellman ProblemGiven p, g , A ⌘ ga,B ⌘ gb (mod p), find gab (mod p).

Discrete Logarithm ProblemGiven p, g , and A ⌘ ga (mod p), find a.

Page 74: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Di�e-Hellman Key Exchange (1976)

Alice and Bob decide on a large prime p and a base number g .

AliceChooses random number a.Calculates A ⌘ ga (mod p).

Sends A to Bob.

BobChooses random number b.Calculates B ⌘ gb (mod p).

Sends B to Alice.

Calculates K ⌘ Ba (mod p). Calculates K ⌘ Ab (mod p).

Secret Key: K ⌘ Ba ⌘ Ab ⌘ gab (mod p)

Di�e-Hellman ProblemGiven p, g , A ⌘ ga,B ⌘ gb (mod p), find gab (mod p).

Discrete Logarithm ProblemGiven p, g , and A ⌘ ga (mod p), find a.

Page 75: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Discrete Logarithm Problem

Discrete Logarithm ProblemGiven p, g , and A ⌘ ga (mod p), find a.

Given g and A = ga in the real numbers:

A = ga

logA = log(ga)

logA = a log(g)

a =logA

log g

MUCH harder modulo p, since the powers of g “wrap around” andproduce essentially random numbers between 1 and p � 1.

Best known attack: Index Calculus (p should be 1000 digits)

Page 76: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Discrete Logarithm Problem

Discrete Logarithm ProblemGiven p, g , and A ⌘ ga (mod p), find a.

Given g and A = ga in the real numbers:

A = ga

logA = log(ga)

logA = a log(g)

a =logA

log g

MUCH harder modulo p, since the powers of g “wrap around” andproduce essentially random numbers between 1 and p � 1.

Best known attack: Index Calculus (p should be 1000 digits)

Page 77: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Discrete Logarithm Problem

Discrete Logarithm ProblemGiven p, g , and A ⌘ ga (mod p), find a.

Given g and A = ga in the real numbers:

A = ga

logA = log(ga)

logA = a log(g)

a =logA

log g

MUCH harder modulo p, since the powers of g “wrap around” andproduce essentially random numbers between 1 and p � 1.

Best known attack: Index Calculus (p should be 1000 digits)

Page 78: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Discrete Logarithm Problem

Discrete Logarithm ProblemGiven p, g , and A ⌘ ga (mod p), find a.

Given g and A = ga in the real numbers:

A = ga

logA = log(ga)

logA = a log(g)

a =logA

log g

MUCH harder modulo p, since the powers of g “wrap around” andproduce essentially random numbers between 1 and p � 1.

Best known attack: Index Calculus (p should be 1000 digits)

Page 79: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

RSA and Di�e-Hellman

Advantages:

I Easy to implement

I Universal (> 90% of all key exchanges)

Disadvantages:

I Large modulus =) SLOW (on the order of seconds)

I Someone could find a faster algorithm for factoring or discretelogarithms.

Necessary to find a better, faster way of exchanging keys.

Page 80: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

RSA and Di�e-Hellman

Advantages:

I Easy to implement

I Universal (> 90% of all key exchanges)

Disadvantages:

I Large modulus =) SLOW (on the order of seconds)

I Someone could find a faster algorithm for factoring or discretelogarithms.

Necessary to find a better, faster way of exchanging keys.

Page 81: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

RSA and Di�e-Hellman

Advantages:

I Easy to implement

I Universal (> 90% of all key exchanges)

Disadvantages:

I Large modulus =) SLOW (on the order of seconds)

I Someone could find a faster algorithm for factoring or discretelogarithms.

Necessary to find a better, faster way of exchanging keys.

Page 82: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

RSA and Di�e-Hellman

Advantages:

I Easy to implement

I Universal (> 90% of all key exchanges)

Disadvantages:

I Large modulus =) SLOW (on the order of seconds)

I Someone could find a faster algorithm for factoring or discretelogarithms.

Necessary to find a better, faster way of exchanging keys.

Page 83: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

RSA and Di�e-Hellman

Advantages:

I Easy to implement

I Universal (> 90% of all key exchanges)

Disadvantages:

I Large modulus =) SLOW (on the order of seconds)

I Someone could find a faster algorithm for factoring or discretelogarithms.

Necessary to find a better, faster way of exchanging keys.

Page 84: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Elliptic Curve Cryptography

Elliptic Curves: y2 = x3 + Ax + B

Page 85: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Elliptic Curve Cryptography

Elliptic Curves: y2 = x3 + Ax + B

Page 86: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Addition Law on Elliptic Curves

Two points P1

, P2

determine a line, which intersects the curve at athird point P

3

. The sum P1

+ P2

is the reflection across x-axis.

This addition law turns elliptic curves in an abelian group. In orderto avoid infinite groups or round-o↵ errors, the coordinates (x , y)come from a finite field (usually the integers modulo a large prime).

Page 87: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Elliptic Curve Di�e-Hellman

Alice and Bob choose an elliptic curve E , prime p, and point P .

AliceChooses random number a.

Calculates A = a · P .Sends A to Bob.

BobChooses random number b.

Calculates B = b · P .Sends B to Alice.

Calculates K = a · B . Calculates K = b · A.

Secret Key: K = a · B = b · A = (ab) · P

Elliptic Curve Discrete Logarithm ProblemGiven E , P , and A = a · P , find a.

Page 88: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Elliptic Curve Di�e-Hellman

Alice and Bob choose an elliptic curve E , prime p, and point P .

AliceChooses random number a.

Calculates A = a · P .Sends A to Bob.

BobChooses random number b.

Calculates B = b · P .Sends B to Alice.

Calculates K = a · B . Calculates K = b · A.

Secret Key: K = a · B = b · A = (ab) · P

Elliptic Curve Discrete Logarithm ProblemGiven E , P , and A = a · P , find a.

Page 89: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Elliptic Curve Di�e-Hellman

Alice and Bob choose an elliptic curve E , prime p, and point P .

AliceChooses random number a.

Calculates A = a · P .Sends A to Bob.

BobChooses random number b.

Calculates B = b · P .Sends B to Alice.

Calculates K = a · B . Calculates K = b · A.

Secret Key: K = a · B = b · A = (ab) · P

Elliptic Curve Discrete Logarithm ProblemGiven E , P , and A = a · P , find a.

Page 90: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Elliptic Curve Di�e-Hellman

Alice and Bob choose an elliptic curve E , prime p, and point P .

AliceChooses random number a.

Calculates A = a · P .Sends A to Bob.

BobChooses random number b.

Calculates B = b · P .Sends B to Alice.

Calculates K = a · B . Calculates K = b · A.

Secret Key: K = a · B = b · A = (ab) · P

Elliptic Curve Discrete Logarithm ProblemGiven E , P , and A = a · P , find a.

Page 91: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Elliptic Curve Di�e-Hellman

Alice and Bob choose an elliptic curve E , prime p, and point P .

AliceChooses random number a.

Calculates A = a · P .Sends A to Bob.

BobChooses random number b.

Calculates B = b · P .Sends B to Alice.

Calculates K = a · B . Calculates K = b · A.

Secret Key: K = a · B = b · A = (ab) · P

Elliptic Curve Discrete Logarithm ProblemGiven E , P , and A = a · P , find a.

Page 92: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Elliptic Curve Di�e-Hellman

Alice and Bob choose an elliptic curve E , prime p, and point P .

AliceChooses random number a.

Calculates A = a · P .Sends A to Bob.

BobChooses random number b.

Calculates B = b · P .Sends B to Alice.

Calculates K = a · B . Calculates K = b · A.

Secret Key: K = a · B = b · A = (ab) · P

Elliptic Curve Discrete Logarithm ProblemGiven E , P , and A = a · P , find a.

Page 93: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Elliptic Curve Discrete Logarithm Problem

Elliptic Curve Discrete Logarithm ProblemGiven E , P , and A = a · P , find a.

Best known attacks on Elliptic Curves:

I Baby-Step Giant-Step

I Pollard’s Rho Method

I Pollard’s Kangaroo Method

All these algorithms run in O(pp) = O(e1/2 (log p)) time.

Must use primes that are ⇡ 80 digits long.

Elliptic Curve Di�e-Hellman runs in milliseconds on moderncomputers.

Page 94: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Elliptic Curve Discrete Logarithm Problem

Elliptic Curve Discrete Logarithm ProblemGiven E , P , and A = a · P , find a.

Best known attacks on Elliptic Curves:

I Baby-Step Giant-Step

I Pollard’s Rho Method

I Pollard’s Kangaroo Method

All these algorithms run in O(pp) = O(e1/2 (log p)) time.

Must use primes that are ⇡ 80 digits long.

Elliptic Curve Di�e-Hellman runs in milliseconds on moderncomputers.

Page 95: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Elliptic Curve Discrete Logarithm Problem

Elliptic Curve Discrete Logarithm ProblemGiven E , P , and A = a · P , find a.

Best known attacks on Elliptic Curves:

I Baby-Step Giant-Step

I Pollard’s Rho Method

I Pollard’s Kangaroo Method

All these algorithms run in O(pp) = O(e1/2 (log p)) time.

Must use primes that are ⇡ 80 digits long.

Elliptic Curve Di�e-Hellman runs in milliseconds on moderncomputers.

Page 96: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Elliptic Curve Discrete Logarithm Problem

Elliptic Curve Discrete Logarithm ProblemGiven E , P , and A = a · P , find a.

Best known attacks on Elliptic Curves:

I Baby-Step Giant-Step

I Pollard’s Rho Method

I Pollard’s Kangaroo Method

All these algorithms run in O(pp) = O(e1/2 (log p)) time.

Must use primes that are ⇡ 80 digits long.

Elliptic Curve Di�e-Hellman runs in milliseconds on moderncomputers.

Page 97: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Elliptic Curve Discrete Logarithm Problem

Elliptic Curve Discrete Logarithm ProblemGiven E , P , and A = a · P , find a.

Best known attacks on Elliptic Curves:

I Baby-Step Giant-Step

I Pollard’s Rho Method

I Pollard’s Kangaroo Method

All these algorithms run in O(pp) = O(e1/2 (log p)) time.

Must use primes that are ⇡ 80 digits long.

Elliptic Curve Di�e-Hellman runs in milliseconds on moderncomputers.

Page 98: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Elliptic Curve Discrete Logarithm Problem

Elliptic Curve Discrete Logarithm ProblemGiven E , P , and A = a · P , find a.

Best known attacks on Elliptic Curves:

I Baby-Step Giant-Step

I Pollard’s Rho Method

I Pollard’s Kangaroo Method

All these algorithms run in O(pp) = O(e1/2 (log p)) time.

Must use primes that are ⇡ 80 digits long.

Elliptic Curve Di�e-Hellman runs in milliseconds on moderncomputers.

Page 99: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Quantum Computers

Quantum computers make use entanglement of “qubits,” arrangedin a probabilistic superposition of all possible states.

I Polynomial-time factoring and discrete logarithm algorithms.

I Would break virtually every public-key and key-exchangecryptosystem.

I Only small number of entangled qubits have been created.

Post-quantum cryptography are based on problems not currentlysolvable by quantum computers (lattice-based, code-based,multivariate cryptography).

Page 100: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Quantum Computers

Quantum computers make use entanglement of “qubits,” arrangedin a probabilistic superposition of all possible states.

I Polynomial-time factoring and discrete logarithm algorithms.

I Would break virtually every public-key and key-exchangecryptosystem.

I Only small number of entangled qubits have been created.

Post-quantum cryptography are based on problems not currentlysolvable by quantum computers (lattice-based, code-based,multivariate cryptography).

Page 101: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Quantum Computers

Quantum computers make use entanglement of “qubits,” arrangedin a probabilistic superposition of all possible states.

I Polynomial-time factoring and discrete logarithm algorithms.

I Would break virtually every public-key and key-exchangecryptosystem.

I Only small number of entangled qubits have been created.

Post-quantum cryptography are based on problems not currentlysolvable by quantum computers (lattice-based, code-based,multivariate cryptography).

Page 102: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Quantum Computers

Quantum computers make use entanglement of “qubits,” arrangedin a probabilistic superposition of all possible states.

I Polynomial-time factoring and discrete logarithm algorithms.

I Would break virtually every public-key and key-exchangecryptosystem.

I Only small number of entangled qubits have been created.

Post-quantum cryptography are based on problems not currentlysolvable by quantum computers (lattice-based, code-based,multivariate cryptography).

Page 103: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Quantum Computers

Quantum computers make use entanglement of “qubits,” arrangedin a probabilistic superposition of all possible states.

I Polynomial-time factoring and discrete logarithm algorithms.

I Would break virtually every public-key and key-exchangecryptosystem.

I Only small number of entangled qubits have been created.

Post-quantum cryptography are based on problems not currentlysolvable by quantum computers (lattice-based, code-based,multivariate cryptography).

Page 104: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Where Does Cryptography Go Wrong?

I Cryptographic Primitive

I Protocol

I Implementation

I Adminstration

I User

Page 105: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Where Does Cryptography Go Wrong?

I Cryptographic Primitive

I Protocol

I Implementation

I Adminstration

I User

Page 106: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Where Does Cryptography Go Wrong?

I Cryptographic Primitive

I Protocol

I Implementation

I Adminstration

I User

Page 107: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Where Does Cryptography Go Wrong?

I Cryptographic Primitive

I Protocol

I Implementation

I Adminstration

I User

Page 108: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Where Does Cryptography Go Wrong?

I Cryptographic Primitive

I Protocol

I Implementation

I Adminstration

I User

Page 109: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Cryptographic Primitive

SHA-1 Hash Function

I Hash functions are one-way functions which produce a digital“fingerprint.”

I Hash functions are used to prevent forged digital signatures.

I In 2005, a collision (two identical fingerprints) was found inSHA-1 which is 2000 times faster than exhaustive search.

Page 110: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Cryptographic Primitive

SHA-1 Hash Function

I Hash functions are one-way functions which produce a digital“fingerprint.”

I Hash functions are used to prevent forged digital signatures.

I In 2005, a collision (two identical fingerprints) was found inSHA-1 which is 2000 times faster than exhaustive search.

Page 111: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Cryptographic Primitive

SHA-1 Hash Function

I Hash functions are one-way functions which produce a digital“fingerprint.”

I Hash functions are used to prevent forged digital signatures.

I In 2005, a collision (two identical fingerprints) was found inSHA-1 which is 2000 times faster than exhaustive search.

Page 112: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Protocol

Impersonation

I Eve substitutes her public key for Alice’s key.

I Bob looks up Alice’s key, encrypts using Eve’s key.

I Eve intercepts Bob’s coded message and decrypts it.

I Eve could then use Alice’s key to send a false message,made to look like the message came from Bob.

Page 113: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Protocol

Impersonation

I Eve substitutes her public key for Alice’s key.

I Bob looks up Alice’s key, encrypts using Eve’s key.

I Eve intercepts Bob’s coded message and decrypts it.

I Eve could then use Alice’s key to send a false message,made to look like the message came from Bob.

Page 114: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Protocol

Impersonation

I Eve substitutes her public key for Alice’s key.

I Bob looks up Alice’s key, encrypts using Eve’s key.

I Eve intercepts Bob’s coded message and decrypts it.

I Eve could then use Alice’s key to send a false message,made to look like the message came from Bob.

Page 115: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Protocol

Impersonation

I Eve substitutes her public key for Alice’s key.

I Bob looks up Alice’s key, encrypts using Eve’s key.

I Eve intercepts Bob’s coded message and decrypts it.

I Eve could then use Alice’s key to send a false message,made to look like the message came from Bob.

Page 116: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Implementation

Weak Key Generation

I Predictable information (such as date or IP address) used inkey generation.

I Pseudo-random number generator uses same seed multipletimes.

I Study showed that 0.2% of RSA keys shared a commonprime.

I Snowden leaks revealed that NSA gave $10 million to RSA toweaken their random number generator.

Page 117: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Implementation

Weak Key Generation

I Predictable information (such as date or IP address) used inkey generation.

I Pseudo-random number generator uses same seed multipletimes.

I Study showed that 0.2% of RSA keys shared a commonprime.

I Snowden leaks revealed that NSA gave $10 million to RSA toweaken their random number generator.

Page 118: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Implementation

Weak Key Generation

I Predictable information (such as date or IP address) used inkey generation.

I Pseudo-random number generator uses same seed multipletimes.

I Study showed that 0.2% of RSA keys shared a commonprime.

I Snowden leaks revealed that NSA gave $10 million to RSA toweaken their random number generator.

Page 119: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Implementation

Weak Key Generation

I Predictable information (such as date or IP address) used inkey generation.

I Pseudo-random number generator uses same seed multipletimes.

I Study showed that 0.2% of RSA keys shared a commonprime.

I Snowden leaks revealed that NSA gave $10 million to RSA toweaken their random number generator.

Page 120: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Adminstration

Failure to install:

I system patches and upgrades

I anti-virus software and upgrades

I network upgrades

I firewalls

I encryption software

I physical security

Also vulnerable to system administrators creating back doors, falseaccounts, etc.

Page 121: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Adminstration

Failure to install:

I system patches and upgrades

I anti-virus software and upgrades

I network upgrades

I firewalls

I encryption software

I physical security

Also vulnerable to system administrators creating back doors, falseaccounts, etc.

Page 122: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Adminstration

Failure to install:

I system patches and upgrades

I anti-virus software and upgrades

I network upgrades

I firewalls

I encryption software

I physical security

Also vulnerable to system administrators creating back doors, falseaccounts, etc.

Page 123: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Adminstration

Failure to install:

I system patches and upgrades

I anti-virus software and upgrades

I network upgrades

I firewalls

I encryption software

I physical security

Also vulnerable to system administrators creating back doors, falseaccounts, etc.

Page 124: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Adminstration

Failure to install:

I system patches and upgrades

I anti-virus software and upgrades

I network upgrades

I firewalls

I encryption software

I physical security

Also vulnerable to system administrators creating back doors, falseaccounts, etc.

Page 125: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Adminstration

Failure to install:

I system patches and upgrades

I anti-virus software and upgrades

I network upgrades

I firewalls

I encryption software

I physical security

Also vulnerable to system administrators creating back doors, falseaccounts, etc.

Page 126: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Adminstration

Failure to install:

I system patches and upgrades

I anti-virus software and upgrades

I network upgrades

I firewalls

I encryption software

I physical security

Also vulnerable to system administrators creating back doors, falseaccounts, etc.

Page 127: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

User

I Improper administration of personal computers.

I Poor choice, default, or no password.

I Using same password on many systems or for too long a time.

I Losing computers with sensitive data.

I “Phishing” scams.

I Inserting “found” CDs or flash drives into personal computers.

Page 128: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

User

I Improper administration of personal computers.

I Poor choice, default, or no password.

I Using same password on many systems or for too long a time.

I Losing computers with sensitive data.

I “Phishing” scams.

I Inserting “found” CDs or flash drives into personal computers.

Page 129: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

User

I Improper administration of personal computers.

I Poor choice, default, or no password.

I Using same password on many systems or for too long a time.

I Losing computers with sensitive data.

I “Phishing” scams.

I Inserting “found” CDs or flash drives into personal computers.

Page 130: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

User

I Improper administration of personal computers.

I Poor choice, default, or no password.

I Using same password on many systems or for too long a time.

I Losing computers with sensitive data.

I “Phishing” scams.

I Inserting “found” CDs or flash drives into personal computers.

Page 131: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

User

I Improper administration of personal computers.

I Poor choice, default, or no password.

I Using same password on many systems or for too long a time.

I Losing computers with sensitive data.

I “Phishing” scams.

I Inserting “found” CDs or flash drives into personal computers.

Page 132: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

User

I Improper administration of personal computers.

I Poor choice, default, or no password.

I Using same password on many systems or for too long a time.

I Losing computers with sensitive data.

I “Phishing” scams.

I Inserting “found” CDs or flash drives into personal computers.

Page 133: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Edward Snowden Leaks

I Much of the information gathered by the NSA is metadata:when, where, by whom, and to whom communication is made.

I Most NSA spying finds ways around cryptography (backdoors,capturing information before encryption, directly obtainedfrom companies).

I Pseudo-random number generator used in RSA was likelycompromised by NSA.

I Cryptographic primitive (RSA, DH, ECDH) appears not to bebroken by NSA.

Page 134: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Edward Snowden Leaks

I Much of the information gathered by the NSA is metadata:when, where, by whom, and to whom communication is made.

I Most NSA spying finds ways around cryptography (backdoors,capturing information before encryption, directly obtainedfrom companies).

I Pseudo-random number generator used in RSA was likelycompromised by NSA.

I Cryptographic primitive (RSA, DH, ECDH) appears not to bebroken by NSA.

Page 135: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Edward Snowden Leaks

I Much of the information gathered by the NSA is metadata:when, where, by whom, and to whom communication is made.

I Most NSA spying finds ways around cryptography (backdoors,capturing information before encryption, directly obtainedfrom companies).

I Pseudo-random number generator used in RSA was likelycompromised by NSA.

I Cryptographic primitive (RSA, DH, ECDH) appears not to bebroken by NSA.

Page 136: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Edward Snowden Leaks

I Much of the information gathered by the NSA is metadata:when, where, by whom, and to whom communication is made.

I Most NSA spying finds ways around cryptography (backdoors,capturing information before encryption, directly obtainedfrom companies).

I Pseudo-random number generator used in RSA was likelycompromised by NSA.

I Cryptographic primitive (RSA, DH, ECDH) appears not to bebroken by NSA.

Page 137: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Conclusion

I Cryptography, which plays a crucial role in cybersecurity, isbased on hard problems in number theory.

I Human nature is hard to change, so we must design systemsthat are resistant to malicious attacks.

I Our society has to decide the proper balance between security,privacy, and convenience.

I Our security and privacy come down to trust.

Page 138: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Conclusion

I Cryptography, which plays a crucial role in cybersecurity, isbased on hard problems in number theory.

I Human nature is hard to change, so we must design systemsthat are resistant to malicious attacks.

I Our society has to decide the proper balance between security,privacy, and convenience.

I Our security and privacy come down to trust.

Page 139: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Conclusion

I Cryptography, which plays a crucial role in cybersecurity, isbased on hard problems in number theory.

I Human nature is hard to change, so we must design systemsthat are resistant to malicious attacks.

I Our society has to decide the proper balance between security,privacy, and convenience.

I Our security and privacy come down to trust.

Page 140: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics

Conclusion

I Cryptography, which plays a crucial role in cybersecurity, isbased on hard problems in number theory.

I Human nature is hard to change, so we must design systemsthat are resistant to malicious attacks.

I Our society has to decide the proper balance between security,privacy, and convenience.

I Our security and privacy come down to trust.

Page 141: Cryptography in the Computer Age How to use number theory ...Cryptography in the Computer Age How to use number theory to take over the world Dr. Stefan Erickson Dept. of Mathematics