Cipher TechniquesApril 9, 2013                             1
Road Map Basic  Terminology Cryptosystem Classical Cryptography Algorithm Types and Modes Data Encryption Standard O...
Basic Terminology     plaintext - the original message     ciphertext - the coded message     cipher - algorithm for tr...
Cryptosystem     A cryptosystem is a five-tuple (P,C,K,E,D),        where the following are satisfied:    1.   P is a fini...
Cryptography Cryptography           Symmetric / private key / single key           Asymmetric / public-key / two - keyA...
Symmetric CryptographyApril 9, 2013                         6
Asymmetric CryptographyApril 9, 2013                          7
Requirements Two    requirements for secure use of      symmetric encryption:           a strong encryption algorithm   ...
Symmetric cryptography Transposition  Techniques Substitution techniques           Caesar Cipher           Monoalphabe...
Types of Cryptanalytic Attacks adversary needs strongest attack        ciphertext only                           only kn...
Brute Force Search always possible to simply try every key most basic attack, proportional to size of key  space assume...
Transposition Ciphers Consider   classical transposition or  permutation ciphers these hide the message by rearranging t...
Rail Fence cipher writemessage letters out diagonally over a  number of rows then read off cipher row by row eg. write ...
Row Transposition Ciphersa  more complex scheme write letters of message out in rows over a  specified number of columns...
Classical Substitution Ciphers where   letters of plaintext are replaced by  other letters or by numbers or symbols or i...
Caesar Cipher earliest  known substitution cipher by Julius Caesar first attested use in military affairs replaces eac...
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...
Monoalphabetic Cipher     rather than just shifting the alphabet     could shuffle (jumble) the letters arbitrarily    ...
Playfair Cipher not even the large number of keys in a  monoalphabetic cipher provides security one approach to improvin...
Playfair Key Matrix     a 5X5 matrix of letters based on a keyword           (I and J aren’t distinguished)     fill in...
Encrypting and Decrypting          plaintext encrypted two letters at a time:      1.        each letter is replaced by t...
Polyalphabetic Ciphers     another approach to improving security is to use      multiple cipher alphabets     called po...
Vigenère Cipher simplest    polyalphabetic substitution cipher is  the Vigenère Cipher effectively multiple caesar ciphe...
Example write the plaintext out write the keyword repeated above it use each key letter as a caesar cipher key encrypt...
Autokey Cipher    ideally want a key as long as the message    Vigenère proposed the autokey cipher    with keyword is ...
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 u...
Product Ciphers     ciphers using substitutions or transpositions are not      secure because of language characteristics...
Rotor Machines     before modern ciphers, rotor machines were most      common product cipher     were widely used in WW...
Steganography an alternative to encryption hides existence of message           using only a subset of letters/words in...
Algorithm Types and Modes An  Algorithm type defines what size of plain  text should be encrypted in each step of  algori...
Algorithm Types Stream Ciphers Block CiphersAlgorithm Modes ElectronicCode Book         Work On Block Cipher Cipher Bl...
Stream, Block Ciphers     E encipherment function           Ek(b) encipherment of message b with key k           In wha...
Stream Ciphers Often      (try to) implement one-time pad by      xor’ing each bit of key with one bit of      message   ...
Synchronous Stream Ciphers n-stage     Linear Feedback Shift Register:      consists of           n bit register r = r0…...
Operation                                                                  …                r0          …               rn...
Example        4-stage LFSR; t = 1001      r        ki     new bit computation        new r      0010     0      01⊕00⊕10...
NLFSR n-stage     Non-Linear Feedback Shift Register:      consists of           n bit register r = r0…rn–1           U...
Example   4-stage NLFSR; f(r0, r1, r2, r3) = (r0 & r2) | r3    r                ki   new bit computation           new r ...
Self-Synchronous StreamCipher Takekey from message itself (autokey) Example: Vigenère, key drawn from plaintext        ...
Another Example Take key from ciphertext (autokey) Example: Vigenère, key drawn from  ciphertext           key         ...
Block Cipher Block Cipher – treat a  block of plaintext as a whole       Feistel Cipher       DES/3DES/AES Stream   co...
Block Ciphers Encipher,  decipher multiple bits at once Each block enciphered independently Problem: identical plaintex...
Solutions Insert information about block’s position into  the plaintext block, then encipher Cipher block chaining:     ...
Algorithm Modes ElectronicCode Book            Work On Block Cipher Cipher Block Chaining Cipher FeedBack              ...
ECB (Electronic CodeBook) Mode   Encryption: for 1≤j≤t, cj <= EK(xj).   Decryption: for 1≤j≤t, xj <= DK(cj).           ...
ECB Mode (Cont’d)                      xj                           n          key        E                E-1          ke...
CBC (Cipher-Block Chaining)   Mode                   C0=IV                Cj                           C j-1              ...
CBC Mode (Cont’d)   Encryption: c0 ← IV, cj ← EK(cj−1⊕ xj)   Decryption: c0 ← IV, xj ← cj−1 ⊕ E−1K(cj)               ch...
CFB-r(Cipher FeedBack) Mode                            r-bit Shift                          r-bit Shift                I1=...
OFB(Output FeedBack) Modewith full(or r-bit) feedback                   Ij     r-bit Shift              Ij        r-bit Sh...
Data Encryption                   Standard       The Data Encryption Standard (DES)       specifies a FIPS approved       ...
April 9, 2013                52
Enciphering The      64 bits of the input block to be      enciphered are first subjected to the following      initial p...
 IP                      58 50 42 34 26 18   10   2                60   52 44 36 28 20 12    4                62   54 46 ...
 The  permuted input block is then the input      to a complex key-dependent computation.     The output of that computa...
 IP-1      40 8 48 16 56 24 64 32                39 7 47 15 55 23 63 31                38 6 46 14 54 22 62 30            ...
 Let     K be a block of 48 bits chosen from the          64-bit (how? explained next). Then the          output LR of an...
One round of DESApril 9, 2013                   58
April 9, 2013                59
 PC-1     (Key Permutation)            57 49 41 33 25           17    9             1 58 50 42 34           26   18      ...
 Iteration     corresponds to left shifts:                1   2   3   4   5   6   7   8                1   1   2   2   2 ...
 PC-2           (Compression Permutation)                14    17   11   24    1    5                3     28   15    6  ...
One round of DESApril 9, 2013                   63
 The      Cipher Function f : A sketch of          the calculation of f (R, K) is given byApril 9, 2013                  ...
Expansion Permutation                   1 2 3 4    5 6 7 8     9 10 11 12                1 2 3 4 5 6 7 8 9 10 111213 14 15...
E          bit-selection table                32   1   2   3   4    5                 4   5   6   7   8    9             ...
One round of DESApril 9, 2013                   67
S                1    14          4 13    1   2 15 11     8   3 10    6 12    5   9   0   7      O 15          7   4 14  ...
S                3    10          0   9 14    6   3 15    5   1 13 12     7 11   4   2   8    13          7   O   9   3  ...
S                5       2 12         4   1   7 10 11     6   8   5   3 15 13     O 14    9    14 11           2 12    4 ...
S                7       4 11         2 14 15     0   8 13    3 12    9   7   5 10    6   1    13          0 11    7   4 ...
          S1                0   1   2   3   4   5   6   7   8   9 10 11 12 13 14 150         14        4 13    1   2 15 1...
One round of DESApril 9, 2013                   73
 The permutation function P yields a 32-     bit output from a 32-bit input by     permuting the bits of the input block ...
Primitive functions for the data  encryption algorithm          The choice of the primitive functions KS,           S1, ....
Deciphering The       permutation IP-1 applied to the      preoutput block is the inverse of the      initial permutation...
Other Stream Ciphers     RC4           Variable key size stream cipher           Proprietary for 7 years (1987 - 1994) ...
Other Block Ciphers     FEAL           Fast N-round block cipher           Suffers a lot of attacks, and hence introduc...
Thank You                       reachable at                naasir_k@donboscoit.ac.inApril 9, 2013                        ...
Upcoming SlideShare
Loading in...5
×

Cipher techniques

12,034
-1

Published on

Published in: Technology, Education
0 Comments
8 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
12,034
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
501
Comments
0
Likes
8
Embeds 0
No embeds

No notes for slide
  • 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 -&gt; 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: &quot;meet me after the toga party&quot; 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 &quot;spikyness&quot; 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&apos;s book &quot;Have His Carcase&quot;, 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 &quot;spikyness&quot; 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 &quot;DECEPTIVE&quot; prefixed to as much of the message &quot;WEAREDISCOVEREDSAV&quot; as is needed. When deciphering, recover the first 9 letters using the keyword &quot;DECEPTIVE&quot;. Then instead of repeating the keyword, start using the recovered letters from the message &quot;WEAREDISC&quot;. 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 &apos;E&apos; will be used more often than a &apos;T&apos; etc hence an &apos;E&apos; encrypted with a key of &apos;E&apos; occurs with probability (0.1275)^2 = 0.01663, about twice as often as a &apos;T&apos; encrypted with a key of &apos;T&apos; 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) [2]. 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 techniques

    1. 1. Cipher TechniquesApril 9, 2013 1
    2. 2. Road Map Basic Terminology Cryptosystem Classical Cryptography Algorithm Types and Modes Data Encryption Standard Other Stream & Block CiphersApril 9, 2013 2
    3. 3. 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
    4. 4. 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
    5. 5. Cryptography Cryptography  Symmetric / private key / single key  Asymmetric / public-key / two - keyApril 9, 2013 5
    6. 6. Symmetric CryptographyApril 9, 2013 6
    7. 7. Asymmetric CryptographyApril 9, 2013 7
    8. 8. 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
    9. 9. Symmetric cryptography Transposition Techniques Substitution techniques  Caesar Cipher  Monoalphabetic Cipher  Polyalphabethic Cipher  Playfair CipherApril 9, 2013 9
    10. 10. 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
    11. 11. 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
    12. 12. 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
    13. 13. 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
    14. 14. Row Transposition Ciphersa 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
    15. 15. 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
    16. 16. 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
    17. 17. 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
    18. 18. 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
    19. 19. 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
    20. 20. 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
    21. 21. 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
    22. 22. 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
    23. 23. 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
    24. 24. 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
    25. 25. 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
    26. 26. 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
    27. 27. 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
    28. 28. 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
    29. 29. 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
    30. 30. 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
    31. 31. 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
    32. 32. 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
    33. 33. 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
    34. 34. 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
    35. 35. Operation … r0 … rn–1 ⊕ bi … ci r0´ … rn–1´ ri´ = ri–1, 0<i≤n r0t0 + … + rn–1tn–1April 9, 2013 35
    36. 36. 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
    37. 37. 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
    38. 38. Example 4-stage NLFSR; f(r0, r1, r2, r3) = (r0 & r2) | r3 r ki new bit computation new r 1100 0 (1 & 0) | 0 = 0 0110 0110 0 (0 & 1) | 0 = 0 0011 0011 1 (0 & 1) | 1 = 1 1001 1001 1 (1 & 0) | 1 = 1 1100 1100 0 (1 & 0) | 0 = 0 0110 0110April 9, 2013 0 (0 & 1) | 0 = 0 38 0011
    39. 39. 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
    40. 40. 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
    41. 41. 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
    42. 42. 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
    43. 43. 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
    44. 44. 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
    45. 45. 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
    46. 46. ECB Mode (Cont’d) xj n key E E-1 key n x’j = xj cj encipherment deciphermentApril 9, 2013 46
    47. 47. 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
    48. 48. 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
    49. 49. 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
    50. 50. 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
    51. 51. 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
    52. 52. April 9, 2013 52
    53. 53. Enciphering The 64 bits of the input block to be enciphered are first subjected to the following initial permutation IP:April 9, 2013 53
    54. 54.  IP 58 50 42 34 26 18 10 2 60 52 44 36 28 20 12 4 62 54 46 38 30 22 14 6 64 56 48 40 32 24 16 8 57 49 41 33 25 17 9 1 59 51 43 35 27 19 11 3 61 53 45 37 29 21 13 5 63 55 47 39 31 23 15 7April 9, 2013 54
    55. 55.  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
    56. 56.  IP-1 40 8 48 16 56 24 64 32 39 7 47 15 55 23 63 31 38 6 46 14 54 22 62 30 37 5 45 13 53 21 61 29 36 4 44 12 52 20 60 28 35 3 43 11 51 19 59 27 34 2 42 10 50 18 58 26 33 1 41 9 49 17 57 25April 9, 2013 56
    57. 57.  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
    58. 58. One round of DESApril 9, 2013 58
    59. 59. April 9, 2013 59
    60. 60.  PC-1 (Key Permutation) 57 49 41 33 25 17 9 1 58 50 42 34 26 18 10 2 59 51 43 35 27 19 11 3 60 52 44 36 63 55 47 39 31 23 15 7 62 54 46 38 30 22 14 6 61 53 45 37 29 21 13 5 28 20 12 4April 9, 2013 60
    61. 61.  Iteration corresponds to left shifts: 1 2 3 4 5 6 7 8 1 1 2 2 2 2 2 2 9 10 11 12 13 14 15 16 1 2 2 2 2 2 2 1April 9, 2013 61
    62. 62.  PC-2 (Compression Permutation) 14 17 11 24 1 5 3 28 15 6 21 10 23 19 12 4 26 8 16 7 27 20 13 2 41 52 31 37 47 55 30 40 51 45 33 48 44 49 39 56 34 53 46 42 50 36 29 32April 9, 2013 62
    63. 63. One round of DESApril 9, 2013 63
    64. 64.  The Cipher Function f : A sketch of the calculation of f (R, K) is given byApril 9, 2013 64
    65. 65. Expansion Permutation 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 111213 14 15 16April 9, 2013 65
    66. 66. E bit-selection table 32 1 2 3 4 5 4 5 6 7 8 9 8 9 10 11 12 13 12 13 14 15 16 17 16 17 18 19 20 21 20 21 22 23 24 25 24 25 26 27 28 29 28 29 30 31 32 1April 9, 2013 66
    67. 67. One round of DESApril 9, 2013 67
    68. 68. S 1 14 4 13 1 2 15 11 8 3 10 6 12 5 9 0 7 O 15 7 4 14 2 13 1 10 6 12 11 9 5 3 8 4 1 14 8 13 6 2 11 15 12 9 7 3 10 5 0 15 12 8 2 4 9 1 7 5 11 3 14 10 O 6 13 S 2 15 1 8 14 6 11 3 4 9 7 2 13 12 O 5 10 3 13 4 7 15 2 8 14 12 0 1 10 6 9 11 5 0 14 7 11 10 4 13 1 5 8 12 6 9 3 2 15 13 8 10 1 3 15 4 2 11 6 7 12 0 5 14 9April 9, 2013 68
    69. 69. S 3 10 0 9 14 6 3 15 5 1 13 12 7 11 4 2 8 13 7 O 9 3 4 6 10 2 8 5 14 12 11 15 1 13 6 4 9 8 15 3 0 11 1 2 12 5 10 14 7 1 10 13 0 6 9 8 7 4 15 14 3 11 5 2 12 S 4 7 13 14 3 0 6 9 10 1 2 8 5 11 12 4 15 13 8 11 5 6 15 O 3 4 7 2 12 1 10 14 9 10 6 9 0 12 11 7 13 15 1 3 14 5 2 8 4 3 15 O 6 10 1 13 8 9 4 5 11 12 7 2 14April 9, 2013 69
    70. 70. S 5 2 12 4 1 7 10 11 6 8 5 3 15 13 O 14 9 14 11 2 12 4 7 13 1 5 0 15 10 3 9 8 6 4 2 1 11 10 13 7 8 15 9 12 5 6 3 O 14 11 8 12 7 1 14 2 13 6 15 O 9 10 4 5 3 S 6 12 1 10 15 9 2 6 8 O 13 3 4 14 7 5 11 10 15 4 2 7 12 9 5 6 1 13 14 O 11 3 8 9 14 15 5 2 8 12 3 7 0 4 10 1 13 11 6 4 3 2 12 9 5 15 10 11 14 1 7 6 0 8 13April 9, 2013 70
    71. 71. S 7 4 11 2 14 15 0 8 13 3 12 9 7 5 10 6 1 13 0 11 7 4 9 1 10 14 3 5 12 2 15 8 6 1 4 11 13 12 3 7 14 10 15 6 8 0 5 9 2 6 11 13 8 1 4 10 7 9 5 0 15 14 2 3 12 S 8 13 2 8 4 6 15 11 1 10 9 3 14 5 0 12 7 1 15 13 8 10 3 7 4 12 5 6 11 0 14 9 2 7 11 4 1 9 12 14 2 0 6 10 13 15 3 5 8 2 1 14 7 4 10 8 13 15 12 9 0 3 5 6 11April 9, 2013 71
    72. 72.  S1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 150 14 4 13 1 2 15 11 8 3 10 6 12 5 9 0 71 0 15 7 4 14 2 13 1 10 6 12 11 9 5 3 82 4 1 14 8 13 6 2 11 15 12 9 7 3 10 5 03 15 12 8 2 4 9 1 7 5 11 3 14 10 0 6 13 For example, for input 011011 the row is 01, that is row 1, and the column is determined by 1101, that is column 13. In row 1 column 13 appears 5 so that the output is 0101.April 9, 2013 72
    73. 73. One round of DESApril 9, 2013 73
    74. 74.  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
    75. 75. 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
    76. 76. 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
    77. 77. 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
    78. 78. 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
    79. 79. Thank You reachable at naasir_k@donboscoit.ac.inApril 9, 2013 79
    1. ¿Le ha llamado la atención una diapositiva en particular?

      Recortar diapositivas es una manera útil de recopilar información importante para consultarla más tarde.

    ×