Understanding Cryptography Outline Understanding Cryptography: From Caesar to RSA 1 Basic Substitution & Attacks Nicola Chiapolini 2 More Complex Methods 3 Something Completely Different? UZH 4 Two Modern Algorithms Inverted CERN School of Computing, 3-4 March 2011 2 iCSC2011, Nicola Chiapolini, UZH Understanding Cryptography Understanding Cryptography Caesar Caesar if there was occasion for The resulting pair of plain and cipher alphabet is: secrecy, he wrote in cyphers; that is, he used the alphabet plain: ABCD E FGHIJKLMNOPQRS T UV W XYZ in such a manner, that not a cipher: XYZA B CDEFGHIJKLMNOP Q RS T UVW single word could be made out. The way to decipher Example those epistles was to We try this simple message here substitute the fourth for the first letter, as d for a , and so plaintext: WET RY THISS IMPLE MESSA GEHER E for the other letters ciphertext: TBQ OV QEFPP FJMIB JBPPX DBEBO B respectively „The Lives of the Twelve Caesars” Gaius Suetonius 3 iCSC2011, Nicola Chiapolini, UZH 4 iCSC2011, Nicola Chiapolini, UZH iCSC 2011 Lecture 1 3-4 March 2011, CERN Computer Security Theme
Understanding Cryptography Understanding Cryptography Caesar - Remarks Caesar - Attack Letter Frequency T B QOV QEFPP FJMI B J B PPX D B E B O B Key letter frequency shift defines cipher completely (e.g. 3 letters). 6 E key space very small (brute force by hand) 5 Rot13 4 encryption identical to decryption ( A 13 13 B → N → A ) − − 3 e.g to prevent spoilers 2 1 0 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 5 iCSC2011, Nicola Chiapolini, UZH 6 iCSC2011, Nicola Chiapolini, UZH Understanding Cryptography Understanding Cryptography Caesar - Attack Randomised Substitution Plain text AJ BK CL we know/guess that the cipher text use permutations contains message big key-space (26 ! ) DM EN FO there is only one possible position could use symbols GP HQ IR TBQOV QEFPP FJMIB J BPP X D B EBO B SW M ESS A G E TX UY WETRY THISS IMPLE VZ MESSA GEHER E Mnbrvcnp Treasure 7 iCSC2011, Nicola Chiapolini, UZH 8 iCSC2011, Nicola Chiapolini, UZH iCSC 2011 Lecture 1 3-4 March 2011, CERN Computer Security Theme
Understanding Cryptography Understanding Cryptography Randomised Substitution - Attack Multiple Cipher Equivalents Goal: flatten the letter distributions Attacks define multiple options for the cipher alphabet plain text attack need symbols or numbers to extend this idea further frequency analysis for letters: ETAON plain: ABCD E FGH IJ KLMNOPQRSTUVWXYZ frequency analysis for larger groups cipher: BEIN T ACW YY QMJPKOGSLXRZDHVU use partially decrypted words F „The Gold-Bug” E.A.Poe 9 iCSC2011, Nicola Chiapolini, UZH 10 iCSC2011, Nicola Chiapolini, UZH Understanding Cryptography Understanding Cryptography Multiple Cipher Equivalents - Attack Summary of the Basics GMAZD VACKC ARHPG IYTZW RYKHY OTDEK GWDCS EATJU HEOKA MAHAI GETGR YKSEH ADRKZ AHYCU Ideas JXAKH YAKJU HKYGV DTHYU TCGZM DCKYE MYAWA HAKAC RYHYR ZAKPG ARHDT GCKJU HKPDW UHAYB 1 shift alphabet GMDTA ARWAM AWUEZ KYUCG PACUH XYCKD BBYTH 2 randomise alphabet CKYTG XYMDG MAZBT YXPAX CDZBE RWBTY XECZE 3 use multiple cipher equivalents TFGEO ATOZD ECPGO ERARB ZUDRO G ERWH PDXYT G PDGV DTOAC GCPAX CDZBA RKPAC WUHAK PGXYT Attack Methods DIACG ZAPDW ATGOH CPACD BBYTK C ERWH PGXYT brute force D CUOO GCCBU ZKPDC GDBBY THCET GKPDX YTGPD plaintext IAZZS TYJEJ ZAAXS TYMGE RWDVE ZHPAC YIRXA RW ERW KPGXY TD OYX SZGHD ZAWYG CPDES SGETK frequencies (letters, pairs, trigrams) YBUZB AZHPD IAZZY BPACO TGEKY T repeated segments 11 iCSC2011, Nicola Chiapolini, UZH 12 iCSC2011, Nicola Chiapolini, UZH iCSC 2011 Lecture 1 3-4 March 2011, CERN Computer Security Theme
Understanding Cryptography Understanding Cryptography Vigenere Cipher - Algorithm Vigenere Cipher - Attack Idea use more than one full cipher alphabet. 1 determine key-length n 2 split into n columns plain: ABCD E FGHIJKLMNOPQ R S T UV W X Y Z 3 use letter frequency for each column separately cipher C: C DEFGHIJKLMNOPQRSTUVWX Y Z A B cipher E: E FGH I JKLMNOPQRSTUVWXYZABCD Coincidence Counting cipher R: R STUVWXYZABCDEFGHIJ K LMNOPQ cipher N: N OPQRSTUVWXYZABCD E FGHIJKLM ciphertext: YIKEA XYVUW ZZRPV Z GWJN IIYRT I shift 2: YIK EAXYV UWZZR PVZGW JNIIY RT I plaintext: WETRY THISS IMPLE MESSA GEHER E shift 4: Y IKEAX YVUWZ Z RPVZ GWJNI I YRT I key: CERNC ERNCE RNCER NCERN CERNC E ciphertext: YIKEA XYVUW ZZRPV ZGWJN IIYRT I key-length: 4 13 iCSC2011, Nicola Chiapolini, UZH 14 iCSC2011, Nicola Chiapolini, UZH Understanding Cryptography Understanding Cryptography CSC 2010: HTML riddle CSC 2010: HTML riddle - Key Length 0x68 0x56 0x42 0x18 0x50 0x4B 0x52 0x18 0x47 0x68 0x56 0x42 0x18 0x50 Code 1 Take password and create hash 0x5C 0x45 0x41 0x11 0x5A 0x42 0x4A 0x58 0x56 0x4B 0x52 0x18 0x47 0x5C 0x45 0x41 0x11 0x5A 2 check hash against given value 3 if check passed, decipher secret 0x42 0x4B 0x11 0x49 0x52 0x4A 0x42 0x56 0x59 message by XOR with password 0x42 0x4A 0x58 0x56 0x42 0x4B 0x11 0x49 0x52 letters 0x19 0x11 0x76 0x7C 0x16 0x11 0x70 0x17 0x54 0x4A 0x42 0x56 0x59 0x19 0x11 0x76 0x7C 0x16 0x58 0x4F 0x52 0x18 0x11 0x70 0x17 0x54 0x58 0x4F 0x52 0x18 15 iCSC2011, Nicola Chiapolini, UZH 16 iCSC2011, Nicola Chiapolini, UZH iCSC 2011 Lecture 1 3-4 March 2011, CERN Computer Security Theme
Understanding Cryptography Understanding Cryptography CSC 2010: HTML riddle - Columns CSC 2010: HTML riddle - Key Letter 0x68 0x56 0x42 0x18 0x50 0x4B 0x52 0x18 0x47 0x5C 0x45 0x41 0x11 0x5A 0x42 0x4A 0x58 0x56 0x42 0x4B 0x11 0x49 0x52 0x4A 0x11 = 0001 0001 0x42 0x56 0x59 0x19 0x11 0x76 0x7C 0x16 0x20 = 0010 0000 0x11 0x70 0x17 0x54 0x58 0x4F 0x52 0x18 0011 0001 = 0x31 = ‘1’ 0x58 0x57 0x17 0x5B 0x58 0x4D 0x4E 0x18 0x7A 0x78 0x7A 0x7D 0x7F 0x6A 0x7C 0x15 0x64 0x6B 0x76 0x74 0x62 0x72 0x7E 0x61 0x1D 0x19 0x62 0x4A 0x50 0x55 0x17 0x4A 0x54 0x5E 0x5E 0x57 0x5F 0x17 0x17 0x71 http://www.physik.uzh.ch/~nchiapol/icsc 0x11 0x58 0x5A 0x18 0x03 0x0C 0x17 0x41 0x54 0x58 0x45 0x4B 0x11 0x56 0x5B 0x5C 0x1F 0x19 0x7A 0x41 0x11 0x5F 0x56 0x4E 0x5E 0x4B 0x5E 0x4C 0x54 0x19 0x43 0x50 17 iCSC2011, Nicola Chiapolini, UZH 18 iCSC2011, Nicola Chiapolini, UZH Understanding Cryptography Understanding Cryptography Extending Vigenere: Wheel Cipher Extending Vigenere: Plaintext Auto-Key plaintext: WETRY THISS IMPLE MESSA GEHER E 36 disks key: CERN W ETRY T HISSI MPLEM ESSAG E key: disk ordering ciphertext: YIKEU XAZQL PUHDM YTDWM KWZEX I assemble plaintext in one line Weakness read off ciphertext The key has the properties of plaintext. in any other line Strings in key and plaintext at fixed offset. 19 iCSC2011, Nicola Chiapolini, UZH 20 iCSC2011, Nicola Chiapolini, UZH iCSC 2011 Lecture 1 3-4 March 2011, CERN Computer Security Theme
Understanding Cryptography Understanding Cryptography Extending Vigenere: Key Auto-Key Extending Vigenere: The Enigma The Enigma simple rule (sum of last 3 key letters) hard to do manually randomised alphabets simple rules are probably weak generates different alphabet mechanical devices for each letter pseudo random number generator sequence defined by rotors configuration plaintext: WETRY THISS IMPLE MESSA GEHER E huge periods: key: 2473 4 41944 75689 30257 46770 4 ciphertext: YIAUC XIRWW PRVTN PEUXH KKOLR I 26 nRotors 21 iCSC2011, Nicola Chiapolini, UZH 22 iCSC2011, Nicola Chiapolini, UZH Understanding Cryptography Understanding Cryptography A provably secure cipher Block Ciphers The One-Time Pad generate truly random key with same length as message use key only once ciphers worked on one letter at a time could use groups instead 23 iCSC2011, Nicola Chiapolini, UZH 24 iCSC2011, Nicola Chiapolini, UZH iCSC 2011 Lecture 1 3-4 March 2011, CERN Computer Security Theme
Understanding Cryptography Understanding Cryptography Playfair Playfair - Attack Playfair C E R N A encrypt pairs of letters at a time needs a lot of cipher text C E R N A B D F G H pair in row: next to right B D F G H use statistics of letter pairs I K L M O I K L M O pair in column: next below P Q S T U hope for plaintext segments P Q S T U V W X Y Z else: take diagonally opposed algorithm has typical properties V W X Y Z Example e.g. ER → RN plaintext: WETRY T HISS IMPLE MESSA GEHER E ciphertext: EDSNN YBOXX KOSIN KRQUR DNDAN R 25 iCSC2011, Nicola Chiapolini, UZH 26 iCSC2011, Nicola Chiapolini, UZH Understanding Cryptography Understanding Cryptography Summary Complex Methods Codes Instead of letters or groups of letters we could replace whole words. Ideas limited possibilities 1 use multiple alphabets need large code books 2 generate the key during encryption useful for compression 3 encrypt groups of letters Attack Methods coincidence counting reuse of key knowing the rules 27 iCSC2011, Nicola Chiapolini, UZH 28 iCSC2011, Nicola Chiapolini, UZH iCSC 2011 Lecture 1 3-4 March 2011, CERN Computer Security Theme
Recommend
More recommend