510 likes | 516 Views
Information Security and Management 2. Classical Encryption Techniques. Chih-Hung Wang Fall 2011. Basic Concepts. History Kahn’s The Codebreakers (1963 - )
E N D
Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011
Basic Concepts • History • Kahn’s The Codebreakers (1963-) • From its initial and limited use by the Egyptians some 4000 years ago, to the twentieth century where it played a crucial role in the outcome of both world wars. • U.S. Federal Information Processing Standard (DES; Data Encryption Standard). 1977.
History • New Directions in Cryptography • 1976 Diffie and Hellman • Introduced the revolutionary concept of public-key cryptography • Provided a new and ingenious method for key exchange • RSA Cryptosystem • 1978 Rivest, Shamir and Adleman discovered the first practical public-key encryption and signature scheme.
History • ElGamal • 1985, another class of powerful and practical public-key scheme. • First international standard for digital signature (ISO/IEC 9796) • Based on the RSA public-key scheme • U.S. Government: Digital Signature Standard (DSS) • ElGamal like system
Symmetric Encryption • Conventional / private-key / single-key • Sender and recipient share a common key • All classical encryption algorithms are private-key • Was only type prior to invention of public-key in 1970’s
Basic Terminology • Plaintext - the original message • Ciphertext - the coded message • Cipher - algorithm for transforming plaintext to ciphertext • Key - info used in cipher known only to sender/receiver • Encipher (encrypt) - converting plaintext to ciphertext • Decipher (decrypt) - recovering ciphertext from plaintext • Cryptography - study of encryption principles/methods • Cryptanalysis (codebreaking) - the study of principles/ methods of deciphering ciphertext without knowing key • Cryptology - the field of both cryptography and cryptanalysis
Symmetric Encryption • Simplified Model
Symmetric Encryption • Model of conventional cryptosystem
Symmetric Encryption • Expression • X: the plaintext • Y: the Ciphertext • K: the secret key • Encryption: • Y = EK(X) • X = DK(Y)
Requirements • There are two requirements for secure use of symmetric encryption: • We need a strong encryption algorithm • Sender and receiver must have obtained copies of the secret key in a secure fashion and must keep the key secure • It is important to note that the security of symmetric encryption depends on the secrecy of the key
Cryptography • can characterize by: • type of encryption operations used • substitution / transposition / product • number of keys used • single-key or private / two-key or public • way in which plaintext is processed • block / stream
Cryptanalysis • Ciphertext only • Ciphertext to be decoded • Known plaintext • Ciphertext to be decoded • One or more plaintext-ciphertext pairs formed with the secret key
Cryptanalysis • Chosen plaintext • Ciphertext to be decoded • Plaintext message chosen by cryptanalyst, together with its corresponding ciphertext generated with the secret key • Chosen ciphertext • Ciphertext to be decoded • Purported ciphertext chosen by cryptanalyst, together with its corresponding decrypted plaintext generated with the secret key
Unconditionally Secure • The ciphertext generated by the scheme does not contain enough information to determine uniquely the corresponding plaintext, no mater how much ciphertext is available. • One-time pad • No practical encryption algorithm is unconditionally secure
Computationally Secure • An encryption scheme is computationally secure if the ciphertext generated by the scheme meets one or both of the following criteria: • The cost of breaking the cipher exceeds the value of the encrypted information • The time required to break the cipher exceeds the useful lifetime of the information
Key length (bits) Breaking time 40 2 seconds 56 35 hours 64 1 years 70 700 centenaries 128 1016(Thousand years) Security Concept • PGPcompany (1997) • $100,000 computer: Brute-force attack
The attacker tries every possible key on a piece of ciphertext until an intelligible translation into plaintext is obtained. On average, half of all possible keys must be tried to achieve success Exhaustive Search Brute-force Attack
Classical Encryption • Poem • 紀曉嵐: 精神炯炯 老貌堂堂 烏巾白髯 龜鶴呈祥 • Riddle • 紀曉嵐: 鳳遊禾蔭鳥飛去 馬走蘆邊草不生
Classical Encryption 6 H28 Serial number of a can
Classical Encryption • Substitution Techniques • Caesar Cipher • Plaintext: meet me after the toga party • Cipher :PHHW PH DIWHU WKH WRJD SDUMB • C=E(p) = (p+3) mod (26) • C=E(p) = (p+ (or -) k) mod (26) • Brute-force cryptanalysis • The encryption and decryption algorithms are known • Try all 25 possible keys • The language of the plaintext is known and easily recognizable
Classical Encryption • Monoalphabetic Ciphers • A dynamic increase in the key space can be achieved by allowing an arbitrary substitution. • Plain : a b c d e f g • Cipher: D C Q F A M Z • Possible keys = 26! > 4x1026 • Time evaluation • Assume one can try 10000 keys per second • Average time to find out the key • 4x1026 / 4x107x104x2 =5x1014 years
Monoalphabetic Ciphers • Cryptanalysis • The relative frequency of the letters can be determined and compared to a standard frequency distribution for English • Ex: Ciphertext: UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZVUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSXEPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ
P:13.13 H:5.83 F:3.33 B:1.67 C:0 Z:11.67 D:5.00 W:3.33 G:1.67 K:0 S:8.33 E:5.00 Q:2.50 Y:1.67 L:0 U:8.33 V:4.17 T:2.50 I:0.88 N:0 O:7.50 X:4.17 A:1.67 J:0.88 R:0 M:6.67 Monoalphabetic Ciphers • Relative frequency table
Monoalphabetic Ciphers • Relative Frequency of Letters in English Text
E:12.75 L:3.75 W:1.50 T:9.25 H:3.50 V:1.50 R:8.50 C:3.50 B:1.25 N:7.75 F:3.00 K:0.50 I:7.75 U:3.00 X:0.50 O:7.50 M:2.75 Q:0.50 A:7.25 P:2.75 J:0.25 S:6.00 Y:2.25 Z:0.25 D:4.25 G:2.00 Monoalphabetic Ciphers • Comparing results
Monoalphabetic Ciphers • It seems likely … • P & Z are the equivalents of E & T • S,U,O, M and H are all of relatively high frequency and probably corresponding to plain letters from the set {R,N,I,O,A,S} • The letters with the lowest frequencies: A, B, G, I and J are likely included in the set {W, V, B, K, X, Q, J, Z} • Powerful Tools: the frequency of two-letter combinations.
Playfair Cipher • not even the large number of keys in a monoalphabetic cipher provides security • one approach to improving security was to encrypt multiple letters • the Playfair Cipher is an example • invented by Charles Wheatstone in 1854, but named after his friend Baron Playfair
Playfair Key Matrix • a 5X5 matrix of letters based on a keyword • fill in letters of keyword (sans duplicates) • fill rest of matrix with other letters • eg. using the keyword MONARCHY
Encrypting and Decrypting • Plaintext encrypted two letters at a time: • if a pair is a repeated letter, insert a filler like 'X', eg. "balloon" encrypts as "ba lx lo on" • if both letters fall in the same row, replace each with letter to right (wrapping back to start from end), eg. “ar" encrypts as "RM" • if both letters fall in the same column, replace each with the letter below it (again wrapping to top from bottom), eg. “mu" encrypts to "CM" • otherwise each letter is replaced by the one in its row in the column of the other letter of the pair, eg. “hs" encrypts to "BP", and “ea" to "IM" or "JM" (as desired)
Security of the Playfair Cipher • Security much improved over monoalphabetic since have 26 x 26 = 676 digrams • would need a 676 entry frequency table to analyse (verses 26 for a monoalphabetic) • and correspondingly more ciphertext • was widely used for many years (eg. US & British military in WW1) • it can be broken, given a few hundred letters • since still has much of plaintext structure
Polyalphabetic Ciphers • Another approach to improving security is to use multiple cipher alphabets called polyalphabetic substitution ciphers • Makes cryptanalysis harder with more alphabets to guess and flatter frequency distribution • Use a key to select which alphabet is used for each letter of the message • Use each alphabet in turn • Repeat from start after end of key is reached
Vigenère Cipher • Simplest polyalphabetic substitution cipher is the Vigenère Cipher • Effectively multiple caesar ciphers • Key is multiple letters long K = k1 k2 ... kd • ith letter specifies ith alphabet to use • Use each alphabet in turn • Repeat from start after d letters in message • Decryption simply works in reverse
Example • Write the plaintext out • Write the keyword repeated above it • Use each key letter as a caesar cipher key • Encrypt the corresponding plaintext letter • eg using keyword deceptive key: deceptivedeceptivedeceptive plaintext: wearediscoveredsaveyourself ciphertext:ZICVTWQNGRZGVTWAVZHCQYGLMGJ
Aids • Simple aids can assist with en/decryption • a Saint-Cyr Slide is a simple manual aid • a slide with repeated alphabet • line up plaintext 'A' with key letter, eg 'C' • then read off any mapping for key letter • can bend round into a cipher disk • or expand into a Vigenère Tableau (see text Table 2.3)
Security of Vigenère Ciphers • have multiple ciphertext letters for each plaintext letter • hence letter frequencies are obscured but not totally lost • start with letter frequencies • see if look monoalphabetic or not • if not, then need to determine number of alphabets, since then can attach each
Autokey Cipher • ideally want a key as long as the message • Vigenère proposed the autokey cipher • with keyword is prefixed to message as key • knowing keyword can recover the first few letters • use these in turn on the rest of the message • but still have frequency characteristics to attack • eg. given key deceptive key: deceptivewearediscoveredsav plaintext: wearediscoveredsaveyourself ciphertext:ZICVTWQNGKZEIIGASXSTSLVVWLA
Gilbert Vernam (1918) • Encryption • Decryption pi : ith binary digit of plaintext ki: ith binary digit of key ci : ith binary digit of ciphertext : exclusive-or (XOR)
One-Time Pad • if a truly random key as long as the message, with no repetitions is used, the cipher will be secure called a One-Time pad • is unbreakable since ciphertext bears no statistical relationship to the plaintext • since for any plaintext & any ciphertext there exists a key mapping one to other • can only use the key once though • have problem of safe distribution of key
Two Fundamental Difficulties • Making large quantities of random keys • Key distribution problem • Limited utility: is useful primarily for low-bandwidth channels
Transposition Ciphers • now consider classical transposition or permutation ciphers • these hide the message by rearranging the letter order • without altering the actual letters used • can recognise these since have the same frequency distribution as the original text
Key 4 3 1 2 5 6 7 plain a t t a c k p o s t p o n e d u n t i l t w o a m x y z Transposition Ciphers • Transposition Techniques • Ciphertext: • TTNAAPTMTSUOAODWCOIXKNLYPETZ
Rotor Machines • Before modern ciphers, rotor machines were most common product cipher • were widely used in WW2 • German Enigma, Allied Hagelin, Japanese Purple • Implemented a very complex, varying substitution cipher • Used a series of cylinders, each giving one substitution, which rotated and changed after each letter was encrypted • with 3 cylinders have 263=17576 alphabets
Steganography • An alternative to encryption • Hides existence of message • using only a subset of letters/words in a longer message marked in some way • using invisible ink • hiding in LSB in graphic image or sound file • Has drawbacks • high overhead to hide relatively few info bits
Relative Techniques • Character marking • Invisible ink • Pin punctures • Typewriter correction ribbon