Private-Key Encryption

Similar documents
CPA-Security. Definition: A private-key encryption scheme

Computational security & Private key encryption

Dan Boneh. Stream ciphers. The One Time Pad

CTR mode of operation

Modern Cryptography Lecture 4

Modern symmetric-key Encryption

Block ciphers And modes of operation. Table of contents

Public Key Cryptography

COS433/Math 473: Cryptography. Mark Zhandry Princeton University Spring 2017

state-recovery analysis of spritz

Scribe for Lecture #5

CSA E0 235: Cryptography March 16, (Extra) Lecture 3

Codes and Cryptography. Jorge L. Villar. MAMME, Fall 2015 PART XII

III. Pseudorandom functions & encryption

Cryptography: The Landscape, Fundamental Primitives, and Security. David Brumley Carnegie Mellon University

Block Ciphers/Pseudorandom Permutations

Pseudorandom Generators

Notes for Lecture A can repeat step 3 as many times as it wishes. We will charge A one unit of time for every time it repeats step 3.

Lecture 7: CPA Security, MACs, OWFs

U.C. Berkeley CS276: Cryptography Luca Trevisan February 5, Notes for Lecture 6

Pr[C = c M = m] = Pr[C = c] Pr[M = m] Pr[M = m C = c] = Pr[M = m]

CS 290G (Fall 2014) Introduction to Cryptography Oct 23rdd, Lecture 5: RSA OWFs. f N,e (x) = x e modn

Solutions for week 1, Cryptography Course - TDA 352/DIT 250

Lecture 5, CPA Secure Encryption from PRFs

Lecture 6. Winter 2018 CS 485/585 Introduction to Cryptography. Constructing CPA-secure ciphers

Lecture 13: Private Key Encryption

CS 4770: Cryptography. CS 6750: Cryptography and Communication Security. Alina Oprea Associate Professor, CCIS Northeastern University

Public Key Cryptography

1 Number Theory Basics

Technische Universität München (I7) Winter 2013/14 Dr. M. Luttenberger / M. Schlund SOLUTION. Cryptography Endterm

Lecture 5: Pseudorandom functions from pseudorandom generators

CS 282A/MATH 209A: Foundations of Cryptography Prof. Rafail Ostrosky. Lecture 4

Lecture 4 - Computational Indistinguishability, Pseudorandom Generators

Question 2.1. Show that. is non-negligible. 2. Since. is non-negligible so is μ n +

Simple Unpredictable Pseudo-Random Number Generator

COS433/Math 473: Cryptography. Mark Zhandry Princeton University Spring 2017

CPSC 91 Computer Security Fall Computer Security. Assignment #3 Solutions

CS 6260 Applied Cryptography

Lectures 2+3: Provable Security

Cryptography 2017 Lecture 2

Chapter 11 : Private-Key Encryption

Computer Science A Cryptography and Data Security. Claude Crépeau

Lecture 9 - Symmetric Encryption

El Gamal A DDH based encryption scheme. Table of contents

INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR Stamp / Signature of the Invigilator

Block encryption of quantum messages

5 Pseudorandom Generators

Indistinguishability and Pseudo-Randomness

PERFECT SECRECY AND ADVERSARIAL INDISTINGUISHABILITY

6.080 / Great Ideas in Theoretical Computer Science Spring 2008

A Strong Identity Based Key-Insulated Cryptosystem

Pseudorandom Generators

Stream ciphers. Pawel Wocjan. Department of Electrical Engineering & Computer Science University of Central Florida

2 Message authentication codes (MACs)

Pseudo-Random Generators

Pseudo-Random Generators

1 What are Physical Attacks. 2 Physical Attacks on RSA. Today:

Chosen Plaintext Attacks (CPA)

Topics. Pseudo-Random Generators. Pseudo-Random Numbers. Truly Random Numbers

Lecture 11: Non-Interactive Zero-Knowledge II. 1 Non-Interactive Zero-Knowledge in the Hidden-Bits Model for the Graph Hamiltonian problem

Stream ciphers I. Thomas Johansson. May 16, Dept. of EIT, Lund University, P.O. Box 118, Lund, Sweden

1 Indistinguishability for multiple encryptions

Lecture 10 - MAC s continued, hash & MAC

A Pseudo-Random Encryption Mode

SYMMETRIC ENCRYPTION. Mihir Bellare UCSD 1

A Practical Attack Against the Use of RC4 in the HIVE Hidden Volume Encryption System

Lecture 17 - Diffie-Hellman key exchange, pairing, Identity-Based Encryption and Forward Security

Chair for Network Architectures and Services Institute of Informatics TU München Prof. Carle. Network Security. Chapter 2 Basics

Yale University Department of Computer Science

CS 6260 Applied Cryptography

Attack on Broadcast RC4

Lecture 2: Perfect Secrecy and its Limitations

On the Security of RC4 in TLS

Notes on Property-Preserving Encryption

Provable Security in Symmetric Key Cryptography

COS433/Math 473: Cryptography. Mark Zhandry Princeton University Spring 2017

Symmetric Encryption

COS433/Math 473: Cryptography. Mark Zhandry Princeton University Spring 2017

5 Public-Key Encryption: Rabin, Blum-Goldwasser, RSA

Permutation Generators Based on Unbalanced Feistel Network: Analysis of the Conditions of Pseudorandomness 1

CS 282A/MATH 209A: Foundations of Cryptography Prof. Rafail Ostrovsky. Lecture 7

Lectures One Way Permutations, Goldreich Levin Theorem, Commitments

Public-Key Cryptography. Lecture 9 Public-Key Encryption Diffie-Hellman Key-Exchange

ON CIPHERTEXT UNDETECTABILITY. 1. Introduction

Inaccessible Entropy and its Applications. 1 Review: Psedorandom Generators from One-Way Functions

VMPC One-Way Function and Stream Cipher

On the power of non-adaptive quantum chosen-ciphertext attacks

Provable security. Michel Abdalla

Some New Weaknesses in the RC4 Stream Cipher

On a new properties of random number sequences,a randomness test and a new RC4 s key scheduling algorithm.

Practice Final Exam Winter 2017, CS 485/585 Crypto March 14, 2017

Lecture 5: Pseudo-Random Generators and Pseudo-Random Functions

Differential Cryptanalysis of the Stream Ciphers Py, Py6 and Pypy

Lecture 2: Program Obfuscation - II April 1, 2009

Codes and Cryptography. Jorge L. Villar. MAMME, Fall 2015 PART XI

STREAM CIPHER. Chapter - 3

Lecture 6. 2 Adaptively-Secure Non-Interactive Zero-Knowledge

Unforgeable quantum encryption. Christian Majenz Joint work with Gorjan Alagic and Tommaso Gagliardoni

Lecture 7: Pseudo Random Generators

Lecture 1: Perfect Secrecy and Statistical Authentication. 2 Introduction - Historical vs Modern Cryptography

Transcription:

Private-Key Encryption Ali El Kaafarani Mathematical Institute Oxford University 1 of 37

Outline 1 Pseudo-Random Generators and Stream Ciphers 2 More Security Definitions: CPA and CCA 3 Pseudo-Random Functions/Permutations 2 of 37

Outline 1 Pseudo-Random Generators and Stream Ciphers 2 More Security Definitions: CPA and CCA 3 Pseudo-Random Functions/Permutations 3 of 37

Pseudo-Random Generators PRGs Pseudorandomness is a property of a distribution on strings. Say you have a distribution X on l-bit strings that assigns some probability to every string in {0, 1} l. Pseudorandomness means that sampling form X is indistinguishable from sampling a uniform string of length l. Ideally, we want a PRG to efficiently produce, from short seeds, long sequences of bits that appear to be generated by successive flips of a fair coin. Unpredictability is a very important property of sequences of coin tosses. Pseudo-random sequences should be unpredictable to computers with feasible resources. Given a sequence of (n 1) bits, can you guess the n th bit with a probability better than 1/2? 4 of 37

Pseudo-Random Generators PRGs Pseudorandomness is a property of a distribution on strings. Say you have a distribution X on l-bit strings that assigns some probability to every string in {0, 1} l. Pseudorandomness means that sampling form X is indistinguishable from sampling a uniform string of length l. Ideally, we want a PRG to efficiently produce, from short seeds, long sequences of bits that appear to be generated by successive flips of a fair coin. Unpredictability is a very important property of sequences of coin tosses. Pseudo-random sequences should be unpredictable to computers with feasible resources. Given a sequence of (n 1) bits, can you guess the n th bit with a probability better than 1/2? 4 of 37

Pseudo-Random Generators PRGs Pseudorandomness is a property of a distribution on strings. Say you have a distribution X on l-bit strings that assigns some probability to every string in {0, 1} l. Pseudorandomness means that sampling form X is indistinguishable from sampling a uniform string of length l. Ideally, we want a PRG to efficiently produce, from short seeds, long sequences of bits that appear to be generated by successive flips of a fair coin. Unpredictability is a very important property of sequences of coin tosses. Pseudo-random sequences should be unpredictable to computers with feasible resources. Given a sequence of (n 1) bits, can you guess the n th bit with a probability better than 1/2? 4 of 37

Pseudo-Random Generators PRGs A PRG is an efficient deterministic algorithm that expands a short, uniform seed into a longer, uniform-looking output. Informally, a PRG is cryptographically secure, if it passes all efficient statistical tests. Definition Let G : {0, 1} n {0, 1} l(n) a deterministic polynomial-time algorithm where l(n) > n. G is a secure pseudorandom generator if probabilistic poly-time distinguisher (also called statistical test) D, the advantage Adv prg G,D (n) = Pr[D(r) = 1] Pr[D(G(s)) = 1] negl(n) where the probabilities are taken over uniform choice of s {0, 1} n, r {0, 1} l(n) and the randomness of D. 5 of 37

Pseudo-Random Generators PRGs A PRG is an efficient deterministic algorithm that expands a short, uniform seed into a longer, uniform-looking output. Informally, a PRG is cryptographically secure, if it passes all efficient statistical tests. Definition Let G : {0, 1} n {0, 1} l(n) a deterministic polynomial-time algorithm where l(n) > n. G is a secure pseudorandom generator if probabilistic poly-time distinguisher (also called statistical test) D, the advantage Adv prg G,D (n) = Pr[D(r) = 1] Pr[D(G(s)) = 1] negl(n) where the probabilities are taken over uniform choice of s {0, 1} n, r {0, 1} l(n) and the randomness of D. 5 of 37

Pseudo-Random Generators PRGs A PRG is an efficient deterministic algorithm that expands a short, uniform seed into a longer, uniform-looking output. Informally, a PRG is cryptographically secure, if it passes all efficient statistical tests. Definition Let G : {0, 1} n {0, 1} l(n) a deterministic polynomial-time algorithm where l(n) > n. G is a secure pseudorandom generator if probabilistic poly-time distinguisher (also called statistical test) D, the advantage Adv prg G,D (n) = Pr[D(r) = 1] Pr[D(G(s)) = 1] negl(n) where the probabilities are taken over uniform choice of s {0, 1} n, r {0, 1} l(n) and the randomness of D. 5 of 37

Pseudo-Random Generators Do PRGs exist? Can we construct them? Not if NP = P What is the weakest assumption under which we can construct PRGs? It is the existence of one-way functions (i.e. easy to computehard to invert) 6 of 37

Pseudo-Random Generators Do PRGs exist? Can we construct them? Not if NP = P What is the weakest assumption under which we can construct PRGs? It is the existence of one-way functions (i.e. easy to computehard to invert) 6 of 37

Pseudo-Random Generators Do PRGs exist? Can we construct them? Not if NP = P What is the weakest assumption under which we can construct PRGs? It is the existence of one-way functions (i.e. easy to computehard to invert) 6 of 37

Pseudo-Random Generators Do PRGs exist? Can we construct them? Not if NP = P What is the weakest assumption under which we can construct PRGs? It is the existence of one-way functions (i.e. easy to computehard to invert) 6 of 37

PRG: examples Linear Congruential Generator (Non-Crypto PRG) X n+1 = ax n + b mod m, where a, b, m are the constants and X 0 is the seed. Cryptographically suitable PRGs: /dev/random, Fortuna, Intel RdRand (available in Ivy Bridge processors), etc. They continuously add entropy to internal state Example of entropy source: Timing (hardware interrupts, e.g. keyboard, mouse, etc.). 7 of 37

Security of PRGs Attackers abilities: What they can observe or influence/manipulate in the inputs/outputs/state. Types of attacks: Input Based Attacks (security goals: minimize the number of possible outputs, so guessing becomes easier, or force the generator to produce a particular output), State Based attacks (security goals: backward/forward secrecy, i.e. predict past/future outputs). 8 of 37

Remember, the goal is to make our secure OTP practical... OTP is perfectly secure. But k m...! What if we use pseudo-random generators? And use a different security definition... (t, ɛ)-indistinguishability: We allow that the security may fail with probability ɛ and we restrict attention to adversaries running in time t. This is the basic idea of a new security definition called semantic security or indistinguishable encryptions! Perhaps we can now encrypt a 1 MB file using only 128-bit key! 9 of 37

Remember, the goal is to make our secure OTP practical... OTP is perfectly secure. But k m...! What if we use pseudo-random generators? And use a different security definition... (t, ɛ)-indistinguishability: We allow that the security may fail with probability ɛ and we restrict attention to adversaries running in time t. This is the basic idea of a new security definition called semantic security or indistinguishable encryptions! Perhaps we can now encrypt a 1 MB file using only 128-bit key! 9 of 37

Remember, the goal is to make our secure OTP practical... OTP is perfectly secure. But k m...! What if we use pseudo-random generators? And use a different security definition... (t, ɛ)-indistinguishability: We allow that the security may fail with probability ɛ and we restrict attention to adversaries running in time t. This is the basic idea of a new security definition called semantic security or indistinguishable encryptions! Perhaps we can now encrypt a 1 MB file using only 128-bit key! 9 of 37

Remember, the goal is to make our secure OTP practical... OTP is perfectly secure. But k m...! What if we use pseudo-random generators? And use a different security definition... (t, ɛ)-indistinguishability: We allow that the security may fail with probability ɛ and we restrict attention to adversaries running in time t. This is the basic idea of a new security definition called semantic security or indistinguishable encryptions! Perhaps we can now encrypt a 1 MB file using only 128-bit key! 9 of 37

Remember, the goal is to make our secure OTP practical... OTP is perfectly secure. But k m...! What if we use pseudo-random generators? And use a different security definition... (t, ɛ)-indistinguishability: We allow that the security may fail with probability ɛ and we restrict attention to adversaries running in time t. This is the basic idea of a new security definition called semantic security or indistinguishable encryptions! Perhaps we can now encrypt a 1 MB file using only 128-bit key! 9 of 37

Remember, the goal is to make our secure OTP practical... OTP is perfectly secure. But k m...! What if we use pseudo-random generators? And use a different security definition... (t, ɛ)-indistinguishability: We allow that the security may fail with probability ɛ and we restrict attention to adversaries running in time t. This is the basic idea of a new security definition called semantic security or indistinguishable encryptions! Perhaps we can now encrypt a 1 MB file using only 128-bit key! 9 of 37

Remember, the goal is to make our secure OTP practical... OTP is perfectly secure. But k m...! What if we use pseudo-random generators? And use a different security definition... (t, ɛ)-indistinguishability: We allow that the security may fail with probability ɛ and we restrict attention to adversaries running in time t. This is the basic idea of a new security definition called semantic security or indistinguishable encryptions! Perhaps we can now encrypt a 1 MB file using only 128-bit key! 9 of 37

Fixed-length Encryption scheme using a PRG Let G be a pseudorandom generator with expansion factor l. For messages of length l, we define the following encryption scheme E = (KeyGen, Enc, Dec): KeyGen(n) : It randomly picks random bit string of length n, i.e. k {0, 1} n. Enc : it takes as input a key k {0, 1} n and a message m {0, 1} l(n), it outputs c Enc(G(k), m) = G(k) m Dec : it takes as input a key k {0, 1} n and a ciphertext c {0, 1} l(n), it outputs m Dec(G(k), c) = G(k) c. 10 of 37

Semantic Security Security Game Challenger Ch b $ {0, 1} Definition m 0,m 1, m 0 = m 1 Adversary A c=enc(k,m b) Outputs his guess b An encryption scheme is semantically secure if for all efficient A the following holds: Adv eav E,A(n) = Pr[A wins] 1/2 negl(n) What about security for multiple encryptions? 11 of 37

Semantic Security (also called Computational indistinguishability) More formally, Let us distinguish between the two cases of b = 0 or b = 1. Call the first EXP(0) and the second EXP(1). For b = 0, 1, let G b be the event that the output of the experiment EXP(b)=1. Now Adv ss E,A(n) = Pr(G 0 ) Pr(G 1 ) 12 of 37

Theorem If G is a secure PRG, then the encryption scheme derived from G is semantically secure. Lemma If A is an adversary against a semantic secure encryption scheme E, then there exists an adversary B against the PRG G of E s.t. Adv ss E,A(n) 2 Adv prg G,B (n) 13 of 37

Proof. (By reduction) Let G b the event that the adversary outputs b = 1 if the challenger uses the PRG while encrypting and R b is the same but when using a truly random generator. Adv ss E,A(n) = Pr(G 0 ) Pr(G 1 ) = Pr(G 0 ) Pr(R 0 ) + Pr(R 0 ) Pr(R 1 ) + Pr(R 1 ) Pr(G 1 ) Pr(G 0 ) Pr(R 0 ) + Pr(R 0 ) Pr(R 1 ) }{{} = 0 as OTP is sem. secure. + Pr(R 1 ) Pr(G 1 ) = 2Adv prg G,B (n). 14 of 37

Stream Ciphers Terminology is not standard: it is either considered to be practical instantiations of pseudo-random generators or the encryption scheme which uses it. They produce as many random bits as exactly needed. They are more flexible (no upper bound on the number of bits) and efficient (each application takes the exact number of random bits that it requests) A stream cipher consists of two main deterministic algorithms: Init(s, IV): takes a seed s and an optional initialization vector IV and outputs an initial state st 0 GetBits(st i ): takes the i-th state information st i and outputs a bit y and an updated state, i.e. st i+1 14 of 37

Stream Ciphers Construction of a PRG G l : st0 Init(s, IV) for i = 1,, l; (y i, st i ) GetBits(st i 1 ) return y 1,, y l 15 of 37

Stream Cipher Mode of Operations 16 of 37

Stream Cipher Modes of Operations synchronized mode. It gives a stateful CPA-secure encryption scheme. Sender and Receiver must be synchronized. It generates a long pseudo-random stream- different parts of it are used to encrypt different messages. Therefore, messages should be received in order. unsynchronized mode. It needs initialization vectors. It gives stateless CPA-secure encryption. 17 of 37

Examples of Stream Ciphers Linear-Feedback Shift Registers (LFSR) RC4 by Ron Rivest 1987 (recent attack: AlFardan et al. 2013) estream: Salsa 20, ChaCha (2008), and SOSEMANUK. estream competition page: http://competitions.cr.yp.to/estream.html 18 of 37

RC4 The state in RC4 consists of the triplet (S, i, j). S is a 256-byte array that contains a permutation of the numbers 0,, 255. both i, j {0,, 255}. The key can be up to 256 byte long. Demo: http://www.usafa.edu/df/dfe/dfer/centers/ accr/tools/rc4cipherapplet.html 19 of 37

RC4- the Init() algorithm Input: a 16-byte key Output: Initial state (S, i, j) for i = 1,, 255 : S[i] i it sets S to the identity permutation k[i] k[i mod 16] it expands the key to 256 bytes by repetition j = 0 for i = 1,, 255; j j + S[i] + k[i] mod 256 Swap S[i] and S[j] pseudo-random swapping of S s elements i 0, j 0 return (S, i, j) 20 of 37

RC4- the GetBits() algorithm Input: Current state (S, i, j) Output: byte y, updated state (S, i, j) i i + 1 mod 256 j j + S[i] mod 256 changing j in a pseudo-random way Swap S[i] and S[j] t S[i] + S[j] mod 256 y S[t] return (S, i, j), y 21 of 37

RC4: Security Analysis Weaknesses in its key scheduling algorithm, i.e. the Init() algorithm. Biases in the second output byte of RC4: the probability that it is 0 is 1/128 instead of 1/256 for S = 256. Biases in further bytes: double-byte or adjacent-byte biases. Conclusion: not secure, nevertheless, its usage is still running at about 30% of all TLS traffic (Garman et al. March 2015) 22 of 37

RC4: Security Analysis [AlFardan et al. 2013] Figure: Recovery rate of the single-byte bias attack (based on 256 experiments) 23 of 37

More security definitions are needed... Stream ciphers are semantically secure. But what about multiple encryptions? What if the adversary wants to be challenged on two vectors of messages instead of two single messages? Obviously, he can trivially win the game (why?) Conclusion: deterministic encryption schemes are NOT secure under the multiple encryptions model. 24 of 37

More security definitions are needed... Stream ciphers are semantically secure. But what about multiple encryptions? What if the adversary wants to be challenged on two vectors of messages instead of two single messages? Obviously, he can trivially win the game (why?) Conclusion: deterministic encryption schemes are NOT secure under the multiple encryptions model. 24 of 37

CPA Indistinguishability Experiment PrivK cpa A,E Challenger Ch Adversary A k = KeyGen(n) Access to an oracle Enc(k, ) b {0, 1} Definition m 0,m 1, m 0 = m 1 c=enc(k,m b) Outputs his guess b An encryption scheme is CPA-secure if for all efficient A the following holds: Adv cpa A,E (n) = Pr[PrivKcpa A,E (n) = 1] 1/2 = negl(n) Where PrivK cpa A,E (n) = 1 if b = b, and 0 otherwise. Note: CPA-secure CPA secure for multiple encryptions. 25 of 37

CCA Indistinguishability Experiment PrivK cca A,E Challenger Ch Adversary A k = KeyGen(n) Access to two oracles Enc(k, ), Dec(k, ) b {0, 1} m 0,m 1, m 0 = m 1 Definition c=enc(k,m b) Access to two oracles Enc(k, ), Dec(k, ) c Outputs his guess b An encryption scheme is CCA-secure if for all efficient A the following holds: Adv cca A,E(n) = Pr[PrivK cca A,E(n) = 1] 1/2 = negl(n) 26 of 37

Outline 1 Pseudo-Random Generators and Stream Ciphers 2 More Security Definitions: CPA and CCA 3 Pseudo-Random Functions/Permutations 27 of 37

Pseudo-Random Functions A generalization of the notion of pseudo-random generators. We now consider a random-looking function. It is the pseudo-randomness of a distribution on functions. We are interested in keyed functions, i.e. F : {0, 1} {0, 1} {0, 1}. Once we choose k, we fix it, and then use F k : {0, 1} {0, 1}. F is length-preserving if the lengths of the key, input, output are equal. F is pseudo-random if the function F k, for a uniform key k, is indistinguishable from a function chosen uniformally at random from the set of all functions with the same domain and range. 28 of 37

Pseudo-Random Functions Definition Let Func[X, Y] be the set of all functions from X to Y. A function F : K X Y is a secure Pseudo-Random Function (PRF) if F is efficiently computable and for all PPT distinguishers A Adv prf F,A (n) = Pr[AF() (n) = 1] Pr[A F k() (n) = 1] < negl(n) where F Func[X, Y], k K, and A has access to the function in question, i.e. either F() and F k (). Note that Func[X, Y] = X Y. 29 of 37

Pseudo-Random Permutations A pseudo-random function F : K X Y is an efficient pseudo-random permutation if the following hold: F is injective and X = Y. F is deterministic and efficiently computable. F 1 is efficiently computable. In practice: F : {0, 1} k {0, 1} n {0, 1} n, where; 3DES: n = 64 bits, k = 168 bits AES: n = 128 bits, k = 128, 192, 256 bits 30 of 37

Pseudo-Random Permutations A pseudo-random function F : K X Y is an efficient pseudo-random permutation if the following hold: F is injective and X = Y. F is deterministic and efficiently computable. F 1 is efficiently computable. In practice: F : {0, 1} k {0, 1} n {0, 1} n, where; 3DES: n = 64 bits, k = 168 bits AES: n = 128 bits, k = 128, 192, 256 bits 30 of 37

Encryption using PRP Let F : {0, 1} n {0, 1} n {0, 1} n be a pseudo-random permutation. We define the following encryption scheme E = (KeyGen, Enc, Dec): KeyGen : it takes n and outputs a key k {0, 1} n. Enc: it takes a key k {0, 1} n and message m, it picks a random r {0, 1} n, and outputs (c 0, c 1 ) (r, F k (r) m). Dec: it takes a key k and a ciphertext c = (c 0, c 1 ) and outputs m (F k (c 0 ) c 1 ). 31 of 37

Theorem If F is a pseudo-random permutation then the encryption scheme E is CPA-secure. Proof. We will first prove that a version E of this encryption scheme would be indeed CPA-secure if the function F was truly random, and then show that if E was insecure then we can distinguish F from a truly random function. For E, there are two cases: r c didn t appear in any of the encryption queries, and therefore the probability to win the game in this case is exactly 1/2. r c appeared in at least one of the queries. Assuming that the adversary is restricted to q(n) queries, then the probability of this event is at most q(n)/2 n. Thus Pr[PrivK cpa A,E (n) = 1] 1/2 + q(n)/2 n. 32 of 37

Proof. F is a PRP Pr[A F() (n) = 1] Pr[A F k() (n) = 1] < negl(n) One can easily see that Pr[PrivK cpa A,E (n) = 1] = Pr[A F() (n) = 1] and Pr[PrivK cpa A,E (n) = 1] = Pr[AF k() (n) = 1]. Thus Therefore Pr[PrivK cpa A,E (n) = 1] Pr[PrivKcpa A,E (n) = 1] negl(n) Pr[PrivK cpa A,E (n) = 1] 1/2 + q(n)/2n + negl(n). 33 of 37

Strong Pseudo-Random Permutations Definition Let Perm n be the set of all permutations from {0, 1} n to {0, 1} n. Let f : {0, 1} n {0, 1} n {0, 1} n be an efficient length-preserving, keyed permutation. f is a strong pseudo-random permutation if for all probabilistic polynomial-time distinguishers D, there exists a negligible function negl such that Pr[D f (),f 1 () (n) = 1] Pr[D f k(),f 1 k () (n) = 1] < negl(n) where f R Perm n, k R {0, 1} k, and D has access to the functions in question, i.e. either f (), f 1 () and f k (), f 1 k (). Notes: Strong PRP PRP Perm n = 2 n! 34 of 37

Further Reading (1) Nadhem J AlFardan, Daniel J Bernstein, Kenneth G Paterson, Bertram Poettering, and Jacob CN Schuldt. On the security of RC4 in TLS. In USENIX Security, pages 305 320, 2013. Boaz Barak and Shai Halevi. A model and architecture for pseudo-random generation with applications to/dev/random. In Proceedings of the 12th ACM conference on Computer and communications security, pages 203 212. ACM, 2005. Daniel J Bernstein. The Salsa20 Family of Stream Ciphers. In New stream cipher designs, pages 84 97. Springer, 2008. 35 of 37

Further Reading (2) Lenore Blum, Manuel Blum, and Mike Shub. A simple unpredictable pseudo-random number generator. SIAM Journal on computing, 15(2):364 383, 1986. Christian Cachin. Entropy measures and unconditional security in cryptography. PhD thesis, SWISS FEDERAL INSTITUTE OF TECHNOLOGY ZURICH, 1997. Scott Fluhrer, Itsik Mantin, and Adi Shamir. Weaknesses in the key scheduling algorithm of RC4. In Selected areas in cryptography, pages 1 24. Springer, 2001. 36 of 37

Further Reading (3) Christina Garman, Kenneth G Paterson, and Thyla van der Merwe. Attacks only get better: Password recovery attacks against RC4 in TLS. 2015. Itsik Mantin and Adi Shamir. A practical attack on broadcast RC4. In Fast Software Encryption, pages 152 164. Springer, 2002. 37 of 37