*Scribed by Anindya De*

**Summary**

Last time we defined pseudorandom generators and proved that, if they exist, they provide message-indistinguishable (and hence semantically secure) one-time encryption.

How do we construct a pseudorandom generator? We can’t if , so the security of any construction will have to rely on an unproved assumption which is at least as strong as . We shall see, later on, how to construct a pseudorandom generator based on well-established assumptions, such as the hardness of integer factorization, and we shall see that the weakest assumption under which we can construct pseudorandom generators is the *existence of one-way functions*.

Today, we shall instead look at RC4, a simple candidate pseudorandom generator designed by Ron Rivest. RC4 is very efficient, and widely used in practice — for example in the WEP standard for wireless communication. It is known to be insecure in its simplest instantiation (which makes WEP insecure too), but there are variants that may be secure.

This gives a complete overview of one-time symmetric-key encryption: from a rigorous definition of security to a practical construction that may plausibly satisfy the definition.

A usable, system, however, should be able to handle *multiple* encryptions. To define security for multiple encryptions, we have to define what an adversary is able to do with past messages.

In the most basic (and unsatisfactory) setting, the adversary simply sees the encryptions of past messages. (Some systems used in practice fail to satisfy even this very basic notion of security.) We can achieve this kind of security using a pseudorandom generator if the communicating parties keep state information between communication sessions and if messages are received in the order in which they were sent.

A more satisfactory notion of security allows the adversary to see encryptions of *known plaintexts*.

**1. Description of RC4**

We now present the description of RC4, a very simple candidate pseudorandom generator. This was proposed by Ron Rivest. Though there are some theoretical considerations in the choice of encryption scheme, we shall not be going into it. Below we give a slightly generalized description of RC4.

Fix a modulus , which is in RC4, and let be the finite group of elements together with the operation of addition mod s. (The notation is more common in math.)

The generator has two phases:

The first phase is intended to construct a “pseudorandom” permutation. Before, we go into the actual construction used in RC4, we first give a description of how to construct a nearly random permutation given a sufficiently long seed. Note that the problem is non-trivial because even if we are given a very long random string and we interpret the string as a function in the obvious way, then it may not be a permutation. Hence, we need to try something more clever. A nearly random permutation may be created in the following way. Let be a random element in which we may interpret as an array of numbers each in the range . In particular, let represent the element. To create a permutation over elements, do the following ( represents the identity permutation i.e. )

- For
- Swap and

What distribution over permutations do we generate with the above process? The answer is not completely understood, but the final permutation is believed to be close to uniformly distributed.

However, the above process is inefficient in the amount of randomness required to create a random permutation. We now describe a process which is more randomness efficient i.e. uses a smaller key to construct a permutation (which shall now be “pseudorandom”, although this is not meant as a technical term; the final permutation will be distinguishable from a truly random permutation). The seed (interpreted as an array over elements in of length ) is converted into a permutation as follows (the variables are in and so addition is performed mod ):

- for in :
- swap

(Note that if then the first phase has the following simpler description: for each , swap with a random location which is the same thing we did in the simplified probabilistic process.)

In the second phase, the permutation is used to produce the output of the generator as follows:

- ;
- for to :
- output
- swap

In RC4, is 256, as said before, which allows extremely fast implementations, and is around 100.

The construction as above is known to be insecure: the second byte has probability instead of of being the all-zero byte which violates the definition of pseudorandom generator.

There are other problems besides this bias, and it is possible to reconstruct the key and completely break the generator given a not-too-long sequence of output bits. WEP uses RC4 as described above, and is considered completely broken.

If one discards an initial prefix of the output, however, no strong attack is known. A conservative recommendation is to drop the first bits.

**2. Security for Multiple Encryptions: Vanilla Version**

Last time we introduced the following notion of security for multiple encryptions.

Definition 1 (Message indistinguishability for multiple encryptions)is -message indistinguishable for encryptions if for every messages , and every of complexity we have

An important thing to be noted here is that encoding multiple messages requires the encryption scheme to be randomized even to meet the vanilla definition of multiple encryption security. This is because in case the scheme is deterministic, consider two distinct messages and . Clearly for feasibility of decryption, . Now consider the message pairs and . For the first pair, is of the form whereas is of the form where . Hence a deterministic encryption does not meet even the vanilla definition of security. In fact, with some kind of data frequency analysis, we might be able to break the pseudorandom generator.

We now describe how to meet this vanilla definition of security using pseudorandom generators. However, this requires the encryption and decryption to be stateful and further the messages to be synchronized i.e. they should be decrypted in the same order as they were sent. The idea is to use a PRG in order to expand the key and then keep moving a counter along the output of the PRG. Initially the counter is set to zero and if at the end of the encryption, the counter is at , then in order to encrypt the message (say ), it is XORed with the substring of the PRG output starting from the position to position. The counter is set to at the end of the encryption. The security of the encryption scheme follows because of the observation that this reduces to encryption of one message which is concatenation (in sequence) of the individual messages. Note that the PRG may not be “online” in the sense that it may be necessary to compute the bit before the bit can be computed. However, with a special kind of pseudorandom generators called Stream ciphers, this problem is avoided. In this, after encryption of the message, a state is stored and encrypting the message, the PRG takes as input the key as well as the state. The state is updated after producing the output. This is much more “online” in some sense.

**3. Security for Multiple Encryptions: Chosen Plaintext Attack**

In realistic scenarios, an adversary has knowledge of plaintext-ciphertext pairs. A broadly (but not fully) general way to capture this knowledge is to look at a model in which the adversary is able to see *encryptions of arbitrary messages of her choice*. An attack in this model is called a Chosen Plaintext Attack (CPA). This model at least captures the situation when the messages which were initially secret have been made public in course of time and hence some plaintext ciphertext pairs are available to the adversary. Using new primitives called *pseudorandom functions* and *pseudorandom permutations*, it is possible to construct encryption schemes that satisfy this notion of security. In fact, an even stronger notion of security where adversary is allowed to see decryptions of certain chosen messages can also be constructed using pseudorandom functions but it will take us some time to develop the right tools to analyze a construction meeting this level of security. How do we construct pseudorandom functions and permutations? It is possible to construct them from pseudorandom generators (and hence from one-way functions), and there are ad-hoc constructions which are believed to be secure. For the time being, we define security under CPA and show how it generalizes the notion of multiple encryption security given in the last section.

If is a, possibly randomized, procedure, and is an algorithm, we denote by the computation of algorithm given as an input and given the ability to execute . We charge just one unit of time for every execution of , and we refer to as having *oracle access* to .

Definition 2 (Message indistinguishability against CPA)is -message indistinguishable against CPA if for every messages , and every of complexity we have

We now prove that it is a generalization of security for multiple encryptions (as defined in the last section)

Lemma 3Suppose is -message indistinguishable against CPA. Then for every it is -message indistinguishable for encryptions.

*Proof:* We prove by contradiction i.e. we assume that there exist a pair of messages and such that there is a procedure of complexity which can distinguish between these two with probability greater than . We shall prove existence of two messages and and an oracle procedure of complexity such that

We shall assume a circuit model rather than the Turing machine model of computation here. We first start with a simple case i.e. let there exist pair of messages and such that the sequence differs exactly at one position say i.e. for and . By assumption, we can say that

The machine on being given input simulates machine as

using the oracle to know for . Clearly by assumption, can distinguish between and with probability more than . Also, the hardwiring of the messages for increases the circuit complexity by at most (there are of them and each is of length at most ). Hence is a circuit of complexity at most . To move to the general case where the sequences differ at more than one place, we use the hybrid argument which is a staple of proofs in cryptography. We shall use it here as follows. Consider -tuple defined as –

Then, we have that which can be rewritten as . By triangle inequality, we get that there exists some such that . However, note that and differ at exactly one position, a case which we have already solved. The only difference is that the distinguishing probability is rather than because of introduction of the hybrid argument. ◻

## Leave a comment

Comments feed for this article