1 / 56

Cryptography

Cryptography. Dave Feinberg. Email. Suppose I send an email from fberg@cs.cmu.edu to tomcortina@gmail.com Who has access to that email? What if I want the message to be private?. Encryption. Should it be legal to send encrypted messages?

ina-burks
Télécharger la présentation

Cryptography

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Cryptography Dave Feinberg

  2. Email Suppose I send an email from fberg@cs.cmu.edu to tomcortina@gmail.com Who has access to that email? What if I want the message to be private?

  3. Encryption Should it be legal to send encrypted messages? Is there anyone that should NOT be allowed to send encrypted messages?

  4. sketchystore.com Suppose I'm making a purchase. I click on a link, and it takes me to http://www.sketchystore.com/checkout.jsp

  5. What I send GET /checkout.jsp HTTP/1.1 Host: www.sketchystore.com

  6. 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>

  7. How it looks in my browser

  8. When I press "submit" POST /purchase.jsp HTTP/1.1 Host: www.sketchystore.com User-Agent: Mozilla/4.0 Content-Length: 48 Content-Type: application/x-www-form-urlencoded userid=dave&creditcard=2837283726495601&exp=0109

  9. 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?

  10. 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?

  11. 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.

  12. Encryption Scheme #1 Shift every letter forward by 1 A → B, B → C, ..., Z → A MESSAGE → NFTTBHF Can you decrypt TFDSFU?

  13. 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

  14. 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.

  15. Caesar Cipher How can we decode this:DEEDUSEKBTFEIIYRBOTUSETUJXYI

  16. DEEDUSEKBTFEIIYRBOTUSETUJXYI EFFEVTFLCUGFJJZSCPUVTFUVKYZJ FGGFWUGMDVHGKKATDQVWUGVWLZAK GHHGXVHNEWIHLLBUERWXVHWXMABL HIIHYWIOFXJIMMCVFSXYWIXYNBCM IJJIZXJPGYKJNNDWGTYZXJYZOCDN JKKJAYKQHZLKOOEXHUZAYKZAPDEO KLLKBZLRIAMLPPFYIVABZLABQEFP LMMLCAMSJBNMQQGZJWBCAMBCRFGQ MNNMDBNTKCONRRHAKXCDBNCDSGHR NOONECOULDPOSSIBLYDECODETHIS OPPOFDPVMEQPTTJCMZEFDPEFUIJT PQQPGEQWNFRQUUKDNAFGEQFGVJKU QRRQHFRXOGSRVVLEOBGHFRGHWKLV RSSRIGSYPHTSWWMFPCHIGSHIXLMW STTSJHTZQIUTXXNGQDIJHTIJYMNX TUUTKIUARJVUYYOHREJKIUJKZNOY UVVULJVBSKWVZZPISFKLJVKLAOPZ VWWVMKWCTLXWAAQJTGLMKWLMBPQA WXXWNLXDUMYXBBRKUHMNLXMNCQRB XYYXOMYEVNZYCCSLVINOMYNODRSC YZZYPNZFWOAZDDTMWJOPNZOPESTD ZAAZQOAGXPBAEEUNXKPQOAPQFTUE ABBARPBHYQCBFFVOYLQRPBQRGUVF BCCBSQCIZRDCGGWPZMRSQCRSHVWG CDDCTRDJASEDHHXQANSTRDSTIWXH Deciphering How long would it take a computer to try all 25 shifts?

  17. Encryption Scheme #3 Shift different amount for each letter. Vigenère cipher Pick a secret key: TEACH Write Key: TEACHTEACHTE Message: ATTACKATDAWN Encrypted: TXTCJDETFHPR

  18. 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.

  19. Vigenère Cipher If you don't know the key, how could you decrypt the message? What makes a good key?

  20. Does anyone see a weakness in this plan? What's the solution? To Summarize The key is QZXJW IERUH KDJKE HCIUE

  21. Exchanging the Key QZXJW QZXJW IERUH KDJKE HCIUE

  22. Exchanging the Key QZXJW QZXJW IERUH KDJKE HCIUE Why is this a problem?

  23. 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."

  24. 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!

  25. Locks What if someone steals the lock? What if someone steals the locked briefcase? Let's teach stuff. 123

  26. 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.

  27. 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.

  28. 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)

  29. 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

  30. Locks Can we make this "lock" idea work over the Internet? Yes! It's called Public Key Encryption.

  31. 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://"

  32. 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.

  33. Public Key Encryption The public key encryption algorithm is called RSA. How does RSA work?

  34. 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

  35. 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!)

  36. RSA (Assume I can convert any message into a big number, and any big number back into a message.) (7, 33) (3, 33) msg is 4 4 3 mod 33 = 31 31 7 mod 33 = 4 31

  37. RSA Public Key: (e, n) Secret Key: (d, n) Encrypt M : M e mod n → C Decrypt C : C d mod n → M

  38. 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 ...

  39. 2p - 1 mod p p 2p - 1 mod p 3 1 4 0 5 1 6 2 7 1 8 0 9 4 10 2 11 1 ...

  40. 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?

  41. 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?

  42. 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.

  43. 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.

  44. 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

  45. 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 = 20 e = 3 3d mod 20 = 1 d = 7

  46. RSA: Choosing the Keys Usually the primes are huge numbers--hundreds of digits long.

  47. 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?

  48. Cracking RSA I can determine d from e and n. Factor n into p and q.

  49. Public Key Encryption uses a big number instead of a lock. 48985997 The factors of that big number are the combination. 123 6997 x 7001 Encryption and Factoring

  50. 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?

More Related