150 Views

Download Presentation
## Chapter 2 Advanced Cryptography (Part A)

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -

**Chapter 2 Advanced Cryptography (Part A)**• Overview • History of cryptography • Cryptanalysis**What is Cryptography? (review)**• Cryptography is the process of converting plaintext into ciphertext • to hide information from unauthorized users • Plaintext: readable text (also called cleartext) • Ciphertext: unreadable or encrypted text • Decryption is the process of converting ciphertext back to plaintext**Cryptosystems (review)**• Cryptosystems provide the following services: • Confidentiality: denies unauthorized parties access to information. • Authenticity: validates the source of the message, to ensure that the sender is properly identified. • Integrity: provides assurance that the message was not modified, accidentally or intentionally. • Nonrepudiation: establishes that a particular sender has sent the message so that they cannot deny having sent the message at a later date. • Different types of messages require higher or lower degrees of one or all of the services. For example …**Strength of Cryptosystem (review)**• The strength of the algorithm and the secrecy of the key determine how secure the encrypted data is • E.g.: breaking a cryptosystem can be accomplished by a brute force attack • Trying every possible key value until the resulting plaintext is meaningful. • If a key can be broken with a Pentium processor in three hours, the cipher is not strong at all. • If the key can only be broken with the use of a thousand multiprocessing systems over 1.2 million years, then it is pretty strong. Security is relative**Chapter 2 Advanced Cryptography (Part A)**• Overview • History of cryptography • Cryptanalysis**History of cryptography**• The first encryption methods date back to 4000 years ago. • Some Egyptian hieroglyphics were encrypted • Atbash Cipher a Hebrew cryptographic method • the alphabet to be flipped so that each letter in the original alphabet was mapped to a different letter in the flipped, alphabet. ABCDEFGHIJKLMNOPQRSTUVWXYZ ZYXWVUTSRQPONMLKJIHGFEDCBA e.g.: Encypt “atbash” ? Decrpt “hvxfirgb” ?**Scytale Cipher (review)**• Scytale cipher400 B.C. the Spartans • Write a message on a sheet of papyrus that was wrapped around a staff; • The papyrus was delivered and wrapped around a different staff by the recipient; • The message was only readable if it was wrapped around the correct size staff, which would make the letters properly match up**Caesar Cipher (review)**Julius Caesar (100–44 B.C.) developed a simple encryption method -- shifted the alphabet by three positions Standard Alphabet: ABCDEFGHIJKLMNOPQRSTUVWXYZ Cryptographic Alphabet: DEFGHIJKLMNOPQRSTUVWXYZABC Example: Encypt “caesar” ? Decrpt “vhfxulwb” ?**Substitution Cipher (review)**• Both Atbash cipher and Caesar Cipher are substitution cipher, because each character is replaced with another character. • Monoalphabetic substitution cipher: uses only one alphabet, • Polyalphabetic substitution cipher: uses multiple alphabets Q1. Can you formulate them use mathematically? Hint: integers 0 – 25 represent 26 characters; m: message / plaintext, c: cipher text; encryption: c = E(m) = ? decryption: m = D(c) = ? Q2. Is Scytale cipher a substitution cipher?**Transposition Cipher (review)**Transposition Cipher: rearrange letters in plaintext to produce cipher text • Scytale cipher is a transposition cipher • Rail-Fence cipher is another transposition cipher • Plaintext is HELLO WORLD • Encryption: c = E(m) HLOOL ELWRD HLOOLELWRD • Describe decryption process: m = D(c) = ?**Vigenère Cipher**• The Vigenère cipher is a method of encryption that uses a series of different Caesar ciphers based on the letters of a keyword. • Appears to be unbreakable. The Vigenère cipher has been reinvented many times. • The method was originally described by Giovan Batista Belaso in his 1553 book La cifra del. Sig. Giovan Batista Belaso • However, the scheme was later misattributed to Blaise de Vigenère in the 19th century, and is now widely known as the "Vigenère cipher".**Terms in Vigènere Cipher**• Vigènere table: a table used to encipher and decipher Vigènere cipher has key letters on top, plaintext letters on the left. • There are 27 shift alphabets • Vigènere cipher is a polyalphabetic substitution cipher. In contrary, Caesar cipher is a monoalphabetic substitution cipher • Key is used with Vigènere table in encryption / decryption**G I V**A G I V B H J W E L M Z H N P C L R T G O U W J S Y A N T Z B O Y E H T The Vigènere Table A mini example Encryption: A key letter V, and a plaintext letter T follow V column down to T row “O” Decryptioin: A key letter V, and a ciphertext letter O “T”**Vigènere Cipher Example**• If the message is longer than the key, the key repeats itself • E.g. 1: Key: LEMON Encrypt plaintext: ATTACKATDAWN • E.g.2, Decrypt ciphertext: P R U U Z L Q: How to represent Vigènere Cipher in formula? (Hint: encryption / decryption is done character by character)**Exercise**1) Encrypt a plaintext with the key “lucky” c o m p u t i n g g i v e s i n s i g h t 2) Decrypt a ciphertext with the key “vector” o l k l w j v r g q o d k p g h t k c i x b u v i i t x q z k l g k**Chapter 2 Advanced Cryptography (Part A)**• Overview • History of cryptography • Cryptanalysis**Cryptanalysis**• Cryptanalysisis the science of studying and breaking the secrecy of encryption processes, compromising authentication schemes, and reverse-engineering protocols. • All previously introduced ciphers have been broken. • Basic methods: • Statistical analysis • Exhaustive search key space**Statistical analysis**• Each character has a certain frequency. A.k.a. 1-gram model of English**Statistical Analysis (1)**• f(c) frequency of character c in ciphertext • p(x) is frequency of character x in English • (i) correlation of frequency of letters in ciphertext with corresponding letters in English, assuming key is i (i) = 0 ≤ c ≤ 25f(c)p(c – i)**Statistical Attack (2)**• E.g., a Caesar cipher : KHOOR ZRUOG step 1: Compute frequency of each letter in ciphertext: G 0.1 H 0.1 K 0.1 O 0.3 R 0.2 U 0.1 Z 0.1 Step 2: Compute correlation for key i (i) = 0.1p(6 – i) + 0.1p(7 – i) + 0.1p(10 – i) + 0.3p(14 – i) + 0.2p(17 – i) + 0.1p(20 – i) + 0.1p(25 – i)**The Result**Step 3: find the most probable keys, based on : • i = 6, (i) = 0.0660 • plaintext EBIIL TLOLA • i = 10, (i) = 0.0635 • plaintext AXEEH PHKEW • i = 3, (i) = 0.0575 • plaintext HELLO WORLD • i = 14, (i) = 0.0535 • plaintext WTAAD LDGAS • The only valid English phrase is for i = 3. That’s the key (3 or ‘D’)**Exhaustive search**• Exhaustive search • If the key space is small enough, try all possible keys until you find the right one Q 1: How large is the key space in Caesar cipher ? Q2: If we use exhaustive search, what is the expected number of trials when breaking Caesar cipher? Q3: How about the key space of Vigènere Cipher? Q4: How to break Vigènere Cipher?**Attacking Vigènere Cipher**• Vigenere ciphers were regarded by many as practically unbreakable for 300 years. • In 1863, a Prussian major named Kasiski proposed a method for breaking it. • This method was not in fact invented by Kasiski but instead by Charles Babbage; • Babbage's discovery was used to aid English military campaigns, and was not published until several years later; as a result credit for the development was instead given to Friedrich Kasiski**Statistical analysis of Vigènere Cipher**• Establish period n (the length of key) • Break cipher into n parts, each part being enciphered using the same key letter • Solve each part leverage one part from another We want to break this cipher: ADQYS MIUSB OXKKT MIBHK IZOOO EQOOG IFBAG KAUMF VVTAA CIDTW MOCIO EQOOG BMBFV ZGGWP CIEKQ HSNEW VECNE DLAAV RWKXS VNSVP HCEUT QOIOF MEGJS WTPCH AJMOC HIUIX**Step 1. Establish Period n**• Important observation: Repetitions in the ciphertext • occur when characters of the key appear over the same characters in the plaintext e.g. Key VIGVIGVIGVIGVIGV plain THEBOYHASTHEBALL cipher OPKWWECIYOPKWIRG**Estimate of Period n**• A long repetition “OEQOOG” and “MOC” are probably not coincidence • Their distances are 30 and 72. The greatest common divisor of 30 and 72 is 6. • many other shorter repetitions have 2 and 3 in their factors • Thus the estimate period n = 6 • Verify Period n by Friedman test (we skip this part)**Step 2: Break cipher into n parts**Key-1: AIKHOIATTOBGEEERNEOSAI Key-2: DUKKEFUAWEMGKWDWSUFWJU Key-3: QSTIQBMAMQBWQVLKVTMTMI Key-4: YBMZOAFCOOFPHEAXPQEPOX Key-5: SOIOOGVICOVCSVASHOGCC Key-6: MXBOGKVDIGZINNVVCIJHH**Statistical Analysis each part**Counting characters in each part ABCDEFGHIJKLMNOPQRSTUVWXYZ • 31004011301001300112000000 • 10022210013010000010404000 • 12000000201140004013021000 • 21102201000010431000000211 • 10500021200000500030020000 • 01110022311012100000030101 Compare with unshifted alphabet frequencies in English: HMMMHMMHHMMMMHHMLHHHMLLLLL**Solve each part (2)**• First part: matches characteristics of unshifted alphabet A A • Third part : I A • Sixth part : V A • Substitute into ciphertext: ADIYS RIUKB OCKKL MIGHK AZOTO EIOOL IFTAG PAUEF VATAS CIITW EOCNO EIOOL BMTFV EGGOP CNEKIHSSEW NECSE DDAAA RWCXS ANSNP HHEUL QONOF EEGOS WLPCM AJEOC MIUAX**Solve each part (3) further analysis**• AJE in last line suggests “ARE”, meaning second alphabet maps A into S: ALIYS RICKB OCKSL MIGHS AZOTO MIOOL INTAG PACEF VATIS CIITE EOCNO MIOOL BUTFV EGOOP CNESI HSSEE NECSE LDAAA RECXS ANANP HHECL QONON EEGOS ELPCM AREOC MICAX**Solve each part (4) further analysis**• MICAX in last line suggests “mical” (a common ending for an adjective), meaning fourth alphabet maps O into A: • QI means that U maps into I, as Q is always followed by U: ALIMS RICKP OCKSL AIGHS ANOTO MICOL INTOG PACET VATIS QIITE ECCNO MICOL BUTTV EGOOD CNESI VSSEE NSCSE LDOAA RECLS ANAND HHECL EONON ESGOS ELDCM ARECC MICAL**Got It!**ALIME RICKP ACKSL AUGHS ANATO MICAL INTOS PACET HATIS QUITE ECONO MICAL BUTTH EGOOD ONESI VESEE NSOSE LDOMA RECLE ANAND THECL EANON ESSOS ELDOM ARECO MICAL Note that: Vigenere cipher is easy to break by hand. However, the principle of cryptanalysishold for more complex ciphers that can be implemented only by computer.**The War Machines: The Purple Machine**• The Purple Machine is developed and used by the Japanese during World War II • Employed techniques discovered by Herbert O. Yardley • The code was broken by William Frederick Friedman • Known as the “Father of U.S. Cryptanalysis”**The War Machines: Enigma**• Enigma is developed by Arthur Scherbius • Used by the Germans during World War II • Enigma substituted each letter typed by an operator • Substitutions were computed using a key and a set of switches or rotors • The code was broken first by a group of Polish cryptographers • The machine for breaking the code was called the “Bombe”**Design of Enigma Machine**An electrical voltage applied to the Q terminal on the top row will appear at the L terminal on the bottom row.**How to use the Enigma machine?**• The originator configures the Enigma machine to its initial settings; • Type in the first letter of the message, and the machine would substitute the letter with a different letter; • The encryption was done by moving the rotors a predefined number of times • Advance the rotors and enter the next letter. Each time a new letter was to be encrypted, the operator would advance the rotors to a new setting.**Mechanism of the Enigma Machine**• The chosen substitution for each letter was dependent upon the rotor setting • Assumption: the operators at each end needed to know • the key - the initial setting, which is the crucial and secret part of this process • And how to advanced the rotors when encrypting and decrypting a message