You are currently browsing the monthly archive for January 2009.

*Scribed by Bharath Ramsundar*

**Summary**

Last time we introduced the setting of *one-time symmetric key encryption*, defined the notion of *semantic security*, and proved its equivalence to *message indistinguishability*.

Today we complete the proof of equivalence (found in the notes for last class), discuss the notion of *pseudorandom generator*, and see that it is precisely the primitive that is needed in order to have message-indistinguishable (and hence semantically secure) one-time encryption. Finally, we shall introduce the basic definition of security for protocols which send multiple messages with the same key.

**1. Pseudorandom Generators And One-Time Encryption**

Intuitively, a Pseudorandom Generator is a function that takes a short random string and stretches it to a longer string which is almost random, in the sense that reasonably complex algorithms cannot differentiate the new string from truly random strings with more than negligible probability.

Definition 1[Pseudorandom Generator] A function is a -secure pseudorandom generator if for every boolean function of complexity at most we have

(We use the notation for the uniform distribution over .)

The definition is interesting when (otherwise the generator can simply output the first m bits of the input, and satisfy the definition with and arbitrarily large ). Typical parameters we may be interested in are , , and , that is we want to be very small, to be large, to be huge, and to be tiny. There are some unavoidable trade-offs between these parameters.

Lemma 2If is pseudorandom with , then .

*Proof:* Pick an arbitrary . Define

It is clear that we may implement with an algorithm of complexity : all this algorithm has to do is store the value of (which takes space ) and compare its input to the stored value (which takes time ) for total complexity of . Now, note that

since at least when . Similarly, note that since only when . Now, by the pseudorandomness of , we have that . With some rearranging, this expression implies that

which then implies and consequently ◻

Exercise 1Prove that if is pseudorandom, and , then

Suppose we have a pseudorandom generator as above. Consider the following encryption scheme:

- Given a key and a message ,
- Given a ciphertext and a key ,

(The XOR operation is applied bit-wise.)

It’s clear by construction that the encryption scheme is correct. Regarding the security, we have

Lemma 3If is -pseudorandom, then as defined above is -message indistinguishable for one-time encryption.

*Proof:* Suppose that is not -message indistinguishable for one-time encryption. Then messages and algorithm of complexity at most such that

By using the definition of we obtain

Now, we can add and subtract the term and use the triangle inequality to obtain that added to is greater than . At least one of the two terms in the previous expression must be greater that . Suppose without loss of generality that the first term is greater than

Now define . Then since is a bijection, . Consequently,

Thus, since the complexity of is at most and is plus an xor operation (which takes time ), is of complexity at most . Thus, is not -pseudorandom since there exists an algorithm of complexity at most that can distinguish between ‘s output and random strings with probability greater than . Contradiction. Thus is -message indistinguishable. ◻

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

In the real world, we often need to send more than just one message. Consequently, we have to create new definitions of security for such situations, where we use the same key to send multiple messages. There are in fact multiple possible definitions of security in this scenario. Today we shall only introduce the simplest definition.

Definition 4[Message indistinguishability for multiple encryptions] is -message indistinguishable for encryptions if for every messages , and every of complexity we have

Similarly, we define semantic security, and the asymptotic versions.

Exercise 2Prove that no encryption scheme in which is deterministic (such as the scheme for one-time encryption described above) can be secure even for 2 encryptions.

Encryption in some versions of Microsoft Office is deterministic and thus fails to satisfy this definition. (This is just a symptom of bigger problems; the schemes in those versions of Office are considered completely broken.)

If we allow the encryption algorithm to keep *state* information, then a pseudorandom generator is sufficient to meet this definition. Indeed, usually pseudorandom generators designed for such applications, including RC4, are optimized for this kind of “stateful multiple encryption.”

Next time, we shall consider a stronger model of multiple message security which will be secure against *Chosen Plaintext Attacks*.

**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*.

**What’s Coming Next**

Using new primitives called *pseudorandom functions* and *pseudorandom permutations*, it is possible to construct encryption schemes that satisfy this notion of security and that do not require synchronization between sender and receiver, and that do not require them to keep state information.

The best notion of security resists even an attack in which the adversary has the ability to see decryptions of chosen messages. This notion too is achievable via 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.

**1. RC4**

RC4 is a very simple candidate pseudorandom generator. We will give a slightly generalized presentation of how it works.

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:

In the first phase, a short seed is converted into a permutation as follows ( is the identity permutation , 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.)

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.

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

If we allow the encryption algorithm to keep *state* information, then a pseudorandom generator is sufficient to meet this definition. Indeed, usually pseudorandom generators designed for such applications, including RC4, are optimized for this kind of “stateful multiple encryption.”

**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).

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

This is a generalization of security for multiple encryptions

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

**Summary**

Last time we introduced the setting of *one-time symmetric key encryption*, defined the notion of *semantic security*, and proved its equivalence to *message indistinguishability*.

Today we complete the proof of equivalence (found in the notes for last class), discuss the notion of *pseudorandom generator*, and see that it is precisely the primitive that is needed in order to have message-indistinguishable (and hence semantically secure) one-time encryption.

**1. Pseudorandom Generators And One-Time Encryption**

Definition 1[Pseudorandom Generator] A function is a -secure pseudorandom generator if for every boolean function of complexity at most we have

(We use the notation for the uniform distribution over .)

The definition is interesting when (otherwise the generator can simply output the first m bits of the input, and satisfy the definition with and arbitrarily large ). Typical parameters we may be interested in are , , and , that is we want to be very small, to be large, to be huge, and to be tiny. There are some unavoidable trade-offs between these parameters.

Lemma 2If is pseudorandom with , then .

Exercise 1Prove that if is pseudorandom, and , then

Suppose we have a pseudorandom generator as above. Consider the following encryption scheme:

- Given a key and a message ,
- Given a ciphertext and a key ,

(The XOR operation is applied bit-wise.)

It’s clear by construction that the encryption scheme is correct. Regarding the security, we have

Lemma 3If is -pseudorandom, then as defined above is -message indistinguishable for one-time encryption.

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

Definition 4[Message indistinguishability for multiple encryptions] is -message indistinguishable for encryptions if for every messages , and every of complexity we have

Similarly, we define semantic security, and the asymptotic versions.

Exercise 2Prove that no encryption scheme in which is deterministic (such as the scheme for one-time encryption described above) can be secure even for 2 encryptions.

Encryption in some versions of Microsoft Office is deterministic and thus fails to satisfy this definition. (This is just a symptom of bigger problems; the schemes in those versions of Office are considered completely broken.)

If we allow the encryption algorithm to keep *state* information, then a pseudorandom generator is sufficient to meet this definition. Indeed, usually pseudorandom generators designed for such applications, including RC4, are optimized for this kind of “stateful multiple encryption.”

As reported here, here and here, Mark Braverman has just announced a proof of a 1990 conjecture by Linial and Nisan.

Mark proves that if is an AC0 boolean circuit (with NOT gates and with AND gates and OR gates of unbounded fan-in) of depth and size , and if is any -wise independent distribution with , then

that is, “fools” the circuit into thinking that is the uniform distribution over . Plausibly, this might be true even for .

Nothing was known for depth 3 or more, and the depth-2 case was settled only recently by Bazzi, with a proof that, as you may remember, has been significantly simplified by Razborov about six months ago.

Mark’s proof relies on approximating via low-degree polynomials. The point is that if is an -variate (real valued) polynomial of degree , and is a -wise independent distribution ranging over , then

Now if we could show that approximates both under and under , in the sense that , and also , then we would be done.

The Razborov-Smolenski lower bound technique gives a probabilistic construction of a polynomial such that for every input one has a high probability that . In particular, one get one polynomial such that both

and

Unfortunately this is not sufficient, because the polynomial might be very large at a few points, and so even if agrees with with high probability there is no guarantee that the average of is close to the average of .

Using a result of Linial, Mansour and Nisan (developed in the context of learning theory), one can construct a different kind of low-degree approximating polynomial , which is such that

The Linial-Mansour-Nisan approximation, however, says nothing about the relation between and under the distribution .

Using ideas of Bazzi’s, however, if we had a single polynomial such that properties (1), (2) and (3) are satisfied simultaneously, then we could construct another low-degree polynomial such that , and also , giving us that is fooled by .

As far as I understand, Mark constructs a polynomial satisfying properties (1), (2) and (3) by starting from the Razborov-Smolenski polynomial , and then observing that the indicator function of the points on which is itself a boolean function admitting a Linial-Mansour-Nisan approximation . Defining , we have that has all the required properties, because multiplying by “zeroes out” the points on which is excessively large.

I have been interested in this problem for some time because of a connection with the complexity of 3SAT on random instances.

*In which we encounter for the first time message indistinguishability and semantic security*

In the last lecture we saw that

- all classical encryption schemes which allow the encryption of arbitrarily long messages have fatal flaws;
- it is possible to encrypt with perfect security using one-time pad, but the scheme can be used only once, and the key has to be as long as the message;
- if one wants perfect security, one needs a key as long as the total length of all messages that are going to be sent.

Our goal for the next few lectures will be to study schemes that allow the sending of messages that are essentially arbitrarily long, using a fixed key, and having a security that is essentially as good as the perfect security of one-time pad.

Today we introduce a notion of security (*semantic security*) that is extremely strong. When it is met *there is no point for an adversary to eavesdrop the channel*, regardless of what messages are being sent, of what she already knows about the message, and what goal she is trying to accomplish.

*In theory* endorses Bill Clinton as junior senator for the state of New York.

*at* WHITEHOUSE.GOV *is* BEAUTIFUL

This course assumes CS170, or equivalent, as a prerequisite. We will assume that the reader is familiar with the notions of algorithm and running time, as well as with basic notions of algebra (for example arithmetic in finite fields), discrete math and probability.

General information about the class, including prerequisites, grading, and recommended references, are available on the class home page.

Cryptography is the mathematical foundation on which one builds secure systems. It studies ways of securely storing, transmitting, and processing information. Understanding what cryptographic primitives can do, and how they can be composed together, is necessary to build secure systems, but not sufficient. Several additional considerations go into the design of secure systems, and they are covered in various Berkeley graduate courses on security.

In this course we will see a number of rigorous definitions of security, some of them requiring seemingly outlandish safety, even against entirely implausible attacks, and we shall see how if any cryptography at all is possible, then it is also possible to satisfy such extremely strong notions of security. For example, we shall look at a notion of security for encryption in which an adversary should not be able to learn any information about a message given the ciphertext, even if the adversary is allowed to get encodings of any messages of his choice, and *decodings* of any ciphertexts of his choices, with the only exception of the one he is trying to decode.

We shall also see extremely powerful (but also surprisingly simple and elegant) ways to define security for protocols involving several untrusted participants.

Learning to think rigorously about security, and seeing what kind of strength is possible, at least in principle, is one of the main goals of this course. We will also see a number of constructions, some interesting for the general point they make (that certain weak primitives are sufficient to make very strong constructions), some efficient enough to have made their way in commercial products.

## Recent Comments