YALE UNIVERSITY
DEPARTMENT OF COMPUTER SCIENCE

 CPSC 467a: Cryptography and Computer SecurityNotes 6 (rev. 1)
Professor M. J. Fischer   September 24, 2008



 

Lecture Notes 6

28 Double DES

Even if the original system is not a group (and DES is not), double encryption still does not result in a cryptosystem with twice the effective key length. The reason is another “birthday”-style known-plaintext attack.

Let’s consider the case of double DES. As before, we start with a known plaintext-ciphertext pair (m,c). We carry out a birthday attack by encrypting m under many different keys, decrypting c under many different keys, and hope we find a matching element in the resulting two sets. Unlike the attack described in section 26, we encrypt m and decrypt c using all possible DES keys. Thus, we are guaranteed of finding at least one match, since if (k1,k2) is the real key pair used in the double encryption, then Ek1(m) = Dk2(c). If there is only one match, then we have found the correct key pair and broken the system. If there are several matches, we know that the key pair is one of the matching pairs. This set is likely to be much much smaller than 256, so they can each be tried on additional plaintext-ciphertext pairs to find which ones work. (Note that there might be more than one key pair that results in the same encryption function. In that case, we won’t be able to know which key pair Alice actually used in generating the ciphertexts, but we will be able to find a pair that is just as good and that lets us decrypt her messages.)

29 Triple DES

Three key triple DES (3TDES) avoids the birthday attack by using three DES encryptions, i.e., Ek3(Ek2(Ek1(m))), giving it an actual key length of 168 bits. While considerably more secure than single DES, for which a brute force attack requires only 256 decryptions, 3TDES can be broken (in principle) by a known plaintext attack using about 290 single DES encryptions and 2113 steps. While this attack is still not practical, the effective security thus lies in the range between 90 and 113, which is much smaller than the apparent 168 bits.1

A variant of triple DES in which the middle step is a decryption instead of an encryption is known as TDES-EDE, i.e., Ek3(Dk2(Ek1(m))). The variant does not affect the security, but it means that TDES-EDE encryption and decryption functions can be used to perform single DES encryptions and decryptions by taking k1 = k2 = k3 = k, where k is the single DES key.

Another variant, two key triple DES (2TDES) uses only two keys k1 and k2, taking k3 = k1. However, known plaintext attacks or chosen plaintext attacks reduce the effective security to only 80 bits. See Wikipedia for further information on triple DES.

30 Block Ciphers

A b-bit block cipher takes as inputs a key and a b-bit plaintext block and produces a b-bit ciphertext block as output. Most of the ciphers we have been discussing so far are of this type. Block ciphers typically operate on fairly long blocks, e.g., 64-bits for DES, 128-bits for Rijndael (AES). Block ciphers can be designed to resist known-plaintext attacks and can therefore be pretty secure, even if the same key is used to encrypt a succession of blocks, as is often the case.

Of course, the length messages one wants to send are rarely exactly the block length. To use a block cipher to encrypt long messages, one first divides the message into blocks of the right length, padding the last partial block according to a suitable padding rule. Then the block cipher is used in some chaining mode to encrypt the sequence of resulting blocks. A chaining mode tells how to encrypt a sequence of plaintext blocks m1,m2,,mt to produce a corresponding sequence of ciphertext blocks c1,c2,,ct, and conversely, how to recover the mi’s given the ci’s.

Padding involves more than just sticking 0’s on the end of a message until its length is a multiple of the block length. The reason is that one must be able to recover the original message from the padded version. If one tacks on a variable number of 0’s during padding, how many are to be removed at the end? To solve this problem, a padding rule must include the information about how much padding was added. There are many ways to do this. One way is to pad each message with a string of 0’s followed by a fixed-length binary representation of the number of 0’s added. For example, if the block length is 64, then at most 63 0’s ever need to be added, so a 6-bit length field is sufficient. A message m is then padded to become m= m 0k k, where k is a number in the range [0,63] and k is its representation as a 6-bit binary number. k is then chosen so that |m′| = |m| + k + 6 is a multiple of b.

Some standard chaining modes are:

Remarks

  1. Both CFB and OFB are closely related to stream ciphers since in both cases, ci is mi XORed with some function of stuff that came before stage i. Like a one-time pad and other simple XOR stream ciphers, OFB becomes insecure if the same key is ever reused, for the sequence of ki’s generated will be the same. CFB, however, avoids this problem, for even if the same key k is used for two different message sequences mi and mi, it will not generally be the case that mi mi = ci ci; rather, mi mi = ci ci Ek(ci-1) Ek(ci-1), and the dependency on k does not drop out.
  2. The different modes differ in their sensitivity to data corruption. With ECB and OFB, if Bob receives a bad block ci, then he cannot recover the corresponding mi, but all good ciphertext blocks can be decrypted. With CBC and CFB, he needs both good ci and ci-1 blocks in order to decrypt mi. Therefore, a bad block ci renders both mi and mi+1 unreadable. With PCBC, a bad block ci renders mj unreadable for all j i.
  3. Other modes can be easily invented. We see that in all cases, ci is computed by some expression (which may depend on i) built from Ek() and applied to blocks c1,,ci-1, m1,,mi, and the initialization vectors. Any such equation that can be “solved” for mi (by possibly using Dk() to invert Ek()) is a suitable chaining mode in the sense that Alice is able to produce the ciphertext and Bob is able to decrypt it. Of course, the resulting security properties depend heavily on the particular expression chosen.