5.3 Encryption for Data Protection
Section 5.2 introduced requirements for quality encryption products that, in particular, recommend the use of strong encryption with hard-to-guess secret keys. While this may sound like obvious advice, itÕs often harder to achieve than we might wish.
Strong encryption starts with a strong encryption algorithm, a computational procedure that either encrypts the plaintext data or converts encrypted data back to its plaintext. These algorithms use a secret key to control the encryption. A well-designed algorithm provides no way to decrypt some encrypted data without the correct key, except through a trial-and-error search. If the secret key is large enough, the search isn't practical.
The combination of these featuresthe strong algorithm and the long keyyields computationally secure encryption, that is, encryption that isn't practical to break. Good commercial encryption is based on computationally secure encryption. To understand what good encryption means, we will briefly examine the problem of bad encryption, the role of key length in cryptographic strength, and attack times on cryptographic keys.
Encryption algorithms tend to fall into two categories: stream ciphers and block ciphers. Most of the widely used modern algorithms are block algorithms: the old Data Encryption Standard (DES), the new Advanced Encryption Standard (AES), the International Data Encryption Algorithm (IDEA), Blowfish, and the CAST algorithm (created by Carlisle Adams and Stafford Tavares).
Stream ciphers were used in the electromechanical machines from the mid-20th century, including World War II. The best-known modern stream cipher is Rivest Cipher #4 (RC4), which is used in most Web browsers to protect e-commerce transactions. Although there isn't anything fundamentally weak in stream ciphers, it is difficult to use them safely. Microsoft chose RC4 to encrypt secure channels for Windows NT domains and in PPTP and encountered problems trying to use RC4 safely (see Section 11.4).
Figure 5.4 Block and stream ciphers Block ciphers, as shown on the left, encrypt data one block at a time. Stream ciphers, as shown on the right, encrypt the data one bit at a time. The stream cipher generates a key stream that encrypts the data by performing an exclusive-or between corresponding bits of the key stream and the bits of the plaintext.
Figure 5.4 illustrates the difference between block and stream ciphers. Block ciphers encrypt data in fixed-sized blocks. The cipher uses the encryption key to thoroughly scramble the plaintext block of bits to yield the ciphertext. If you change a single bit in the plaintext, it could change several bits in the ciphertext, and vice versa.
Stream ciphers encrypt a stream of data. The mechanical encryption machines would encrypt streams of letters that formed secret messages. Modern computer-based ciphers tend to encrypt streams of bits. The ciphers work in two stages. In the first stage, the algorithm takes the secret key and uses it to generate a stream of random bits. In the second stage, the algorithm encrypts the data bits by combining them one by one with the random bit stream using the exclusive-or operation. If we change a single bit in the plaintext, we will affect only that same bit in the ciphertext. This can lead to integrity weaknesses in protocols that use stream ciphers; an example appears in Section 11.4.
Shortcut Attacks on Encryption
Strong encryption algorithms are hard to construct. While serving as a deputy director of the NSA, William Crowell told Congress that the German Enigma machine from World War II could not be broken today, even with modern computers, and that the Allies' success against the Enigma relied on German mistakes as well as the Allies' smart code breakers. The Germans had the raw materials to achieve strong encryption, but they failed to put them together correctly. Their errors opened up shortcuts the Allies could use to crack their messages.
During the war, the Germans were largely convinced that the Enigma's code was uncrackable, and Crowell's testimony indicates that they weren't entirely unrealistic in their belief. The Enigma was broken through an unexpected coincidence: the Allies built machines to perform trial-and-error searches at unprecedented speeds, and the German coding procedures had weaknesses that made such trial-and-error searches practical. Those weaknesses introduced shortcuts into the decryption process, since not every possible encryption key needed to be considered. Although encryption technology has made incredible progress since World War II, weak encryption still shows up in commercial products.
The fatal flaw of much encryption software is best called hubris, an ancient Greek word for excessive pride and arrogance that leads a smart person to do something foolish. The foolish act in this case is for software developers to invent their own encryption algorithms. It is very difficult to construct a computationally secure algorithm. Homemade algorithms, even by large and profitable corporations, deserve to be treated with suspicion. Two particularly interesting examples of this emerged in the late 1990s. First, cryptographers uncovered weaknesses in encryption algorithms used for digital mobile phones. Second, people posted software to the Internet to crack the encryption used to control the viewing of videos sold on DVDs. Neither system used a well-known, proven algorithm. In both cases the algorithms had been home-grown and kept secret in an ultimately futile attempt to prevent attackers from cracking the encryption.
The simple solution to this problem is to use a strong, well-studied cryptographic algorithm. Such procedures are well known and easy to find. The first candidate is AES, the new, "advanced" encryption algorithm endorsed by the U.S. government for encrypting sensitive information in government and commercial applications. As of this writing, the AES has not been formally adopted as a Federal Information Processing Standard (FIPS), but this is considered almost certain to happen. Despite its newness, the AES provides a combination of speed and security that recommend it to almost any application. AES uses a 128-bit key, which presents attackers with a 127-bit average attack space. As of this writing, the principal shortcoming of AES is that few products have as yet incorporated it.
In practice, of course, the available software products don't always provide the exact choice we may want, but there are alternatives that provide reasonable security. The first is Triple DES, a variant of DES that uses double-length or triple-length secret keys. Although DES is relatively slow, especially when run three times for Triple DES, its security is well respected and has stood the test of time. Indeed, the only weakness anyone has attacked successfully is its relatively short 56-bit key length. Other respected algorithms include IDEA, RC4, Blowfish, and CAST.
An interesting footnote regarding DES is that it contains one well-known, though minor, shortcut. DES has a property, called complementation, which means that we can actually test two DES keys at a time when performing a trial-and-error attack. Each time we choose a key to try, we run the DES algorithm, and then we can test both the chosen key and its bit-by-bit inverse. So we actually need to run the algorithm only half as many times when performing a trial-and-error search. To compute the average attack space for DES, we subtract one bit as usual to account for searching half of the keys on average, and another bit to account for complementation. Thus, the average attack space for DES is 54 bits.
Trial-and-Error Attacks on Encryption
Aside from the successful wartime attacks against German codes, DES provides the best-known example of breaking a modern code by trial and error. Skepticism about its 56-bit key size emerged as soon as it was introduced. Shortly after DES was announced, cryptographers Whitfield Diffie and Martin Hellman outlined the design for a machine that could crack one DES-encrypted message per day. Although they did not actually build the machine, they described how such a thing could be built for $20 million using 1975 technology. While such a machine may have been impractical for most enterprises, there were certainly a few large nations, corporations, and criminal enterprises that could afford such a thing. But at the time, nobody had actually demonstrated that it was feasible to crack a DES-encrypted message.
The skeptics had time and progress on their side. In the 1960s, Gordon E. Moore looked at the emerging trends in computer circuits and noted that circuit costs, sizes, and execution times were dropping by roughly 50% every year. This general trend came to be called Moore's Law. The law's predictions aren't exact, but the general trend has continued to this day. A more recent restatement of Moore's Law said that the amount of computation available at a given price would double every 18 months. Computing became both faster and cheaper as time went on.
In Section 2.4, we looked at trial-and-error attacks on passwords; clearly Moore's Law was feeding the attack risk by the late 1970s. But it was not until the 1990s that public attacks on DES began in earnest. In 1993, Michael Wiener produced a detailed and convincing design for a $1 million DES-cracking machine that, in theory, could crack one key every 3.5 hours. In 1996, a group of cryptographers and others interested in computer security published a report summarizing the trends in brute force cracking technology, and indicated that DES was no longer safe for commercial applications. But DES cracking remained a theory until 1997, when a loose confederation of volunteers on the Internet cracked a DES message in 5 months using borrowed computing cycles. The next year, a much larger group of volunteers cracked a DES message in 39 days.
But this achievement was overshadowed in the summer of 1998, when the Electronic Frontier Foundation (EFF) unveiled their DES Cracker. The Cracker was a custom-built machine that, for $250,000, demonstrated a guess rate of 88 billion per second. In its first public demonstration it cracked a DES-encrypted message in three days. While it may be possible that an agency such as the U.S. National Security Agency (NSA) has a faster device for cracking keys, the DES Cracker has the highest guess rate of any publicly acknowledged device.
Theoretical Guess-Rate Limitations
The successful attacks on DES leave us with an unsettling question: just how many bits of entropy should a base secret have, if it must resist brute force attacks for a long time? In the mid-1990s, the NSA introduced the Skipjack encryption algorithm with 80-bit keys as a candidate to protect "sensitive but unclassified" government information. Noting public concern about 56-bit DES keys, the NSA offered Skipjack for nongovernment use as part of its unsuccessful Escrowed Encryption Standard. Skipjack was never widely adopted, however, because of public outrage regarding escrowed encryption plus a concern that 80 bits no longer gave enough of a safety margin against computational progress. Other commercial encryption algorithms like IDEA and RC4 were already widely used, and both relied on 128-bit keys. Financial institutions that still used DES relied on Triple DES constructions that used 112-bit or even 168-bit keys.
Moore's Law itself doesn't suggest an endpoint: the equation doesn't converge on some maximum value. Indeed, research in quantum computation suggests that we may someday build computers that use individual particles as logic elements. In such a world, only quantum physics itself can provide a convincing upper limit on trial-and-error attacks.
The physicist Seth Lloyd argues that computation speeds at that level are limited by the amount of energy poured into the computing system. If somehow we can build a perfectly efficient quantum computer at that level, then the machine could achieve over 1033 bit transitions per second on only one watt of power (keep in mind that a 32-bit processor operating at 1-gigahertz produces maybe 1011 transitions per second). At that rate, the 1-watt quantum computer could cover a space containing 113 bits every second.
Of course, this represents a theoretical ideal: there really aren't any machines that achieve anywhere close to that speed or efficiency, not even experimental quantum computers. But it's interesting to consider just how powerful a quantum key-searching computer could be. We can use that information to decide how many bits a secret key should be to defend against really outlandish attacks.
For example, imagine that we can redirect all of the sun's energy, and prevent it from warming the leaves of plants, Earth's oceans, Jupiter's atmosphere, or anything else within the solar system or beyond its borders. Instead, we channel that energy into the guessing process. We assume ideal conditions under which all of the energy is fed to state transitions that correspond to individual trial-and-error guesses. Using all of the sun's energy, we can sustain a rate of 2.33 x 1060 guesses per second, which covers a 201-bit search space every second. Given that it takes 25 bits to represent the number of seconds in a year, we see that an entire year of solar energy will exhaust a 226-bit search space. If we choose to be less greedy and use only the energy falling on Earth itself, then we can crack a 175-bit search space every second.
This suggests to some people that a base secret with a couple hundred bits should resist trial-and-error attacks for the foreseeable future. However, the physics of computation is a relatively new field and continues to evolve in both theory and practice. Some theoreticians find this estimate plausible, but it needs to stand the test of time.