






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!







University of Illinois, Urbana Champaign CS/ECE 498AC3/4 Applied Cryptography
Instructor: Dakshita Khurana Scribe: Ian George & Andrew Liu Date: August 27, 2020
Pseudorandom Generators (PRGs), Stream Ciphers
Last lecture, we were introduced to our first “secure” encryption scheme, One Time Pad (OTP). OTP consisted of an encryption and decryption algorithm. As we will see in this lecture, all ciphers are of this form. In the last lecture we also proved that OTP satisfies Perfect Security. However, we saw that OTP is defined such that the key space is the same size as the message space, i.e. |K| = |M|. This assumption is not practical for general real-life applications as it requires using large encryption keys for large messages. We had ended that lecture posing the question as to whether or not there existed encryption schemes with perfect secrecy such that |K| < |M|. This lecture we begin by reviewing OTP. Then we will prove two important claims, 1. that OTP satisfies perfect secrecy and 2. answering the previous question in the negative. That is, we show perfect secrecy requires that |K| ≥ |M|. This motivates the need for ideas which would allow us to achieve security in a practical (rather than perfect) sense. To do this, we introduce the pseudorandom generator which is a function that expands a small amount of randomness into a larger amount of pseudorandomness. We then introduce the Stream Cipher encryption scheme which uses a pseudorandom generator to encrypt messages of much larger length than the length of the available secret key. To justify why the Stream Cipher is practically secure while not being perfectly secure, we introduce the definition of semantic security and its abstraction computational indistinguishability. Finally, we present formal proof the Stream Cipher is semantically secure justifying our earlier intuitions. In this lecture we therefore see that while we can’t achieve perfect security, by allowing a relaxed notion of security that is still robust in real life applications, semantic security, we can build an encryption scheme which is both (semantically) secure and practical to implement. It is then the notion of computational indistinguishability, which semantic security is a specific instance of for ciphers, which will allow us throughout this course to construct implementable, secure cryptosystems.
How do you obtain secure communication over an untrusted channel? This is done by a cipher, two algorithms (Enc, Dec) that are defined over the sets {K, M, C}. In a cipher, a shared secret key is used by the sender and recipient in order to encrypt message to ciphertext and decrypt from ciphertext to message respectively. The following is the definition of a specific cipher, the Shannon Cipher.
Definition 2.1. (Shannon Cipher) Let K be the set of all possible keys, M the set of all possible messages, and C the set of all possible ciphertexts. The Shannon Cipher can be described as E = (Enc, Dec), where Enc is the encryption function and Dec is the decryption function. More formally, we can define Enc and Dec as follows, where m ∈ M,k ∈ K, c ∈ C :
Enc(k, m) = c
Dec(k, c) = m
The encryption function takes a key and message, and outputs a ciphertext. The decryption function takes a key and ciphertext, and outputs a message. However, a correct cipher should ensure that if a message m 0 ∈ M is encrypted with key k 0 ∈ K, which results in ciphertext c 0 ∈ C, then when c 0 is decrypted with k 0 , the result should be m 0.
Corollary 2.2. If E = (Enc, Dec) is a cipher, then the following must be true for k ∈ K, m ∈ M :
Dec(k, Enc(k, m)) = m
This corollary pretty much defines what it means for a scheme to be correct. If the receiver is not able to attain the message that the sender intended, then useful communication between the two parties is not at all possible.
So far, we have defined the basics of a cipher, but we are still left with what exactly the Dec(k, c) and Enc(k, m) consists of. Next we will define a specific Shannon Cipher, the One Time Pad.
Definition 2.3. (One Time Pad) Let K := { 0 , 1 }n, M := C := { 0 , 1 }≤n, where n is a fixed natural number. For k ∈ K, m ∈ M, c ∈ C, Enc and Dec of One Time Pad are defined as follows:
Enc(k, m) := k ⊕ m Dec(k, c) := k ⊕ c
Claim 2.4. One Time Pad follows Corollary 2.
Proof. Given k ∈ K, m ∈ M we will show that Dec(k, Enc(k, m)) = m holds.
Dec(k, Enc(k, m)) = m
= P r[m′^ ⊕ K = c] = P r[K = m′^ ⊕ c] = 2−l Next we will compute P r[C = c] for any c ∈ C, using what we just proved
P r[C = c] =
m′∈M
P r[C = c|M = m′] ∗ P r[M = m′]
= 2−l^
m′∈M
P r[M = m′]
= 2−l^ ∗ 1 = 2−l With these results, and using Bayes Thm., we will show that One Time Pad follows Definition 2.6, and is thus perfectly secure
P r[M = m|C = c] =
P r[C = c|M = m]P r[M = m] P r[C = c]
= 2 −lP r[M = m] 2 [^ − l] = P r[M = m]
Alternatively, we can prove a more general statement, that if the length of the key is less than the length of a message for a cipher, then that cipher cannot attain perfect secrecy.
Claim 2.8. If E = (Enc, Dec) is a perfectly secret encryption scheme defined over (K, M, C), then |K| ≥ |M|
Proof. Assume |K| < |M|. Let c ∈ C be a ciphertext that occurs with non-zero probability. Let M(c) = {m|m = Deck(c) for some k ∈ K}. Beacause Dec() is deterministic, and |K| < |M|, then we can see that there exists m′^ ∈ M such that m′^ ∈ M/ (c). Then, P r[M = m′|C = c] = 0 6 = P r[M = m′], and thus by Definition 2.6, the scheme is not perfectly secure.
Therefore, we know that One Time Pad is perfectly secure, and a perfectly secure scheme must have key length greater or equal to message length.
Although One Time Pad may seem perfect for sending messages over unsecure channels, there is a major drawback. As we have seen in the previous section, a perfectly secure scheme must have key length greater or equal to message length. This brings up an issue: how to securely guarantee that both sender and receiver receive the secret key they want to use without any adversaries gaining ahold of it.
For example, during the Cuban Missile Crises the US and Soviet Union embassy delivered long rolls of printed bits to act as secret keys. They had agents carry brief cases of paper printed with the keys [2]. This is impractical, and leads us to consider alternate cipher schemes, were the key length does not need to be as long as the message length. However, we just provided in Claim 2.8 that for a scheme to be perfectly secure, then key length must be greater or equal to message length. So how do we create a scheme that has shorter key length? The first step for creating such a a scheme is a pseudorandom generator. A Pseudorandom Generator is a deterministic function that maps a domain of n bit strings to a domain of m bit strings, such that its output is difficult to determine from a uniform distribution. More formally, for any Pseudorandom Generator, the following claim must hold true.
Claim 2.9. For PRG: { 0 , 1 }n^ → { 0 , 1 }m, where m > n, and ε is a negligible value, then for any probabalistic polynomial time adversary A, k ← { 0 , 1 }n, j ← { 0 , 1 }m, the following is true
|P r[A(P RG(k)) = 1] − P r[A(j) = 1]| ≤ ε (2.1)
This essentially states that it is hard for such an adversary to tell the difference between the m-bit output of a PRG with a random n-bit seed, and a m-bit string chosen uniformly from the set of all m-bit strings.
This claim is similar to the 2 game scenario we discussed in lecture 2. We will discuss what negligibility is in Section 2.5. Some other properties of a pseudorandom generator are as follows:
Lets use what we just learned, the pseudorandom generator, to create a new cipher. We can input a short random bit-string to the PRG, and use the longer pseudorandom bit-string as the mask for the message. We will call the encryption and decryption algorithms that use this technique as the Stream Cipher.
Definition 2.10. A stream cipher consists of a set of algorithms Enc and Dec, over message set M, key set K, and cipher text set C. Let m ∈ M, k ∈ K, and c ∈ C. Let l 1 be the size of k, and let l 2 be the size of m,c; l 1 < l 2. Define Pseudorandom Generator P RG with input size l 1 and output size l 2.
Enc(k, m) = m ⊕ P RG(k) Dec(k, c) = c ⊕ P RG(k)
Status Value of ε Reasoning Non-negligible 2 −^30 A good enough computer could probably run at speed 2^30 Negligible 2 −^80 Even for large files a computer can’t solve this
Figure 2.1: The partitioning of negligible and non-negligible scalar security parameters in implementations of ciphers.
Looking at the equation in the definition of semantic security (Eqn. 2.2) we see it would make most sense for ε to be a scalar as the absolute value between to probabilities clearly is a scalar. In fact, in practical implementations this is the case as presented in Figure 2.6. However, from a theoretic stand point ε is a special type of function called a negligible function. The reason for this as we will see in Section 2.7 is that really there is some security parameter λ ∈ Z≥ 0 which of course formalizes the security of the cryptographic tool. This security parameter λ is correlated with certain properties. For example, for a cipher, the length of the bit strings which populate K, M, C grows as λ increases. Given that the adversary is a PPT TM, we want it such that for some sufficiently large security parameter λ > λ 0 , our value of ’negligibility’ is smaller than the inverse of any polynomial. This is because intuitively this would imply there is no PPT TM which can successfully distinguish the two games fast enough. A negligible function is a function which captures this idea.
Definition 2.12 (Negligible Function [3]). A function ε : Z≥ 1 → R is said to be negligible if for all d ∈ R> 0 , there exists λ 0 ∈ Z≥ 1 such that for all λ > λ 0 , ε(λ) ≤ (^) λ^1 d.
Naturally a non-negligible function is simply a function which does not satisfy the definition of a negligible function.
Example 2.13. It is worthwhile to consider a few examples of negligible and non-negligible functions to better understand what is required of them and what they provide us.
λ > d log 2 (λ) ⇒ 2 λ^ > λd^ ⇒
2 λ^
λd^
f (λ) :=
1 2 λ^ λ^ is even 1 λ^30000 λ^ is odd is not negligible. This is because if I pick an odd λ, by the previous example, we know there exists d ∈ R> 0 such that f (λ) > (^) λ^1 d. It follows that for any d > 30000, there cannot exist λ 0 such that for all λ > λ 0 , f (λ) ≤ (^) λ^1 d as every time λ is odd the condition won’t hold.
The takeaway of the above examples is that for any choice of d ∈ R> 0 the negligible function is defined to be well behaved in its negligibility once it achieves it. This is important in our notions of security as not requiring this would imply sometimes one is secure for some choice of security parameter λ 1 but for some choice of security parameter λ 2 > λ 1 the security has gone away.
Having presented negligible functions, we are in a good position to present the formal definitions of a PRG which in turn will motivate the concept of computational indistin- guishability.
Definition 2.14 (Pseudorandom Generator (Formal)). A pseudorandom generator (PRG) is a family of (efficient) deterministic functions, {Gλ}λ∈Z≥ 1 where
Gλ : { 0 , 1 }λ^ → { 0 , 1 }poly(λ)
such that there exists λ 0 ∈ Z≥ 1 such that for all λ > λ 0 and PPT TM adversary A,
| Pr k←{ 0 , 1 }λ
[A(Gλ(k)) = 1] − Pr y←{ 0 , 1 }poly(λ)
[A(y) = 1]| ≤ ε(λ) (2.3)
where ε is a negligible function.
First we note this is exactly what Claim 2.9 was saying in less technical terms. Second, we see that what this says is that a PRG is a set of functions which when the security parameter λ is chosen large enough will be sufficiently indistinguishable from a uniformly random string to any PPT TM adversary. Lastly, it is worth pointing out that the view of security in terms of games is not lost; we just need to say whether or not the condition we place on the game is satisfied depends on the security parameter λ. As the indexing on the security parameter λ seems to not add much to the discussion, it will often be ignored as was done earlier in this lecture. Sometimes in statements we will say ‘for sufficiently large λ,’ which is shorthand for saying that there does in fact exist λ 0 ∈ Z≥ 1 such that for all λ > λ 0 , some negligibility condition we are interested in is met.
We can see from the discussion of semantic security (Definition 2.11) and the above definition of PRG that underlying both of these ideas is that the PPT TM adversary A cannot tell the difference between the probability distribution over ideal inputs and the probability distribution over inputs generated by our cryptographic tool (whose probability distribution may be induced by a probability distribution over an input itself^1 ). It follows we could just abstract this idea of security for arbitrary probability distributions. This is exactly the idea of computational indistinguishability.
(^1) For example, the distribution over PRG’s outputs, which is the probability distribution the adversary tests, is induced by the particular PRG along with the fact its input is an input that is uniformly sampled from the PRG’s input space.
Proof. We proceed by contradiction. Let it be the case that for all λ ≥ 1,
m ⊕ Gλ(k) 6 ≈c m ⊕ uniform.
Then, for all λ ≥ 1, there exists a PPT TM adversary A such that ∣ ∣ ∣ ∣ (^) k←{Pr 0 , 1 }λ^ [A(m^ ⊕^ Gλ(k)) = 1]^ −^ y←{ 0 ,Pr 1 }poly(λ)^ [A(m^ ⊕^ y) = 1]
poly(λ)
Define the PPT TM B as the PPT TM adversary that first XORs its input with m and then does the same thing as A. It follows that B is a PPT TM adversary such that ∣ ∣ ∣ ∣ (^) k←{Pr 0 , 1 }λ^ [B(Gλ(k)) = 1]^ −^ y←{ 0 ,Pr 1 }poly(λ)^ [B(y) = 1]
poly(λ)
However, this means the PRG does not satisfy the definition of a PRG (Definition 2.14) which is a contradiction.
Theorem 2.20. The PRG-Based Stream Cipher is semantically secure.
Proof. Let E be the stream cipher (Definition 2.10). Denote its PRG as G (where we assume sufficiently large λ and cease denoting it). We therefore wish to prove ∀m 0 , m 1 ∈ M = { 0 , 1 }poly(n), P 1 m 0 ≈c P 2 m 1 where
P 1 m 0 = Pr k←K [E(k, m 0 )] P 2 m 1 = Pr k←K [E(k, m 1 )].
Let m 0 , m 1 ∈ M. Then
P rk←K[E(k, m 0 )] =P rk←K[m 0 ⊕ G(k)] ≈cP rk←M[m 0 ⊕ k] =P rk←M[m 1 ⊕ k] ≈cP rk←K[m 1 ⊕ G(k)] =P rk←K[E(m 1 , k)] ,
where the first and final equality are from the definition of the cipher stream, the com- putational indistinguishabilities follow from Lemma 2.19, and the middle equality is the property of bitwise addition with uniform randomness (see Lecture 1). As m 0 , m 1 ∈ M were arbitrary, for all m 0 , m 1 ∈ M, P 1 m 0 ≈ 2 c P 2 m 0. The factor of 2 in the subscript of the relation denotes needing ≈c twice in the chain of relations. We note this factor of 2 does not effect the Stream Cipher being computationally indistinguishable as the definition of com- putational indistinguishability is transitive by the triangle inequality and that the sum of negligible functions is also negligible. Thus, the PRG-based Stream Cipher is semantically secure.
In this lecture we began with the one-time pad which promises perfect security. Unfor- tunately, we showed that perfect security always requires the key space to be at least as large as the message space which is not practical for large messages. Motivated by this we
introduce the psuedorandom generator which takes a perfect secret key to a larger pseudo- random key. We then introduced the Stream Cipher encryption scheme which makes use of the pseudorandom generator to encrypt a larger message. As the pseudorandom generator cannot guarantee computational security, we introduced the weaker notion of semantic se- curity. In formalizing semantic security and the definition of a pseudorandom generator, we abstracted to the concept of computational indistinguishability which can then be used for definitions of cryptographic tools and different notions of security. Finally, we used compu- tational indistinguishability to prove the semantic security of the PRG-based stream cipher, combining all of the ideas presented in this lecture.
These scribe notes were prepared by editing a light modification of the template designed by Alexander Sherstov.
[1] J. Katz and Y. Lindell. Introduction to Modern Cryptography. Chapman and Hall/CRC Press, 2007.
[2] D. Khan. The Code Breakers. Macmillan, first edition, 1967.
[3] E. Kushilevitz and N. Nisan. Communication complexity. Cambridge University Press, 2nd edition, 2006.