CHAPTER 12: From Crypto-Theory to Crypto-Practice I I.SHIFT REGISTERS The first practical approach to ONE-TIME PAD cryptosystem. CRYPTOANALYSIS of linear feedback shift registers Sequences generated by linear shift registers have excellent statistical properties, but they are not resistant to a known plaintext attack. Linear Recurrences Linear feedback shift registers are an efficient way to realize recurrence relations of the type x[n+m ]= c[0 ]x[n ]+ c[1 ]x[n+1]+ … + c[m-1 ]x[n+m-1 ](mod n) that can be specified by 2m bits c[0 ], … , c[m-1 ] and x[1 ], … , x[m]. Finding Linear Recurrences – a method To test whether a given portion of a key was generated by a recurrence of a length m, if we know x[1 ], … , x[2m ], we need to solve the matrix equation and then to verify whether the remaining available bits, x[2m+1 ], … ,are really generated by the recurrence obtained. [ ] Finding Linear Recurrences The basic idea to find linear recurrences generating a given sequence is to check whether there is such a recurrence for m = 2, 3, … In doing that we use the following result. Theorem Let If the sequence x[1 ], x[2] , … , x[2m-1 ]satisfies a linear recurrence of length less than m, then det(M) = 0. Conversely, if the sequence x[1 ], x[2] , … , x[2m-1 ]satisfies a linear recurrence of length m and det(M) = 0, then the sequence also satisfies a linear recurrence of length less than m. II. How to make cryptoanalysts' task harder? Two general methods are called diffusion and confusion. Diffusion: dissipate the source language redundancy found in the plaintext by spreading it out over the cryptotext. Example 1: A permutation of the plaintext rules out possibility to use frequency tables for digrams, trigrams. Example 2: Make each letter of cryptotext to depend on so many letters of the plaintext as possible Confusion and difusion – a more detailed view Two fundamental cryptographic techniques, introduced already by Shannon, are confusion and diffusion. Confusion obscures the relationship between the plaintext and the ciphertext, which makes much more difficult cryptanalyst’s attempts to study cryptotext by looking for redundancies and statistical patterns. (The best way to cause confusion is through complicated substitutions.) Diffusion dissipates redundancy of the plaintext by spreading it over cryptotext - that again makes much more difficult a cryptanalyst’s attempts to search for redundancy in the plaintext through observation of cryptotext. (The best way to achieve it is through transformations that cause that bits from different positions in plaintext contribute to the same bit of cryptotext.) Mono-alphabetic cryptosystems use no confusion and no diffusion. Polyalphabetic cryptosystems use only confusion. In permutation cryptosystems only diffusion step is used. DES essentially uses a sequence of confusion and diffusion steps. III. Cryptosystem DES - its history 15. 5. 1973 National Burea of Standards published a solicitation for a new cryptosystem. This led to the development of so far the most often used cryptosystem Data Encryption Standard - DES DES was developed at IBM, as a modification of an earlier cryptosystem called Lucifer. 17. 3. 1975 DES was published for first time. After a heated public discussion, DES was adopted as a standard on 15. 1. 1977. DES used to be reviewed by NBS every 5 years. DES - description DES was a revolutionary step in the secret-key cryptography history: Both encryption and decryption algorithms were made public!!!!!! Preprocessing: A secret 56-bit key k[56] is chosen. A fixed+public permutation f[56] is applied to get f[56 ](k[56]). The first (second) part of the resulting string is taken to get a 28-bit block C[0] (D[0]). Using a fixed+public sequence s[1],…,s[16] of integers, 16 pairs of 28-bit blocks (C[i], D[i]), i = 1,…,16 are obtained as follows: C[i] (D[i]) is obtained from C[i -1] (D[i -1]) by s[i] left shifts. Using a fixed and public order, a 48-bit block K[i] is created from each pair C[i] and D[i]. DES cryptosystem - Data Encryption Standard - 1977 Decryption f[64](c) = L[16]R[16] is computed and then the recurrence R[i –1 ]= L[i] L[i –1 ]= R[i ]Å[ ]f (L[i],[,]K[i ]), is used to get L[i],[ ]R[i] i = 15,…,1,0, w = Φ^-1[64](L[0],R[0]). How fast is DES? 200 megabits can be encrypted per second using a special hardware. The DES controversy 1. There have been suspicions that the design of DES might contain hidden “trapdoors'‘ what allows NSA to decrypt messages. 2. The main criticism has been that the size of the keyspace, 2 ^56 , is too small for DES to be really secure. 3. In 1977 Diffie+Hellamn sugested that for 20 milions$ one could build a VLSI chip that could search the entire key space within 1 day. 4. In 1993 M. Wiener suggested a machine of the cost 100.000$ that could find the key in 1.5 days. What are the key elements of DES? • A cryptosystem is called linear if each bit of cryptotext is a linear combination of bits of plaintext. • For linear cryptosystems there is a powerful decryption method - so-called linear cryptanalysis. • The only components of DES that are non-linear are S-boxes. • Some of original requirements for S-boxes: – Each row of an S-box should include all possible output bit combinations; – It two inputs to an S-box differ in precisely one bit, then the output must differ in a minimum of two bits; – If two inputs to an S-box differ in their first two bits, but have identical last two bits, the two outputs have to be distinct. • There have been many other very technical requirements. Weaknesses of DES • Existence of weak keys: they are such keys k that for any plaintext p, E[k](E[k](p)) = p. There are four such keys: k Î {(0^28, 0^28), (1^28, 1^28), (0^28, 1^28), (1^28, 0^28)} • The existence of semi-weak key pairs (k[1], k[2]) such that for any plaintext E[k1](E[k2](p)) = p. • The existence of complementation property E[c][(k)](c(p)) = c(E[k](p)), where c(x) is binary complement of binary string x. DES modes of operation ECB mode: to encode a sequence x[1], x[2], x[3], … of 64-bit plaintext blocks, each x[i] is encrypted with the same key. 8-bit VERSION of the CFB MODE In this mode each 8-bit piece of the plaintext is encrypted without having to wait for an entire block to be available. The plaintext is broken into 8-bit pieces: P=[P[1],P[2],…]. Encryption: An initial 64-bit block X[1] is chosen and then, for j=1,2,… , the following computation is done: Advantages of different encryption modes • CBC mode is used for block-encryption and also for authentication; • CFB mode is used for streams-encryption; • OFB mode is used for stream-encryptions that require message authentication; CTR MODE Counter Mode - some consider it as the best one. Key design: k[i] = E[k](n, i) for a nonce n; Encryption: y[i] = x[i] Å k[i] This mode is very fast because a key stream can be parallelised to any degree. Because of that this mode is used in network security applications. Killers and death of DES • In 1993 M. J. Weiner suggested that one could design, using one million dollars, a computer capable to decrypt, using brute force, DES in 3.5 hours. • In 1998 group of P. Kocher designed, using a quarter million of dolars, a computer to decrypt DES in 56 hours. • In 1999 they did that in 24 hours. • It started to be clear that a new cryptosystem with larger keys is badly needed. Product- and Feistel-cryptosystems Design of several important practical cryptosystems used the following three general design principles for cryptosystems. A product cryptosystem combines two or more crypto-transformations in such a way that resulting cryptosystem is more secure than component transformations. An iterated block cryptosystem iteratively uses a round function (and it has as parameters number of rounds r, block bit-size n, subkeys bit-size k) of the input key K from which r subkeys K[i] are derived. A Feistel cryptosystem is an iterated cryptosystem mapping 2t-bit plaintext (L[0],R[0]). of t-bit blocks L[0] and R[0] to a 2t-bit cryptotext (R[r],L[r]), through an r-round process, where r >0. For 0