












Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!













In this lecture we will see that the PRG conjecture implies the PRF conjecture. We will also see how PRFs imply an encryption scheme that is secure even when we encrypt multiple messages with the same key. We have seen that PRFโs (pseudorandom functions) are extremely useful, and weโll see some more applications of them later on. But are they perhaps too amazing to exist? Why would someone imagine that such a wonderful object is feasible? The answer is the following theorem:
Theorem 5.1 โ The PRF Theorem. Suppose that the PRG Conjecture is true, then there exists a secure PRF collection {๐๐ }๐ โ{0,1}โ such that for every ๐ โ {0, 1}๐, ๐๐ maps {0, 1}๐^ to {0, 1}๐.
Figure 5.1 : The construction of a pseudorandom function from a pseudorandom generator can be illustrated by a depth ๐ binary tree. The root is labeled by the seed ๐ and for every internal node ๐ฃ labeled by a string ๐ฅ โ {0, 1}๐, we use that label ๐ฅ as a seed into the PRG ๐บ to label ๐ฃโs two children. In particular, the children of ๐ฃ are labeled with ๐บ 0 (๐ฅ) and ๐บ 1 (๐ฅ) respectively. The output of the function ๐๐ on input ๐ is the label of the ๐๐กโ^ leaf counting from left to right. Note that the numbering of leaf ๐ is related to the bitstring representation of ๐ and the path leaf ๐ in the following way: we traverse to leaf ๐ from the root by reading off the ๐ bits of ๐ left to right and descend into the left child of the current node for every 0 we encounter and traverse right for every 1.
Compiled on 11.17.2021 22:
126 an intensive introduction to cryptography
Figure 5.2 : In the โlazy evaluationโ implementation of the black box to the adversary, we label every node in the tree only when we need it. Subsequent traversals do not reevaluate the PRG, leading to reuse of the intermediate seeds. Thus for example, two sibling leaves will correspond to a single call to ๐บ(๐ฅ), where ๐ฅ is their parentโs label, but with the left child receiving the first ๐ bits and the right child receiving the second ๐ bits of ๐บ(๐ฅ). In this figure check marks correspond to nodes that have been labeled and question marks to nodes that are still unlabeled.
Proof. We describe the proof, see also Chapter 6 of Rosulek or Section 8.5 of Katz-Lindell (section 7.5 in 2nd edition) for alternative exposi- tions. If the PRG Conjecture is true then in particular by the length exten- sion theorem there exists a PRG ๐บ โถ {0, 1}๐^ โ {0, 1}2๐^ that maps ๐ bits into 2๐ bits. Letโs denote ๐บ(๐ ) = ๐บ 0 (๐ ) โ ๐บ 1 (๐ ) where โ denotes concatenation. That is, ๐บ 0 (๐ ) denotes the first ๐ bits and ๐บ 1 (๐ ) denotes the last ๐ bits of ๐บ(๐ ). For ๐ โ {0, 1}๐, we define ๐๐ (๐) as
๐บ๐๐ (๐บ๐๐โ1 (โฏ ๐บ๐ 1 (๐ ))).
This corresponds to ๐ composed applications of ๐บ๐ for ๐ โ {0, 1}. If the ๐๐กโ^ bit of ๐โs binary string is 0 then the ๐๐กโ^ application of the PRG is ๐บ 0 otherwise it is ๐บ 1. This series of successive applications starts with the initial seed ๐ . This definition directly corresponds to the depiction in Fig. 5.1, where the successive applications of ๐บ๐ correspond to the recursive labeling procedure. By the definition above we can see that to evaluate ๐๐ (๐) we need to evaluate the pseudorandom generator ๐ times on inputs of length ๐, and so if the pseudorandom generator is efficiently computable then so is the pseudorandom function. Thus, โallโ thatโs left is to prove that the construction is secure and this is the heart of this proof. Iโve mentioned before that the first step of writing a proof is con- vincing yourself that the statement is true, but there is actually an often more important zeroth step which is understanding what the statement actually means. In this case what we need to prove is the following: We need to show that the security of the PRG ๐บ implies the security of the PRF ensemble {๐๐ }. Via the contrapositive, this means that we assume that there is an adversary ๐ด that can distinguish in time ๐ a black box for ๐๐ (โ ) from a black-box for a random function with advantage ๐. We need to use ๐ด come up with an adversary ๐ท that can distinguish in time ๐๐๐๐ฆ(๐ ) an input of the form ๐บ(๐ ) (where ๐ is random in {0, 1}๐) from an input of the form ๐ฆ where ๐ฆ is random in {0, 1}2๐^ with bias at least ๐/๐๐๐๐ฆ(๐ ). Assume that ๐ด as above is a ๐ -time adversary that wins in the โPRF gameโ with advantage ๐. Let us consider the โlazy evaluationโ imple- mentation of the black box for ๐ด illustrated in Fig. 5.2. That is, at every point in time there are nodes in the full binary tree that are labeled and nodes which we havenโt yet labeled. When ๐ด makes a query ๐, this query corresponds to the path ๐ 1 โฆ ๐๐ in the tree. We look at the lowest (furthest away from the root) node ๐ฃ on this path which has been labeled by some value ๐ฆ, and then we continue labelling the path
128 an intensive introduction to cryptography
Figure 5.4 : In the ๐๐กโ^ hybrid the first ๐ internal labels are drawn uniformly at random from ๐๐. All sub- sequent childrenโs labels are produced in the usual way by seeding ๐บ with the label ๐ง of the parent and assigning the first ๐ bits (๐บ 0 (๐ง)) to the left child and the last ๐ bits (๐บ 1 (๐ง)) to the right child. For exam- ple, for some node ๐ฃ๐ฟ๐โ1 at the ๐๐กโ^ level, we generate pseudorandom string ๐บ(๐ฃ๐ฟ๐โ1) and label the left child ๐ฃ๐ฟ๐ = ๐บ 0 (๐ฃ๐ฟ๐โ1) and the right child ๐ฃ๐ ๐ = ๐บ 1 (๐ฃ๐ฟ๐โ1). Note that the labeling scheme for this diagram is dif- ferent from that in the previous figures. This is simply for ease of exposition, we could still index our nodes via the path reaching them from the root.
Figure 5.5 : The ๐ + 1๐ ๐ก^ hybrid differs from the ๐๐กโ in that the process of assigning random labels con- tinues until the ๐ + 1๐ ๐ก^ step as opposed to the ๐๐กโ. The hybrids are otherwise completely identically constructed.
pseudorandom functions from pseudorandom generators and cpa security 129
Figure 5.6 : Distinguisher D is similar to hybrid ๐, in that the nodes in the first ๐ layers are assigned completely random labels. When evaluating along a particular path through ๐ฃ๐ฟ๐โ1, rather than labeling the two children by applying ๐บ to its label, it simply splits the input ๐ฆ into two strings ๐ฆ0...๐,๐ฆ๐+1...2๐. If ๐ฆ is truly random, ๐ท is identical to hybrid ๐ + 1. If ๐ฆ = ๐บ(๐ ) for some random seed ๐ , then ๐ท simulates hybrid ๐.
๐ด and the ๐๐กโ^ oracle inside its belly with one difference- when the time comes to label the ๐๐กโ^ node, instead of doing this by applying the pseudorandom generator to the label of its parent ๐ฃ (which is what should happen in the ๐๐กโ^ oracle) it uses its input ๐ฆ to label the two children of ๐ฃ. Now, if ๐ฆ was completely random then we get exactly the distribu- tion of the ๐ + 1๐ ๐ก^ oracle, and hence in this case ๐ท simulates internally the ๐ + 1๐ ๐ก^ hybrid. However, if ๐ฆ = ๐บ(๐ ) for some randomly sampled ๐ โ {0, 1}๐, though it may not be obvious at first, we actually get the distribution of the ๐๐กโ^ oracle. The equivalence between hybrid ๐ and distinguisher ๐ท under the condition that ๐ฆ = ๐บ(๐ ) is non obvious, because in hybrid ๐, the label for the children of ๐ฃ๐ฟ๐โ1 was supposed to be the result of applying the pseudorandom generator to the label of ๐ฃ๐ฟ๐โ1 and not to some other random string (see Fig. 5.6). However, because ๐ฃ was labeled before the ๐๐กโ^ step then we know that it was actually labeled by a random string. Moreover, since we use lazy evaluation we know that step ๐ is the first time where we actually use the value of the label of ๐ฃ. Hence, if at this point we resampled this label and used a completely independent random string ๐ then the distribution of ๐ฃ๐ฟ๐โ1 and ๐ would be identical. The key observations here are:
pseudorandom functions from pseudorandom generators and cpa security 131
(^1) Giving Eve the key as a sequence of ๐ 1โฒs as op- posed to in binary representation is a common no- tational convention in cryptography. It makes no difference except that it makes the input length for Eve of length ๐, which makes sense since we want to allow Eve to run in ๐๐๐๐ฆ(๐) time.
Figure 5.7 : In the CPA game, Eve interacts with the encryption oracle and at the end chooses ๐ 0 , ๐ 1 , gets an encryption ๐โ^ = ๐ธ๐(๐๐) and outputs ๐โฒ. She wins if ๐โฒ^ = ๐
way, they must maintain a synchronized shared state. If the message ๐ 1 was dropped by the network, then Bob would not be able to decrypt correctly the encryption of ๐ 2. There is another way in which treating many messages as a single tuple is unsatisfactory. In real life, Eve might be able to have some im- pact on what messages Alice encrypts. For example, the Katz-Lindell book describes several instances in World War II where Allied forces made particular military maneuver for the sole purpose of causing the Axis forces to send encryptions of messages of the Alliesโ choosing. To consider a more modern example, today Google uses encryption for all of its search traffic including (for the most part) the ads that are displayed on the page. But this means that an attacker, by pay- ing Google, can cause it to encrypt arbitrary text of their choosing. This kind of attack, where Eve chooses the message she wants to be encrypted is called a chosen plaintext attack. You might think that we are already covering this with our current definition that requires se- curity for every pair of messages and so in particular this pair could be chosen by Eve. However, in the case of multiple messages, we would want to allow Eve to be able to choose ๐ 2 after she saw the encryption of ๐ 1. All that leads us to the following definition, which is a strengthen- ing of our definition of computational security:
Definition 5.3 โ Chosen Plaintext Attack (CPA) secure encryption. An en- cryption scheme (๐ธ, ๐ท) is secure against chosen plaintext attack (CPA secure) if for every polynomial time ๐ธ๐ฃ๐, Eve wins with probability at most 1/2 + ๐๐๐๐(๐) in the game defined below:
Definition 5.3 is illustrated in Fig. 5.7. Our previous notion of com- putational secrecy (i.e., Definition 2.6) corresponds to the case that we skip Steps 3 and 5 above. Since Steps 3 and 5 only give the ad- versary more power (and hence is only more likely to win), CPA security (Definition 5.3) is stronger than computational secrecy (Def- inition 2.6), in the sense that every CPA secure encryption (๐ธ, ๐ท) is
132 an intensive introduction to cryptography
Figure 5.8 : Insecurity of deterministic encryption (^2) If the messages are guaranteed to have high entropy which roughly means that the probability that a message repeats itself is negligible, then it is possible to have a secure deterministic private-key encryption, and this is sometimes used in practice. (Though often some sort of randomization or padding is added to ensure this property, hence in effect creating a randomized encryption.) Deterministic encryptions can sometimes be useful for applications such as efficient queries on encrypted databases. See this lecture in Dan Bonehโs coursera course.
also computationally secure. It turns out that CPA security is strictly stronger , in the sense that without modification, our stream ciphers cannot be CPA secure. In fact, we have a stronger, and intially some- what surprising theorem:
Theorem 5.4 โ CPA security requires randomization. There is no CPA secure (๐ธ, ๐ท) where ๐ธ is deterministic.
Proof. The proof is very simple: Eve will only use a single round of interacting with ๐ธ where she will ask for the encryption ๐ 1 of 0 โ. In the second round, Eve will choose ๐ 0 = 0โ^ and ๐ 1 = 1โ, and get ๐โ^ = ๐ธ๐(๐๐) she will then output 0 if and only if ๐โ^ = ๐ 1. โ
This proof is so simple that you might think it shows a problem with the definition, but it is actually a real problem with security. If you encrypt many messages and some of them repeat themselves, it is possible to get significant information by seeing the repetition pattern (cue the XKCD cartoon again, see Fig. 5.8). To avoid this issue we need to use a randomized (or probabilistic ) encryption, such that if we encrypt the same message twice we wonโt see two copies of the same ciphertext.^2 But how do we do that? Here pseudorandom functions come to the rescue:
Theorem 5.5 โ CPA security from PRFs. Suppose that {๐๐ } is a PRF collection where ๐๐ โถ {0, 1}๐^ โ {0, 1}โ, then the following is a CPA secure encryption scheme: ๐ธ๐ (๐) = (๐, ๐๐ (๐) โ ๐) where ๐ โ๐ {0, 1}๐, and ๐ท๐ (๐, ๐ง) = ๐๐ (๐) โ ๐ง.
Proof. I leave to you to verify that ๐ท๐ (๐ธ๐ (๐)) = ๐. We need to show the CPA security property. As is usual in PRF-based constructions, we first show that this scheme will be secure if ๐๐ was an actually random function, and then use that to derive security. Consider the game above when played with a completely random function and let ๐๐ be the random string chosen by ๐ธ in the ๐๐กโ^ round and ๐โ^ the string chosen in the last round. We start with the following simple but crucial claim: Claim: The probability that ๐โ^ = ๐๐ for some ๐ is at most ๐ /2๐. Proof of claim: For any particular ๐, since ๐โ^ is chosen indepen- dently of ๐๐, the probability that ๐โ^ = ๐๐ is 2 โ๐. Hence the claim fol- lows from the union bound. QED Given this claim we know that with probability 1 โ ๐ /2๐^ (which is 1 โ ๐๐๐๐(๐)), the string ๐โ^ is distinct from any string that was chosen before. This means that by the lazy evaluation principle, if ๐๐ (โ ) is a completely random function then the value ๐๐ (๐โ) can be thought
134 an intensive introduction to cryptography
a random map might not be a permutation, it is not possible to distinguish with a polynomial number of queries between a black box that computes a random function and a black box that computes a random permutation. Understanding why this is the case, and why this means that ?? is reasonable, is crucial to getting intuition to this notion, and so I suggest you pause now and make sure you understand these points.
As usual with a new concept, we want to know whether it is possi- ble to achieve it and whether it is useful. The former is established by the following theorem:
Theorem 5.6 โ PRPโs from PRFs. If the PRF conjecture holds (and hence by Theorem 5.1 also if the PRG conjecture holds) then there exists a pseudorandom permutation collection.
Figure 5.9 : We build a PRP ๐ on 2๐ bits from three PRFs ๐๐ 1 , ๐๐ 2 , ๐๐ 3 on ๐ bits by letting ๐๐ 1 ,๐ 2 ,๐ 3 (๐ฅ 1 , ๐ฅ 2 ) = (๐ง 1 , ๐ฆ 2 ) where ๐ฆ 1 = ๐ฅ 1 โ ๐๐ 1 (๐ฅ 2 ), ๐ฆ 2 = ๐ฅ 2 โ ๐๐ 2 (๐ฆ 1 ) and ๐ง 1 = ๐๐ 3 (๐ฆ 2 ) โ ๐ฆ 1.
Proof. Fig. 5.9 illustrates the construction of a pseudorandom permu- tation from a pseudorandom function. The construction (known as the Luby-Rackoff construction) uses several rounds of what is known as the Feistel Transformation that maps a function ๐ โถ {0, 1}๐^ โ {0, 1}๐^ into a permutation ๐ โถ {0, 1}2๐^ โ {0, 1}2๐^ using the map (๐ฅ, ๐ฆ) โฆ (๐ฅ, ๐(๐ฅ) โ ๐ฆ). Specifically, given a PRF family {๐๐ } with ๐-bit keys, inputs, and outputs, our candidate PRP family will be called {๐๐ 1 ,๐ 2 ,๐ 3 }. Here, ๐๐ 1 ,๐ 2 ,๐ 3 โถ {0, 1}2๐^ โ {0, 1}2๐^ is calculated on input (๐ฅ 1 , ๐ฅ 2 ) โ {0, 1}2๐ as follows (see Fig. 5.9):
pseudorandom functions from pseudorandom generators and cpa security 135
Each of the first three steps above corresponds to a single round of the Feistel transformation, which is easily seen to be both efficiently computable and efficiently invertible. In fact, we can efficiently calcu- late ๐๐ โ1 1 ,๐ 2 ,๐ 3 (๐ง 1 , ๐ฆ 2 ) for an arbitrary string (๐ง 1 , ๐ฆ 2 ) โ {0, 1}2๐^ by running the above three rounds of Feistel transformations in reverse order. Thus, the real challenge in proving Theorem 5.6 is not showing that {๐๐ 1 ,๐ 2 ,๐ 3 } is a valid permutation, but rather showing that it is pseudorandom. The details of remainder of this proof are a bit technical, and can be safely skipped on a first reading. Intuitively, the argument goes like this. Consider an oracle ๐ช for ๐๐ 1 ,๐ 2 ,๐ 3 that answers an adversaryโs query (๐ฅ 1 , ๐ฅ 2 ) by carrying out the three Feistel transformations outlined above and outputting (๐ง 1 , ๐ฆ 2 ). First, weโll show that with high probability, ๐ช will never encounter the same intermediate string ๐ฆ 1 twice, over the course of all queries (unless the adversary makes a duplicate query). Since the string ๐ฆ 1 , calculated in Step 1, determines the input on which ๐๐ 2 is evaluated in Step 2, it follows that the strings ๐ฆ 2 calculated in Step 2 will appear to be chosen independently and at random. In particular, they too will be pairwise distinct with high probability. Since the string ๐ฆ 2 is in turn passed as input to ๐๐ 3 in Step 3, it follows that the strings ๐ง 1 encountered over the course of all queries will also appear to be chosen independently and at random. Ultimately, this means that the oracleโs outputs (๐ง 1 , ๐ฆ 2 ) will look like freshly independent, random strings. To make this reasoning precise, notice first that it suffices to estab- lish the security of a variant of ๐๐ 1 ,๐ 2 ,๐ 3 in which the pseudorandom functions ๐๐ 1 , ๐๐ 2 , and ๐๐ 3 used in the construction are replaced by truly random functions โ 1 , โ 2 , โ 3 โถ {0, 1}๐^ โ {0, 1}๐. Call this vari- ant ๐โ 1 ,โ 2 ,โ 3. Indeed, the assumption that {๐๐ } is a PRF collection tells us that making this change has only a negligible effect on the output of an adversary with oracle access to ๐. With this in mind, our job is to show that for every efficient adversary ๐ด, the difference | Pr[๐ด๐โ^1 ,โ^2 ,โ^3 (โ )(1๐) = 1] โ Pr[๐ด๐ป(โ )(1๐) = 1]| is negligible. In this expression, the first probability is taken over the choice of the random functions โ 1 , โ 2 , โ 3 โถ {0, 1}๐^ โ {0, 1}๐^ used in the Feistel transfor- mation, and the second probability is taken over the random function ๐ป โถ {0, 1}2๐^ โ {0, 1}2๐. To simplify matters, suppose without loss of generality that ๐ด always makes ๐(๐) distinct queries to its oracle, de- noted (๐ฅ(1) 1 , ๐ฅ(1) 2 ), โฆ , (๐ฅ(๐(๐)) 1 , ๐ฅ(๐(๐)) 2 ) in order. Similarly, let ๐ฆ(๐) 1 , ๐ฆ(๐) 2 , ๐ง(๐) 1
pseudorandom functions from pseudorandom generators and cpa security 137
Figure 5.10 : A typical round of a block cipher, ๐๐ is the ๐๐กโ^ round key, ๐ฅ๐ is the block before the ๐๐กโ^ round and ๐ฅ๐+1 is the block at the end of this round.
tel transformation does not suffice to achieve a PRP. Hint: consider an adversary that makes queries of the form (๐ฅ 1 , ๐ฅ 2 ) where ๐ฅ 2 is held fixed and ๐ฅ 1 is varied.
The more common name for a pseudorandom permutation is block cipher (though typically block ciphers are expected to meet additional security properties on top of being PRPs). The constructions for block ciphers used in practice donโt follow the construction of Theorem 5. (though they use some of the ideas) but have a more ad-hoc nature. One of the first modern block ciphers was the Data Encryption Standard (DES) constructed by IBM in the 1970โs. It is a fairly good cipher- to this day, as far as we know, it provides a pretty good num- ber of security bits compared to its key length. The trouble is that its key is only 56 bits long, which is no longer outside the reach of mod- ern computing power. (It turns out that subtle variants of DES are far less secure and fall prey to a technique known as differential crypt- analysis; the IBM designers of DES were aware of this technique but kept it secret at the behest of the NSA.) Between 1997 and 2001, the U.S. National Institute of Standards and Technology (NIST) ran a competition to replace DES which resulted in the adoption of the block cipher Rijndael as the new advanced encryption standard (AES). It has a block size (i.e., input length) of 128 bits and a key size (i.e., seed length) of 128, 196, or 256 bits. The actual construction of AES (or DES for that matter) is not ex- tremely illuminating, but let us say a few words about the general principle behind many block ciphers. They are typically constructed by repeating one after the other a number of very simple permuta- tions (see Fig. 5.10). Each such iteration is called a round. If there are ๐ก rounds, then the key ๐ is typically expanded into a longer string, which we think of as a ๐ก tuple of strings (๐ 1 , โฆ , ๐๐ก) via some pseu- dorandom generator known as the key scheduling algorithm. The ๐-th string in the tuple is known as the round key and is used in the ๐๐กโ round. Each round is typically composed of several components: there is a โkey mixing componentโ that performs some simple permu- tation based on the key (often as simply as XORโing the key), there is a โmixing componentโ that mixes the bits of the block so that bits that were initially nearby donโt stay close to one another, and then there is some non-linear component (often obtained by applying some simple non-linear functions known as โS boxesโ to each small block of the input) that ensures that the overall cipher will not be an affine func- tion. Each one of these operations is an easily reversible operations, and hence decrypting the cipher simply involves running the rounds backwards.
138 an intensive introduction to cryptography
(^3) Partially this is because in the above construction we had to encode a plaintext of length ๐ with a ciphertext of length 2๐ meaning an overhead of 100 percent in the communication.
Figure 5.11 : In the Electronic Codebook (ECB) mode, every message is encrypted deterministically and independently
Figure 5.12 : An encryption of the Linux penguin (left image) using ECB mode (middle image) vs CBC mode (right image). The ECB encryption is insecure as it reveals much structure about the original image. Image taken from Wikipedia.
Figure 5.13 : In the Cypher-Block-Chaining (CBC) the encryption of the previous message is XORโed into the current message prior to encrypting. The first message is XORโed with an initialization vector (IV) that if chosen randomly, ensures CPA security.
5.3 ENCRYPTION MODES
How do we use a block cipher to actually encrypt traffic? Well we could use it as a PRF in the construction above, but in practice people use other ways.^3 The most natural approach would be that to encrypt a message ๐, we simply use ๐๐ (๐) where {๐๐ } is the PRP/block cipher. This is known as the electronic code book (ECB) mode of a block cipher (see Fig. 5.11). Note that we can easily decrypt since we can compute ๐โ1๐ (๐). If the PRP {๐๐ } only accepts inputs of a fixed length โ, we can use ECB mode to encrypt a message ๐ whose length is a multiple of โ by writing ๐ = (๐ 1 , ๐ 2 , โฆ , ๐๐ก), where each block ๐๐ has length โ, and then encrypting each block ๐๐ separately. The ciphertext output by this encryption scheme is (๐๐ (๐ 1 ), โฆ , ๐๐ (๐๐ก)). A major drawback of ECB mode is that it is a deterministic encryption scheme and hence cannot be CPA secure. Moreover, this is actually a real problem of se- curity on realistic inputs (see Fig. 5.12), so ECB mode should never be used. A more secure way to use a block cipher to encrypt is the cipher block chaining (CBC) mode. The idea of cipher block chaining is to encrypt the blocks of a message ๐ = (๐ 1 , โฆ , ๐๐ก) sequentially. To encrypt the first block ๐ 1 , we XOR ๐ 1 with a random string known as the initialization vector , or IV , before applying the block cipher ๐๐ . To encrypt one of the later blocks ๐๐, where ๐ > 1, we XOR ๐๐ with the encryption of ๐๐โ1 before applying the block cipher ๐๐ . Formally, the ciphertext consists of the tuple ( IV , ๐ 1 , โฆ , ๐๐ก), where IV is chosen uniformly at random and ๐๐ = ๐๐ (๐๐โ1 โ ๐๐) for 1 โค ๐ โค ๐ก (we use the convention that ๐ 0 = IV ). This encryption process is depicted in Fig. 5.13. In order to decrypt ( IV , ๐ 1 , โฆ , ๐๐ก), we simply calculate ๐๐ = ๐โ1๐ (๐๐) โ ๐๐โ1 for 1 โค ๐ โค ๐ก. Note that if we lose the block ๐๐ to traffic in the CBC mode, then we are unable to decrypt the next block ๐๐+1, but we can recover from that point onwards. On the one hand, CBC mode is vastly superior to a simple elec- tronic codebook since CBC mode with a random IV is CPA secure (proving this is an excellent exercise). On the other hand, CBC mode suffers from the drawback that the encryption process cannot be par- allelized: the ciphertext block ๐๐ must be computed before ๐๐+1. In the output feedback (OFB) mode we first encrypt the all zero string using CBC mode to get a sequence (๐ฆ 1 , ๐ฆ 2 , โฆ) of pseudorandom outputs that we can use as a stream cipher. To transmit a message ๐ โ {0, 1}โ, we send the XOR of ๐ with the bits output by this stream cipher, along with the IV used to generate the sequence. The receiver can decrypt a ciphertext ( IV , ๐) by first using IV to recover (๐ฆ 1 , ๐ฆ 2 , โฆ), and then taking the XOR of ๐ with the appropriate number of bits
140 an intensive introduction to cryptography
One way to protect the movie data, which we model as a string ๐ฅ, is to provide consumers with a secure encryption ๐ธ๐(๐ฅ) of the data. Although the secret key ๐ used to encrypt the data is hidden from consumers, it is provided to device manufacturers so that they can embed it in their TVs and Blu-ray players in some secure, tamper- resistant manner. As long as the key ๐ is never leaked to the public, this system ensures that only approved devices can decrypt and play a consumerโs copy of the movie. For this reason, we will sometimes refer to ๐ as the device key. This setup is depicted in Fig. 5.14.
Figure 5.14 : The problem setup for broadcast encryp- tion.
Unfortunately, if we were to implement this scheme exactly as written, it would almost certainly be broken in a matter of days. After all, as soon as even a single device is hacked, the device key ๐ would be revealed. This would allow the public to access our movieโs data, as well as the data for all future movies we release for these devices! This latter consequence is one that we would certainly want to avoid, and doing so requires the notion of distinct, revocable keys:
Definition 5.8 โ Broadcast Encryption Scheme. For our purposes, a broad- cast encryption scheme consists of:
pseudorandom functions from pseudorandom generators and cpa security 141
Intuitively, a broadcast encryption scheme is secure if ๐ท๐๐ can suc- cessfully recover ๐ฅ from ๐ธ๐๐๐๐ ๐ก๐๐ ,๐ (๐ฅ) whenever ๐ โ ๐ , but fails to do so whenever ๐ โ ๐ . In our example of movie piracy, such an en- cryption scheme would allow us to revoke certain device keys ๐๐ when we find out that they have been leaked. To revoke a key ๐๐, we would simply include ๐ โ ๐ when encrypting all future movies. Doing so prevents ๐๐ from being used to decrypt these movies. Crucially, revok- ing the key ๐๐ of the hacked device ๐ doesnโt prevent a secure device ๐ โ ๐ from continuing to perform decryption on future movie releases; this is exactly what we want in our system. For the sake of brevity, we will not provide a formal definition of security for broadcast encryption schemes, although this can and has been done. Instead, in the remainder of this section, we will describe a couple examples of broadcast encryption schemes, one of which makes clever use of a tree construction, as promised. The simplest construction of a broadcast encryption scheme in- volves letting ๐๐๐๐ ๐ก๐๐ = (๐ 1 , โฆ , ๐๐) be the collection of all device keys and letting ๐ธ๐๐๐๐ ๐ก๐๐ ,๐ (๐ฅ) be the concatenation over all ๐ โ ๐ of a secure encryption ๐ธ๐๐ (๐ฅ). Device ๐ performs decryption by looking up the relevant substring ๐ธ๐๐ (๐ฅ) of the ciphertext and decrypting it with ๐๐. Intuitively, with this scheme, if ๐ฅ represents our movie data and there are ๐ โ one million devices, then ๐ธ๐๐๐๐ ๐ก๐๐ ,๐ (๐ฅ) is just an encryption of one million copies of the movie (one for each device key). Revok- ing the key ๐๐ amounts to only encrypting 999, 999 copies of all future movies, so that device ๐ can no longer perform decryption. Clearly, this simple solution to the broadcast encryption prob- lem has two serious inefficiencies: the length of the master key is ๐(๐๐), and the length of each encryption is ๐(|๐ฅ|๐). One way to address the former problem is to use a key derivation function. That is, we can shorten the master key by choosing a fixed PRF collection {๐๐}, and calculating each device key ๐๐ by the rule ๐๐ = ๐๐๐๐๐ ๐ก๐๐ (๐). The latter problem can be addressed using a technique known as hybrid encryption. In hybrid encryption, we encrypt ๐ฅ by first choos- ing an ephemeral key ๐ โฬ ๐ {0, 1}๐, encrypting ๐ฬ using each device key ๐๐ where ๐ โ ๐ , and then outputting the concatenation of these strings ๐ธ๐๐ (ฬ๐), along with a single encryption ๐ธ๐ฬ(๐ฅ) of the movie us- ing the ephermal key. Incorporating these two optimizations reduces the length of ๐๐๐๐ ๐ก๐๐ to ๐(๐) and the length of each encryption to ๐(๐๐ + |๐ฅ|).
pseudorandom functions from pseudorandom generators and cpa security 143
5.5 READING COMPREHENSION EXERCISES
I recommend students do the following exercises after reading the lecture. They do not cover all material, but can be a good way to check your understanding.
Exercise 5.1 Let (๐ธ, ๐ท) be the encryption scheme that we saw in Lec- ture 2 where ๐ธ๐(๐) = ๐บ(๐) โ ๐ where ๐บ(โ ) is a pseudorandom generator. Is this scheme CPA secure?
a. No it is never CPA secure. b. It is always CPA secure. c. It is sometimes CPA secure and sometimes not, depending on the properties of the PRG ๐บ
โ
Exercise 5.2 Consider the proof constructing PRFs from PRGs. Up to an order of magnitude, how many invocations of the underlying pseudorandom generator does the pseudorandom function collection make when queried on an input ๐ โ {0, 1}๐?
a. ๐ b. ๐^2 c. 1 d. 2 ๐
โ
Exercise 5.3 In the following we identify a block cipher with a pseudo- random permutation (PRP) collection. Which of these statements is true:
a. Every PRP collection is also a PRF collection b. Every PRF collection is also a PRP collection c. If {๐๐ } is a PRP collection then the encryption scheme ๐ธ๐ (๐) = ๐๐ (๐) is a CPA secure encryption scheme. d. If {๐๐ } is a PRF collection then the encryption scheme ๐ธ๐ (๐) = ๐๐ (๐) is a CPA secure encryption scheme.
โ