Top Banner
Cryptography Dave Feinberg
56

Cryptography

Dec 31, 2015

Download

Documents

ina-burks

Cryptography. Dave Feinberg. Email. Suppose I send an email from [email protected] to [email protected] Who has access to that email? What if I want the message to be private?. Encryption. Should it be legal to send encrypted messages? - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Cryptography

Cryptography

Dave Feinberg

Page 2: Cryptography

Email Suppose I send an email from [email protected] to [email protected]

Who has access to that email?

What if I want the message to be private?

Page 3: Cryptography

Encryption

Should it be legal to send encrypted messages?

Is there anyone that should NOT be allowed to send encrypted messages?

Page 4: Cryptography

sketchystore.com

Suppose I'm making a purchase. I click on a link, and it takes me to

http://www.sketchystore.com/checkout.jsp

Page 5: Cryptography

What I send

GET /checkout.jsp HTTP/1.1Host: www.sketchystore.com

Page 6: Cryptography

What comes back<form action="purchase.jsp" method="post"><input type="hidden" name="userid" value="dave">

Enter your credit card number:<input type="text" name="creditcard"><br>Enter your expiration date:<input type="text" name="exp"><br><input type="submit" value="Submit"></form>

Page 7: Cryptography

How it looks in my browser

Page 8: Cryptography

When I press "submit"

POST /purchase.jsp HTTP/1.1Host: www.sketchystore.comUser-Agent: Mozilla/4.0Content-Length: 48Content-Type: application/x-www-form-urlencoded

userid=dave&creditcard=2837283726495601&exp=0109

Page 9: Cryptography

Privacy If this information is sent unencrypted, who has access to my credit card number?

Other people who can connect to my wireless ethernet?

Other people physically connected to my wired ethernet?

Page 10: Cryptography

Privacy

When I send a letter through the mail, it passes through the hands of many mail carriers. What keeps them from reading my mail?

What if I send a postcard?

Page 11: Cryptography

Internet Packets = Postcards Internet data is sent in packets (small chunks bits that include the receiver's address, sender's address, and the content of that packet.)

Packets are passed from router to router.

All those routers have access to my data.

Page 12: Cryptography

Encryption Scheme #1 Shift every letter forward by 1

A → B, B → C, ..., Z → A

MESSAGE →

NFTTBHF

Can you decrypt TFDSFU?

Page 13: Cryptography

Encryption Scheme #2 Caesar Cipher. Shift forward n letters.

For example, shift forward 3 letters:A → D, B → E, ..., Z → C

We're encrypting using a key of 3.

MESSAGE →PHVVDJH

Page 14: Cryptography

Caesar Ciphers: Now You Try

Small wheel: plain text (decrypted)Big wheel: cipher text (encrypted)

Turn until ∆ points to key number. For each letter in message:

To encrypt: Translate from small to big.

To decrypt: Translate from big to small.

Page 15: Cryptography

Caesar Cipher

• How can we decode this:

DEEDUSEKBTFEIIYRBOTUSETUJXYI

Page 16: Cryptography

DecipheringDEEDUSEKBTFEIIYRBOTUSETUJXYIEFFEVTFLCUGFJJZSCPUVTFUVKYZJFGGFWUGMDVHGKKATDQVWUGVWLZAKGHHGXVHNEWIHLLBUERWXVHWXMABLHIIHYWIOFXJIMMCVFSXYWIXYNBCMIJJIZXJPGYKJNNDWGTYZXJYZOCDNJKKJAYKQHZLKOOEXHUZAYKZAPDEOKLLKBZLRIAMLPPFYIVABZLABQEFPLMMLCAMSJBNMQQGZJWBCAMBCRFGQMNNMDBNTKCONRRHAKXCDBNCDSGHRNOONECOULDPOSSIBLYDECODETHISOPPOFDPVMEQPTTJCMZEFDPEFUIJTPQQPGEQWNFRQUUKDNAFGEQFGVJKU

QRRQHFRXOGSRVVLEOBGHFRGHWKLVRSSRIGSYPHTSWWMFPCHIGSHIXLMWSTTSJHTZQIUTXXNGQDIJHTIJYMNXTUUTKIUARJVUYYOHREJKIUJKZNOYUVVULJVBSKWVZZPISFKLJVKLAOPZVWWVMKWCTLXWAAQJTGLMKWLMBPQAWXXWNLXDUMYXBBRKUHMNLXMNCQRBXYYXOMYEVNZYCCSLVINOMYNODRSCYZZYPNZFWOAZDDTMWJOPNZOPESTDZAAZQOAGXPBAEEUNXKPQOAPQFTUEABBARPBHYQCBFFVOYLQRPBQRGUVFBCCBSQCIZRDCGGWPZMRSQCRSHVWGCDDCTRDJASEDHHXQANSTRDSTIWXH

How long would it take a computer to try all 25 shifts?

Page 17: Cryptography

Encryption Scheme #3

Shift different amount for each letter.

Vigenère cipher Pick a secret key: TEACH Write Key: TEACHTEACHTE Message: ATTACKATDAWN Encrypted: TXTCJDETFHPR

Page 18: Cryptography

Vigenère Cipher: Now You Try

Small wheel: plain text (decrypted)Big wheel: cipher text (encrypted)

Repeatedly write key word above message.

For each letter in message: Turn until ∆ points to key letter. To encrypt: Translate from small to big.To decrypt: Translate from big to small.

Page 19: Cryptography

Vigenère Cipher

If you don't know the key, how could you decrypt the message?

What makes a good key?

Page 20: Cryptography

Does anyone see a weakness in this plan? What's the solution?

To Summarize

The keyis

QZXJW

IERUHKDJKEHCIUE

Page 21: Cryptography

Exchanging the Key

IERUHKDJKEHCIUE

QZXJWQZXJW

Page 22: Cryptography

Exchanging the Key

IERUHKDJKEHCIUE

QZXJW QZXJW

Why is this a problem?

Page 23: Cryptography

Book: "Blown to Bits"

"Secure communication was practical only for people who could arrange to meet beforehand, or who had access to a prior method of secure communication (such as military couriers) for carrying the key between them. If Internet communications had to proceed on this assumption, electronic commerce never could have gotten off the ground."

Page 24: Cryptography

The Problem Tom and I need to agree on a key without meeting.

Therefore, the key must be sent at some point.

Therefore, someone might discover the key.

Is there a way I can still use that key to send a message securely?

Yes!

Page 25: Cryptography

Locks123

Let'steachstuff.

What if someone steals the lock? What if someone steals the locked briefcase?

Page 26: Cryptography

Locks How does Tom send messages to me?

I know the combination to one set of locks, which can be used to send messages that only I can read.

You know the combination to another set of locks, which can be used to send messages that only you can read.

Page 27: Cryptography

Locks

This works because

Locks are easy to open, if you know the combination.

Locks are hard to open, if you don't know the combination.

Page 28: Cryptography

Locks

How do you open a lock, if you don't know the combination?

If there are 3 digits, how many combinations do we need to try? (worst case)

Page 29: Cryptography

Locks Suppose someone can crack my 3-digit combo lock in 15 minutes, by trying every combination. Do I give up on combo locks?

I use more digits! How long to crack a 6-digit lock at this rate?

6 digits: 15,000 minutes = 10 days How long to crack a 12-digit lock at this rate?

12-digits: 30,000 years

Page 30: Cryptography

Locks

Can we make this "lock" idea work over the Internet?

Yes! It's called Public Key Encryption.

Page 31: Cryptography

RSA Encryption How can you tell if the data you submit will be encrypted using RSA?

The URL at the top of the browser will begin with "https://"

Page 32: Cryptography

Public Key Encryption Whenever you see HTTPS, you are using Public Key Encryption.

The information you send using HTTPS is more secure than any encrypted military order sent during World War I, World War II, The Korean War, or The Vietnam War.

Page 33: Cryptography

Public Key Encryption

The public key encryption algorithm is called RSA.

How does RSA work?

Page 34: Cryptography

Representing Messages

First, we must be able to represent any message as a single number.

For example:

A T T A C K A T D A W N

012020010311012004012314

Page 35: Cryptography

RSA Tom has a public key and a secret key.

His public key is (3, 33) His secret key is (7, 33)

(Usually these are really huge numbers with many hundreds of digits!)

Page 36: Cryptography

RSA(7, 33)

(3, 33)

31

msg is 44 3 mod 33= 31

31 7 mod 33= 4

(Assume I can convert any message into a big number, and any big number back into a message.)

Page 37: Cryptography

RSA

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

Encrypt M : M e mod n → C

Decrypt C : C d mod n → M

Page 38: Cryptography

RSA Public Key: (e, n) Secret Key: (d, n)

Everyone knows (e, n). Only Tom knows d.

The Big Question: If I know e and n, can I figure out what d is?

To answer that, I need to understand where e, n, and d came from ...

First, some number theory ...

Page 39: Cryptography

2p - 1 mod pp 2p - 1 mod p3 14 05 16 27 18 09 410 211 1...

Page 40: Cryptography

2p - 1 mod p = 1 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 337 341 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 457 461 463 467 479 487 491 499

What's the pattern? Every prime number greater than 2 ... What's a prime number?

Page 41: Cryptography

2p - 1 mod p = 1 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 337 341 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 457 461 463 467 479 487 491 499 ...

Every prime number greater than 2 ... How could you prove this? How could you disprove this?

Page 42: Cryptography

2p - 1 mod p = 1 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 337 341 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 457 461 463 467 479 487 491 499

What if I told you that: 11 × 31 = 341 Every prime number greater than 2, and also the number 341 ...

... and also some higher non-primes.

Page 43: Cryptography

2p - 1 mod p = 1 I call this the "probably prime" test.

There is an even better test (the Fermat test), where you try 2p - 1, 3p - 1, etc.

Numbers that fool this test are called Carmichael numbers.

Page 44: Cryptography

a p - 1 mod p = 1

"In testing primality of very large numbers chosen at random, the chance of stumbling upon a value that fools the Fermat test is less than the chance that cosmic radiation will cause the computer to make an error in carrying out a 'correct' algorithm. Considering an algorithm to be inadequate for the first reason but not for the second illustrates the difference between mathematics and engineering." --SICP

Page 45: Cryptography

RSA: Choosing the Keys p and q are big random primes.

n = p × q φ = (p - 1)(q - 1)

e is small and relatively prime to φ

d, such that:ed mod φ = 1

p = 3, q = 11

n = 3 × 11 = 33φ = 2 × 10 = 20e = 3

3d mod 20 = 1d = 7

Page 46: Cryptography

RSA: Choosing the Keys

Usually the primes are huge numbers--hundreds of digits long.

Page 47: Cryptography

The Big Question Public Key: (e, n) Secret Key: (d, n)

Everyone knows (e, n). Only Tom knows d.

The Big Question: If I know e and n, can I figure out what d is?

Page 48: Cryptography

Cracking RSA

I can determine d from e and n.

Factor n into p and q.

Page 49: Cryptography

Encryption and Factoring

instead of a lock.

123

are the combination.

Public Key Encryption uses a big number

48985997

The factors of that big number

6997 x 7001

Page 50: Cryptography

Cracking RSA I can determine d from e and n.

Factor n into p and q. φ = (p - 1)(q - 1) ed = 1 (mod φ)

(This is the only way we know to crack RSA.)

Should we give up on RSA?

Page 51: Cryptography

Cracking RSA

How do you factor n ?

Try dividing n by 2, 3, 4, ...

(There are better factoring algorithms, but they're not significantly faster than this.)

Page 52: Cryptography

Cracking RSA Suppose someone can factor my 5-digit number in 1 millisecond, by dividing by every number less than n. Do I give up on RSA?

I use more digits! At this rate, to factor a 10-digit numberwould take 2 minutes.

At this rate, to factor a 15-digit numberwould take 4 months.

At this rate, to factor a 20-digit numberwould take 30,000 years.

At this rate, to factor a 25-digit numberwould take 3 billion years.

We're safe with RSA!

Page 53: Cryptography

Unless ...

What if there's something that can factor a number into its prime factors, that's much faster than a computer?

What could be faster than a computer?

Page 54: Cryptography

Quantum Computers

Shor's Algorithm (1994) lets us factor numbers very quickly on a quantum computer.

If only we had a quantum computer to run it on ...

Page 55: Cryptography

Quantum Computers Can be used to break RSA encryption very quickly.

We're safe for now, because these are very hard to build.

(We do not believe that many other intractable problems could be solved quickly by a quantum computer.)

Page 56: Cryptography

Key Points Ecommerce depends on public key encryption.

Public key encryption is hard to crack because factoring is intractable.

Quantum computers would change that.