Security Engineering. Ross Anderson

Чтение книги онлайн.

Читать онлайн книгу Security Engineering - Ross Anderson страница 84

Security Engineering - Ross  Anderson

Скачать книгу

I don't know of any real applications where an attacker might get hold of even 2 Superscript 40 known texts. So the known shortcut attacks are not an issue. However, its vulnerability to keysearch makes single DES unusable in most applications. As with AES, there are also attacks based on timing analysis and power analysis.

      The usual way of dealing with the DES key length problem is to use the algorithm multiple times with different keys. Banking networks have largely moved to triple-DES, a standard since 1999 [1399]. Triple-DES does an encryption, then a decryption, and then a further encryption, all with independent keys. Formally:

3 upper D upper E upper S left-parenthesis k 0 comma k 1 comma k 2 semicolon upper M right-parenthesis equals upper D upper E upper S left-parenthesis k 2 semicolon upper D upper E upper S Superscript negative 1 Baseline left-parenthesis k 1 semicolon upper D upper E upper S left-parenthesis k 0 semicolon upper M right-parenthesis right-parenthesis right-parenthesis

      By setting the three keys equal, you get the same result as a single DES encryption, thus giving a backwards compatibility mode with legacy equipment. (Some banking systems use two-key triple-DES which sets k 2 equals k 0; this gives an intermediate step between single and triple DES.) Most new systems use AES as the default choice, but many banking systems are committed to using block ciphers with an eight-byte block, because of the message formats used in the many protocols by which ATMs, point-of-sale terminals and bank networks talk to each other, and because of the use of block ciphers to generate and protect customer PINs (which I discuss in the chapter on Banking and Bookkeeping). Triple DES is a perfectly serviceable block cipher for such purposes for the foreseeable future.

      Another way of preventing keysearch (and making power analysis harder) is whitening. In addition to the 56-bit key, say k 0, we choose two 64-bit whitening keys k 1 and k 2, xor'ing the first with the plaintext before encryption and the second with the output of the encryption to get the ciphertext afterwards. This composite cipher is known as DESX. Formally,

upper D upper E upper S upper X left-parenthesis k 0 comma k 1 comma k 2 semicolon upper M right-parenthesis equals upper D upper E upper S left-parenthesis k 0 semicolon upper M circled-plus k 1 right-parenthesis circled-plus k 2

      It can be shown that, on reasonable assumptions, DESX has the properties you'd expect; it inherits the differential strength of DES but its resistance to keysearch is increased by the amount of the whitening [1049]. Whitened block ciphers are used in some applications, most specifically in the XTS mode of operation which I discuss below. Nowadays, it's usually used with AES, and AESX is defined similarly, with the whitening keys used to make each block encryption operation unique – as we shall see below in section 5.5.7.

      A common failure is that cryptographic libraries enable or even encourage developers to use an inappropriate mode of operation. This specifies how a block cipher with a fixed block size (8 bytes for DES, 16 for AES) can be extended to process messages of arbitrary length.

      5.5.1 How not to use a block cipher

      In one popular corporate email system from the last century, the encryption used was DES ECB with the key derived from an eight-character password. If you looked at a ciphertext generated by this system, you saw that a certain block was far more common than the others – the one corresponding to a plaintext of nulls. This gave one of the simplest attacks ever on a fielded DES encryption system: just encrypt a null block with each password in a dictionary and sort the answers. You can now break at sight any ciphertext whose password was one of those in your dictionary.

      In addition, using ECB mode to encrypt messages of more than one block length which require authenticity – such as bank payment messages – is particularly foolish, as it opens you to a cut and splice attack along the block boundaries. For example, if a bank message said “Please pay account number upper X the sum upper Y, and their reference number is upper Z” then an attacker might initiate a payment designed so that some of the digits of upper X are replaced with some of the digits of upper Z.

Schematic illustration of the Linux penguin, in clear and ECB encrypted.

      5.5.2 Cipher block chaining

      This mode disguises patterns in the plaintext: the encryption of each block depends on all the previous blocks. The input initialisation vector (IV) ensures that stereotyped plaintext message headers won't leak information by encrypting to identical ciphertexts, just as with a stream cipher.

Скачать книгу