Briefly review some terminology used throughout the course.
Detail 5 ingredients of the symmetric cipher model: plaintext encryption algorithm – performs substitutions/transformations on plaintext secret key – control exact substitutions/transformations used in encryption algorithm ciphertext decryption algorithm – inverse of encryption algorithm
Basert på enveis funksjoner Offentlige nøkler kan sender over usikret media, mens private nøkler skal holdes hemmelige. Forskjell fra symmetrisk pga privat skal kun 1 person vite mens ved secret er det flere enn 1 person som kjenner til nøklen. Vanskeligheten ligger i sikker utveksling av offentlig nøkkel Hvem som helst kan lese det som krypteres med privat nøkkel (autentisering) Bare eier av den private nøkkel kan lese det som krypteres med den offentlige nøkkelen (kryptering) RSA. Diffie-Hellman
Generally assume that the algorithm is known. This allows easy distribution of s/w and h/w implementations. Hence assume just keeping key secret is sufficient to secure encrypted messages. Have plaintext X, ciphertext Y, key K, encryption alg Ek, decryption alg Dk.
Deep crack, EFF ’98: 88x10^9 encr/s -> approx 5 days. They solved a 56 bit key in 3 days.
Transposition Ciphers form the second basic building block of ciphers. The core idea is to rearrange the order of basic units (letters/bytes/bits) without altering their actual values.
Example message is: "meet me after the toga party" with a rail fence of depth 2. How do you cryptanalyze this? Freq analysis shows expected distribution with expected letters, so you have to suspect transpositions
Transposition ciphers often are block ciphers…
In this section and the next, we examine a sampling of what might be called classical encryption techniques. A study of these techniques enables us to illustrate the basic approaches to symmetric encryption used today and the types of cryptanalytic attacks that must be anticipated. The two basic building blocks of all encryption techniques: substitution and transposition. We examine these in the next two sections. Finally, we discuss a system that combine both substitution and transposition.
Substitution ciphers form the first of the fundamental building blocks. The core idea is to replace one basic unit (letter/byte) with another. Whilst the early Greeks described several substitution ciphers, the first attested use in military affairs of one was by Julius Caesar, described by him in Gallic Wars (cf. Kahn pp83-84). Still call any cipher using a simple letter shift a caesar cipher , not just those with shift 3. Note: when letters are involved, the following conventions are used in this course: Plaintext is always in lowercase; ciphertext is in uppercase; key values are in italicized lowercase.
This mathematical description uses modulo arithmetic (ie clock arithmetic). Here, when you reach Z you go back to A and start again. Mod 26 implies that when you reach 26, you use 0 instead (ie the letter after Z, or 25 + 1 goes to A or 0). Example: howdy (7,14,22,3,24) encrypted using key f (5) is MTBID
Definition: each character is independently encrypted (hence, a single rewriting alphabet is used)
Consider ways to reduce the "spikyness" of natural language text, since if just map one letter always to another, the frequency distribution is just shuffled. One approach is to encrypt more than one letter at once. Playfair cipher is an example of doing this.
Have here the rules for filling in the 5x5 matrix, L to R, top to bottom, first with keyword after duplicate letters have been removed, and then with the remain letters, with I/J used as a single letter. This example comes from Dorothy Sayer's book "Have His Carcase", in which Lord Peter Wimsey solves this, and describes the use of a probably word attack.
Note the various rules, and how you wrap from right side back to left, or from bottom back to top. Decrypting of course works exactly in reverse. Can see this by working the example pairs shown, backwards.
One approach to reducing the "spikyness" of natural language text is used the Playfair cipher which encrypts more than one letter at once. We now consider the other alternative, using multiple cipher alphabets in turn. This gives the attacker more work, since many alphabets need to be guessed, and because the frequency distribution is more complex, since the same plaintext letter could be replaced by several ciphertext letters, depending on which alphabet is used. Definition: nonmonoalphabetic
Simply create a set of caesar cipher translation alphabets, then use each in turn, as shown next.
See that the key used is the keyword "DECEPTIVE" prefixed to as much of the message "WEAREDISCOVEREDSAV" as is needed. When deciphering, recover the first 9 letters using the keyword "DECEPTIVE". Then instead of repeating the keyword, start using the recovered letters from the message "WEAREDISC". As recover more letters, have more of key to recover later letters. Problem is that the same language characteristics are used by the key as the message. ie. a key of 'E' will be used more often than a 'T' etc hence an 'E' encrypted with a key of 'E' occurs with probability (0.1275)^2 = 0.01663, about twice as often as a 'T' encrypted with a key of 'T' have to use a larger frequency table, but it exists given sufficient ciphertext this can be broken.
The One-Time Pad is an evolution of the Vernham cipher, which was invented by Gilbert Vernham in 1918, and used a long tape of random letters to encrypt the message. An Army Signal Corp officer, Joseph Mauborgne, proposed an improvement using a random key that was truly as long as the message, with no repetitions, which thus totally obscures the original message. Since any plaintext can be mapped to any ciphertext given some key, there is simply no way to determine which plaintext corresponds to a specific instance of ciphertext. Can only use once though. Still have problem of safe distribution of key
Decryption of Enigma. Allies knew wiring by intercepting documents, but didn’t know the most current settings. Daily, Germans transmitted new settings in a way that reliably repeated some plaintext. Turing and others at Bletchley figured out how to use this to figure out settings. Using a huge amount of equipment and personnel they at times (not always) were able to decrypt transmissions within hours. This effort was just barely working – by adopting a little more hassle, the Germans could have made the numbers way too big for this decryption approach to work. But the Germans thought it was infeasible already.
Wildly unsubstantiated claims in Sept 2001 that Al-Qaeda had been using steganography in public bulletin board systems to communicate -- pretty silly, since we didn’t even know who the terrorists were!
Now let me explain modes of operation, Federal Information Processing Standards Publications (FIPS PUBS 81) This FIPS defines four modes of operation for the DES which may be used in a wide variety of applications. The modes specify how data will be encrypted (cryptographically protected) and decrypted (returned to original form). This recommendation specifies five confidentiality modes of operation for symmetric key block cipher algorithms, such as the algorithm specified in FIPS Pub. 197, the Advanced Encryption Standard (AES) . The modes may be used in conjunction with any symmetric key block cipher algorithm that is approved by a Federal Information Processing Standard (FIPS). The five modes—the Electronic Codebook (ECB), Cipher Block Chaining (CBC), Cipher Feedback (CFB), Output Feedback (OFB), and Counter (CTR) modes—can provide data confidentiality.
There are two recommended methods for generating unpredictable IVs. The first method is to apply the forward cipher function, under the same key that is used for the encryption of the plaintext, to a nonce. The nonce must be a data block that is unique to each execution of the encryption operation. For example, the nonce may be a counter,or a message number. The second method is to generate a random data block using a FIPS-approved random number generator.
Let E denote a function which takes a block of 32 bits as input and yields a block of 48 bits as output. Let E be such that the 48 bits of its output, written as 8 blocks of 6 bits each, are obtained by selecting the bits in its inputs in order according to the following table: Each of the unique selection functions S1,S2,...,S8, takes a 6-bit block as input and yields a 4-bit block as output and is illustrated by using a table containing the recommended S1:
Cipher TechniquesApril 9, 2013 1
Road Map Basic Terminology Cryptosystem Classical Cryptography Algorithm Types and Modes Data Encryption Standard Other Stream & Block CiphersApril 9, 2013 2
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 cryptanalysisApril 9, 2013 3
Cryptosystem A cryptosystem is a five-tuple (P,C,K,E,D), where the following are satisfied: 1. P is a finite set of possible plaintexts. 2. C is a finite set of possible ciphertexts. 3. K, the key space, is a finite set of possible keys 4. ∀K∈K, ∃EK∈E (encryption rule), ∃DK∈D (decryption rule). Each EK: P→C and DK: C→P are functions such that ∀x∈P, DK(EK(x)) = x.April 9, 2013 4
Requirements Two requirements for secure use of symmetric encryption: a strong encryption algorithm a secret key known only to sender / receiver Y = EK(X) X = DK(Y) assume encryption algorithm is known implies a secure channel to distribute keyApril 9, 2013 8
Types of Cryptanalytic Attacks adversary needs strongest attack ciphertext only only know algorithm / ciphertext, statistical, can identify plaintext, or worse: the key known plaintext know/suspect plaintext & ciphertext to attack cipher chosen plaintext select plaintext and obtain ciphertext to attack cipher chosen ciphertext select ciphertext and obtain plaintext to attackadversary’s attacks cipher can be weaker chosen text April 9, 2013 select either plaintext or ciphertext to en/decrypt 10 to
Brute Force Search always possible to simply try every key most basic attack, proportional to size of key space assume either know / recognise plaintextApril 9, 2013 11
Transposition Ciphers 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 textApril 9, 2013 12
Rail Fence cipher writemessage letters out diagonally over a number of rows then read off cipher row by row eg. write message out as: m e m a t r h t g p r y e t e f e t e o a a t giving ciphertext MEMATRHTGPRYETEFETEOAATApril 9, 2013 13
Row Transposition Ciphersa more complex scheme write letters of message out in rows over a specified number of columns then reorder the columns according to some key before reading off the rows Key: 4 3 1 2 5 6 7 Plaintext: 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 Ciphertext: TTNAAPTMTSUOAODWCOIXKNLYPETZApril 9, 2013 14
Classical Substitution Ciphers where letters of plaintext are replaced by other letters or by numbers or symbols or if plaintext is viewed as a sequence of bits, then substitution involves replacing plaintext bit patterns with ciphertext bit patternsApril 9, 2013 15
Caesar Cipher earliest known substitution cipher by Julius Caesar first attested use in military affairs replaces each letter by 3rd letter after it example: meet me after the toga party PHHW PH DIWHU WKH WRJD SDUWBApril 9, 2013 16
Caesar Cipher can define transformation as: 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 D E F G H I J K L M N O P Q R S T U V W X Y Z A B C mathematically give each letter a number a b c d e f g h i j k l m 0 1 2 3 4 5 6 7 8 9 10 11 12 n o p q r s t u v w x y Z 13 14 15 16 17 18 19 20 21 22 23 24 25 then have Caesar cipher as: C = E(p) = (p + k) mod (26) p = D(C) = (C – k) mod (26)April 9, 2013 17
Monoalphabetic Cipher rather than just shifting the alphabet could shuffle (jumble) the letters arbitrarily each plaintext letter maps to a different random ciphertext letter hence key is 26 letters long Plain: abcdefghijklmnopqrstuvwxyz Cipher: DKVQFIBJWPESCXHTMYAUOLRGZN Plaintext: ifwewishtoreplaceletters Ciphertext: WIRFRWAJUHYFTSDVFSFUUFYAApril 9, 2013 18
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 PlayfairApril 9, 2013 19
Playfair Key Matrix a 5X5 matrix of letters based on a keyword (I and J aren’t distinguished) fill in letters of keyword (sans duplicates) fill rest of matrix with other letters eg. using the keyword MONARCHY MONAR CHYBD EFGIK LPQST UVWXZApril 9, 2013 20
Encrypting and Decrypting plaintext encrypted two letters at a time: 1. 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). Except when that doesn’t work! 2. if a pair is a repeated letter, insert a filler like X, eg. "balloon" transformed to "ba lx lo on" 3. 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" 4. 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"April 9, 2013 21
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 reachedApril 9, 2013 22
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 reverseApril 9, 2013 23
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:ZICVTWQNGRZGVTWAVZHCQYGLMGJApril 9, 2013 24
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:ZICVTWQNGKZEIIGASXSTSLVVWLAApril 9, 2013 25
One-Time Pad ifa truly random key as long as the message 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 unconditional security! why look any further??April 9, 2013 26
Product Ciphers ciphers using substitutions or transpositions are not secure because of language characteristics hence consider using several ciphers in succession to make harder (Shannon) two substitutions make a more complex substitution two transpositions make more complex transposition but a substitution followed by a transposition makes a new much harder cipher this is bridge from classical to modern ciphersApril 9, 2013 27
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 3! rearrangements of cylinders in EnigmaApril 9, 2013 28
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 bitsApril 9, 2013 29
Algorithm Types and Modes An Algorithm type defines what size of plain text should be encrypted in each step of algorithm An Algorithm mode defines the details of the cryptographic algorithm, once the type is decided.April 9, 2013 30
Algorithm Types Stream Ciphers Block CiphersAlgorithm Modes ElectronicCode Book Work On Block Cipher Cipher Block Chaining Cipher FeedBack Work On Block Ciphers acting as Output FeedBack Stream CipherApril 9, 2013 31
Stream, Block Ciphers E encipherment function Ek(b) encipherment of message b with key k In what follows, m = b1b2 …, each bi of fixed length Block cipher Ek(m) = Ek(b1)Ek(b2) … Stream cipher k = k1k2 … Ek(m) = Ek1(b1)Ek2(b2) … If k1k2 … repeats itself, cipher is periodic and the kength of its period is one cycle of k1k2 …April 9, 2013 32
Stream Ciphers Often (try to) implement one-time pad by xor’ing each bit of key with one bit of message Example: m = 00101 k = 10010 c = 10111 But how to generate a good key?April 9, 2013 33
Synchronous Stream Ciphers n-stage Linear Feedback Shift Register: consists of n bit register r = r0…rn–1 n bit tap sequence t = t0…tn–1 Use: Use rn–1 as key bit Compute x = r0t0 ⊕ … ⊕ rn–1tn–1 Shift r one bit to right, dropping rn–1, x becomes r0April 9, 2013 34
Example 4-stage LFSR; t = 1001 r ki new bit computation new r 0010 0 01⊕00⊕10⊕01 = 0 0001 0001 1 01⊕00⊕00⊕11 = 1 1000 1000 0 11⊕00⊕00⊕01 = 1 1100 1100 0 11⊕10⊕00⊕01 = 1 1110 1110 0 11⊕10⊕10⊕01 = 1 1111 1111 1 11⊕10⊕10⊕11 = 0 0111 0111 1 11⊕10⊕10⊕11 = 1 1011 Key sequence has period of 15 (010001111010110)April 9, 2013 36
NLFSR n-stage Non-Linear Feedback Shift Register: consists of n bit register r = r0…rn–1 Use: Use rn–1 as key bit Compute x = f(r0, …, rn–1); f is any function Shift r one bit to right, dropping rn–1, x becomes r0 Note same operation as LFSR but more general bit replacement functionApril 9, 2013 37
Self-Synchronous StreamCipher Takekey from message itself (autokey) Example: Vigenère, key drawn from plaintext key XTHEBOYHASTHEBA plaintext THEBOYHASTHEBAG ciphertext QALFPNFHSLALFCT Problem: Statistical regularities in plaintext show in key Once you get any part of the message, you can decipher moreApril 9, 2013 39
Another Example Take key from ciphertext (autokey) Example: Vigenère, key drawn from ciphertext key XQXBCQOVVNGNRTT plaintext THEBOYHASTHEBAG ciphertext QXBCQOVVNGNRTTM Problem: Attacker gets key along with ciphertext, so deciphering is trivialApril 9, 2013 40
Block Cipher Block Cipher – treat a block of plaintext as a whole Feistel Cipher DES/3DES/AES Stream coding – encrypt one bit or byte at a time April 9, 2013 41
Block Ciphers Encipher, decipher multiple bits at once Each block enciphered independently Problem: identical plaintext blocks produce identical ciphertext blocks Example: two database records MEMBER: HOLLY INCOME $100,000 MEMBER: HEIDI INCOME $100,000 Encipherment: ABCQZRME GHQMRSIB CTXUVYSS RMGRPFQN ABCQZRME ORMPABRZ CTXUVYSS RMGRPFQNApril 9, 2013 42
Solutions Insert information about block’s position into the plaintext block, then encipher Cipher block chaining: Exclusive-or current plaintext block with previous ciphertext block: c0 = Ek(m0 ⊕ I) ci = Ek(mi ⊕ ci–1) for i > 0 where I is the initialization vectorApril 9, 2013 43
Algorithm Modes ElectronicCode Book Work On Block Cipher Cipher Block Chaining Cipher FeedBack Work On Block Ciphers acting as Output FeedBack Stream CipherApril 9, 2013 44
ECB (Electronic CodeBook) Mode Encryption: for 1≤j≤t, cj <= EK(xj). Decryption: for 1≤j≤t, xj <= DK(cj). Identical plaintext (under the same key) result in identical ciphertext blocks are enciphered independently of other blocks bit errors in a single ciphertext affect decipherment of that block onlyApril 9, 2013 45
ECB Mode (Cont’d) xj n key E E-1 key n x’j = xj cj encipherment deciphermentApril 9, 2013 46
CBC (Cipher-Block Chaining) Mode C0=IV Cj C j-1 n key xj ⊕ E-1 ⊕ C j-1 key E Cj<Encipherment> n X’j = xj <Decipherment> April 9, 2013 47
CBC Mode (Cont’d) Encryption: c0 ← IV, cj ← EK(cj−1⊕ xj) Decryption: c0 ← IV, xj ← cj−1 ⊕ E−1K(cj) chaining causes ciphertext cj to depend on all preceding plaintext a single bit error in cj affects decipherment of blocks cj and cj+1 self-synchronizing: error cj (not cj+1, cj+2) is correctly decrypted to xj+2.April 9, 2013 48
CFB-r(Cipher FeedBack) Mode r-bit Shift r-bit Shift I1=IV key E key E leftmost r bits Oj leftmost r bits Oj xj ci ci xj Encipherment DeciphermentApril 9, 2013 49
OFB(Output FeedBack) Modewith full(or r-bit) feedback Ij r-bit Shift Ij r-bit Shift I1=IV key E key E Leftmost r-bits Oj Leftmost r-bits Oj xj cj cj xj Encipherment DecipheringApril 9, 2013 50
Data Encryption Standard The Data Encryption Standard (DES) specifies a FIPS approved cryptographic algorithm as required by FIPS 140-1.(Federal Information Processing Standards 140-1)April 9, 2013 51
The permuted input block is then the input to a complex key-dependent computation. The output of that computation (preoutput) is then subjected to the next permutation which is the inverse of the initial permutation.April 9, 2013 55
Let K be a block of 48 bits chosen from the 64-bit (how? explained next). Then the output LR of an iteration with input LR is defined by: L = R R = L (+) f (R,K) LR is the output of the 16th iteration then RL is the preoutput block.April 9, 2013 57
The permutation function P yields a 32- bit output from a 32-bit input by permuting the bits of the input block P 16 7 20 21 29 12 28 17 1 15 23 26 5 18 31 10 2 8 24 14 32 27 3 9 19 13 30 6 22 11 4 25April 9, 2013 74
Primitive functions for the data encryption algorithm The choice of the primitive functions KS, S1, ..., S8 and P is critical to the strength of an encipherment resulting from the algorithm The recommended set of functions are described as S1, ..., S8 and P in the algorithm.April 9, 2013 75
Deciphering The permutation IP-1 applied to the preoutput block is the inverse of the initial permutation IP applied to the input. R = L L = R (+) f (L, K)April 9, 2013 76
Other Stream Ciphers RC4 Variable key size stream cipher Proprietary for 7 years (1987 - 1994) In 1994 source code was posted to mailing list Works in OFB Encryption is 10 times faster than DES SEAL (Software-optimized Encryption ALgorithm) length-increasing pseudorandom function which maps a 32-bit sequence number n to an L-bit keystream under control of a 160-bit secret key a In the preprocessing stage, the key is stretched into larger tables using the table-generation function Ga (based on SHA-1) Subsequent to this preprocessing, keystream generation requires about 5 machine instructions per byte order of magnitude faster than DESApril 9, 2013 77
Other Block Ciphers FEAL Fast N-round block cipher Suffers a lot of attacks, and hence introduce new attacks on block ciphers Japan standard IDEA 64-64-128-8 James Massey Using algebraic functions (mult mod 2n+1, add mod 2n) SAFER, RC-5, AESApril 9, 2013 78
Thank You reachable at firstname.lastname@example.orgApril 9, 2013 79