[Course home page] [Lecture notes]
YALE UNIVERSITY
DEPARTMENT OF COMPUTER SCIENCE
CPSC 467a: Cryptography and Computer Security
Notes 4 (rev. 1)

Professor M. J. Fischer September 13, 2005
 
Lecture Notes 4

1  Using Symmetric Cryptosystems

Symmetric (one-key) cryptosystems fall into two broad classes, block ciphers and stream ciphers. A block cipher takes as inputs a key and a fixed-length plaintext block and produces a fixed-length ciphertext block as output. Most of the ciphers we have been discussing so far are of this type. A stream cipher on the other hand process a stream of characters in an on-line fashion, emitting the ciphertext characters as it goes. The rotor machines are examples of stream ciphers.

1.1  Stream ciphers

A stream cipher has two components, the cipher that is used to encrypt a given character, and a keystream generator that produces a different key to be used for each successive letter.
A simple stream cipher can be built from the XOR cryptosystem used in the one-time pad. However, rather than using a random key as long as the message, we instead generate the keystream on the fly using a state machine. A keystream generator consists of three parts: an internal state, a next-state generator, and an output function. The next-state generator and output functions can both depend on (original) key. At each stage, the state is updated and the output function applied to obtain the next component of the keystream. Like a one-time pad, one must use different key for each message; otherwise the system is easy to break.
To be secure, the keystream generator must be a good pseudorandom sequence generator. Any regularities in the output of the keystream generator will give an attacker information about the plaintext. In particular, if the attacker is ever able to figure out the internal state of the keystream generator, then she will be able to predict all future outputs of the generator and decipher the remainder of the ciphertext. It turns out that the linear congruential pseudorandom number generators typically found in software libraries are quite insecure. After observing a relatively short sequence of outputs from the generator, one can solve for the state and correctly predict all future outputs. For the simple XOR cipher to be secure, a cryptographically strong pseudorandom number generator must be used. Even so, the fact that a different key must be used for each message sent makes it problematic in practice. It's at least an improvement to make the next-state generator depend on the current plaintext or ciphertext characters so that the generated keystreams will diverge on different messages, even if the key is the same.

1.2  Block ciphers

A block cipher operates on an entire block of plaintext to produce a block of ciphertext. So does a stream cipher, but with a stream cipher the block size is very small (typically one bit or one byte), whereas a block cipher operates on fairly long blocks, e.g., 64-bits for DES, 128-bits for Rijndal (AES). With a stream cipher, security rests with the keystream generator, for the ciphers used to encrypt the individual characters are all subject to known-plaintext attacks. On the other hand, 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.
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 [XOR]mi = ci [XOR]ci; rather, mi [XOR]mi = ci [XOR]ci [XOR]Ek(ci−1) [XOR]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 ji.
  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 [XOR] 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.



File translated from TEX by TTH, version 3.66.
On 18 Sep 2005, 17:46.