PRPs and PRFs CS255: Winter 2017

Slides:



Advertisements
Similar presentations
Dan Boneh Using block ciphers Modes of operation: one time key Online Cryptography Course Dan Boneh example: encrypted , new key for every message.
Advertisements

Online Cryptography Course Dan Boneh
CS 483 – SD SECTION BY DR. DANIYAL ALGHAZZAWI (3) Information Security.
Cryptography: Review Day David Brumley Carnegie Mellon University.
1 PRPs and PRFs CS255: Winter Abstract ciphers: PRPs and PRFs, 2.Security models for encryption, 3.Analysis of CBC and counter mode Dan Boneh, Stanford.
Authenticated Encryption and Cryptographic Network Protocols David Brumley Carnegie Mellon University.
Cryptography: The Landscape, Fundamental Primitives, and Security David Brumley Carnegie Mellon University.
Dan Boneh Message Integrity A Parallel MAC Online Cryptography Course Dan Boneh.
1 Brief PRP-PRF Recap CS255 Winter ‘06. 2 PRPs and PRFs PRF: F: K  X  Y such that: exists “efficient” algorithm to eval. F(k,x) PRP: E: K  X  X such.
1 Message Integrity CS255 Winter ‘06. 2 Message Integrity Goal: provide message integrity. No confidentiality. –ex: Protecting public binaries on disk.
Cryptography Overview CS155. Cryptography Is A tremendous tool The basis for many security mechanisms Is not The solution to all security problems Reliable.
Dan Boneh Authenticated Encryption Definitions Online Cryptography Course Dan Boneh.
Dan Boneh Authenticated Encryption Chosen ciphertext attacks Online Cryptography Course Dan Boneh.
Dan Boneh Public Key Encryption from trapdoor permutations Public key encryption: definitions and security Online Cryptography Course Dan Boneh.
Dan Boneh Stream ciphers The One Time Pad Online Cryptography Course Dan Boneh.
CS555Spring 2012/Topic 111 Cryptography CS 555 Topic 11: Encryption Modes and CCA Security.
Dan Boneh Using block ciphers Modes of operation: many time key (CTR) Online Cryptography Course Dan Boneh Example applications: 1. File systems: Same.
CMSC 414 Computer and Network Security Lecture 5 Jonathan Katz.
Dan Boneh Using block ciphers Modes of operation: many time key (CBC) Online Cryptography Course Dan Boneh Example applications: 1. File systems: Same.
Cryptography: Block Ciphers David Brumely Carnegie Mellon University Credits: Slides originally designed by David Brumley. Many other slides are from Dan.
IND-CPA and IND-CCA Concepts Summary  Basic Encryption Security Definition: IND-CPA  Strong Encryption Security Definition: IND-CCA  IND-CPA, IND-CCA.
Cryptography Lecture 2 Arpita Patra. Summary of Last Class  Introduction  Secure Communication in Symmetric Key setting >> SKE is the required primitive.
Dan Boneh Message Integrity CBC-MAC and NMAC Online Cryptography Course Dan Boneh.
Cryptography: The Landscape, Fundamental Primitives, and Security David Brumley Carnegie Mellon University.
Lecture 23 Symmetric Encryption
Odds and ends Tweakable encryption
Cryptography: Review Day David Brumley Carnegie Mellon University.
Dan Boneh Odds and ends Deterministic Encryption Online Cryptography Course Dan Boneh.
CS555Spring 2012/Topic 81 Cryptography CS 555 Topic 8: Pseudorandom Functions and CPA Security.
Cryptography: Block Ciphers David Brumley Carnegie Mellon University Credits: Many slides from Dan Boneh’s June 2012 Coursera crypto class,
Online Cryptography Course Dan Boneh
Cryptography: Block Ciphers David Brumely Carnegie Mellon University Credits: Slides originally designed by David Brumley. Many other slides are from Dan.
Block Cipher Modes Last Updated: Aug 25, ECB Mode Electronic Code Book Divide the plaintext into fixed-size blocks Encrypt/Decrypt each block independently.
Block Cipher Encrypting a large message Electronic Code Book (ECB) message m1 m2 m3 m4 m5 m6 c1 c2 c3 c4 c5 c6 E E E Secret.
Symmetric-Key Cryptography CS 161: Computer Security Prof. Raluca Ada Popa Sept 13, 2016.
CS480 Cryptography and Information Security
Lecture 3 Overview of Cryptography A Practitioner Perspective
Using block ciphers Review: PRPs and PRFs
Secrecy of (fixed-length) stream ciphers
Cryptography Lecture 9.
Introduction to modern cryptology
Block Cipher Modes CS 465 Make a chart for the mode comparisons
Topic 11: Authenticated Encryption + CCA-Security
Cryptography Lecture 12.
Topic 5: Constructing Secure Encryption Schemes
B504/I538: Introduction to Cryptography
Cryptography Lecture 6.
Cryptography Lecture 10.
Topic 7: Pseudorandom Functions and CPA-Security
Cryptography Lecture 7 Arpita Patra © Arpita Patra.
Block cipher and modes of encryptions
Cryptography Lecture 7 Arpita Patra © Arpita Patra.
Cryptography Lecture 11.
Foundations of Network and Computer Security
Symmetric-Key Encryption
Block vs Stream Ciphers
Foundations of Network and Computer Security
Cryptography Lecture 12 Arpita Patra © Arpita Patra.
Cryptography Lecture 8.
Block Ciphers (Crypto 2)
Cryptography Lecture 11.
Cryptography Lecture 9.
Cryptography Lecture 12.
Cryptography Lecture 7.
Cryptography Lecture 10.
Cryptography Lecture 9.
Cryptography Lecture 11.
Cryptography Lecture 10.
Secret-Key Encryption
Presentation transcript:

PRPs and PRFs CS255: Winter 2017 Abstract block ciphers: PRPs and PRFs, Security models for encryption, Analysis of CBC and counter mode Dan Boneh, Stanford University

PRPs and PRFs Pseudo Random Function (PRF) defined over (K,X,Y): F: K  X  Y such that exists “efficient” algorithm to evaluate F(k,x) Pseudo Random Permutation (PRP) defined over (K,X): E: K  X  X such that: 1. Exists “efficient” algorithm to evaluate E(k,x) 2. The function E( k,  ) is one-to-one 3. Exists “efficient” inversion algorithm D(k,x)

Running example Example PRPs: 3DES, AES, … AES-128: K  X  X where K = X = {0,1}128 DES: K  X  X where X = {0,1}64 , K = {0,1}56 3DES: K  X  X where X = {0,1}64 , K = {0,1}168 Functionally, any PRP is also a PRF. A PRP is a PRF where X=Y and is efficiently invertible A PRP is sometimes called a block cipher

Secure PRFs Let F: K  X  Y be a PRF Funs[X,Y]: the set of all functions from X to Y SF = { F(k,) s.t. k  K }  Funs[X,Y] Intuition: a PRF is secure if a random function in Funs[X,Y] is indistinguishable from a random function in SF Funs[X,Y] Size |Y||X| SF Size |K|

Secure PRFs ??? Let F: K  X  Y be a PRF Funs[X,Y]: the set of all functions from X to Y SF = { F(k,) s.t. k  K }  Funs[X,Y] Intuition: a PRF is secure if a random function in Funs[X,Y] is indistinguishable from a random function in SF k  K f  Funs[X,Y] x  X ??? f(x) or F(k,x) ?

Secure PRF: defintion For b=0,1 define experiment EXP(b) as: b Def: F is a secure PRF if for all “efficient” A: AdvPRF[A,F] = |Pr[EXP(0)=1] – Pr[EXP(1)=1] | is “negligible.” b b=0: kK, f F(k,) b=1: fFuns[X,Y] Chal. Adv. A xi  X f(xi) b’  {0,1}

Secure PRP For b=0,1 define experiment EXP(b) as: b Def: E is a secure PRP if for all “efficient” A: AdvPRP[A,E] = |Pr[EXP(0)=1] – Pr[EXP(1)=1] | is “negligible.” b b=0: kK, f E(k,) b=1: fPerms[X] Chal. Adv. A xi  X f(xi) b’  {0,1}

Example secure PRPs Example secure PRPs: 3DES, AES, … AES256: K  X  X where X = {0,1}128 AES256 PRP Assumption (example) : All explicit 280–time algs A have PRP Adv[A, AES256] < 2-40 K = {0,1}256

PRF Switching Lemma Any secure PRP is also a secure PRF. Lemma: Let E be a PRP over (K,X) Then for any q-query adversary A: | AdvPRF[A,E] - AdvPRP[A,E] | < q2 / 2|X|  Suppose |X| is large so that q2 / 2|X| is “negligible” Then AdvPRP[A,E] “negligible”  AdvPRF[A,E] “negligible”

Using PRPs and PRFs Goal: build “secure” encryption from a PRP. Security is always defined using two parameters: 1. What “power” does adversary have? examples: Adv sees only one ciphertext (one-time key) Adv sees many PT/CT pairs (many-time key, CPA) 2. What “goal” is adversary trying to achieve? examples: Fully decrypt a challenge ciphertext. Learn info about PT from CT (semantic security) Today: we build ciphers that are semantically secure against one-time use And ciphers that are semantically secure against many-time use

Incorrect use of a PRP Electronic Code Book (ECB): Problem: if m1=m2 then c1=c2 PT: m1 m2 CT: c1 c2

In pictures (courtesy B. Preneel)

Modes of Operation for One-time Use Key Example application: Encrypted email. New key for every message.

Semantic Security for one-time key E = (E,D) a cipher defined over (K,M,C) For b=0,1 define EXP(b) as: Def: E is sem. sec. for one-time key if for all “efficient” A: AdvSS[A,E] = |Pr[EXP(0)=1] – Pr[EXP(1)=1] | is “negligible.” b Chal. Adv. A m0 , m1  M : |m0| = |m1| kK c  E(k, mb) b’  {0,1}

Semantic security (cont.) Sem. Sec.  no “efficient” adversary learns info about PT from a single CT. Example: suppose efficient A can deduce LSB of PT from CT. Then E = (E,D) is not semantically secure. b{0,1} m0, LSB(m0)=0 m1, LSB(m1)=1 Adv. B (us) Chal. kK The same holds for any predicate P where Pr[P(x)=0] is bounded away from 0 and 1. Adv. A (given) c E(k, mb) C LSB(mb)=b Then AdvSS[B, E] = 1  E is not sem. sec.

Note: ECB is not Sem. Sec. Electronic Code Book (ECB): Not semantically secure for messages that contain more than one block. b{0,1} Two blocks Chal. m0 = “Hello World” m1 = “Hello Hello” Adv. A kK (c1,c2)  E(k, mb) If c1=c2 output 0, else output 1 Then AdvSS[A, ECB] = 1

Secure Constructions  Examples of sem. sec. systems: 1. AdvSS[A, OTP] = 0 for all A 2. Deterministic counter mode from a PRF F : EDETCTR (k,m) = Stream cipher built from PRF (e.g. AES, 3DES) m[0] m[1] … F(k,0) F(k,1) m[L] F(k,L)  c[0] c[1] c[L]

Det. counter-mode security Theorem: For any L>0. If F is a secure PRF over (K,X,X) then EDETCTR is sem. sec. cipher over (K,XL,XL). In particular, for any adversary A attacking EDETCTR there exists a PRF adversary B s.t.: AdvSS[A, EDETCTR] = 2AdvPRF[B, F] AdvPRF[B, F] is negligible (since F is a secure PRF) ⇒ AdvSS[A, EDETCTR] must be negligible.

Modes of Operation for Many-time Key Example applications: 1. File systems: Same AES key used to encrypt many files. 2. IPsec: Same AES key used to encrypt many packets.

Semantic Security for many-time key (CPA security) Cipher E = (E,D) defined over (K,M,C). For b=0,1 define EXP(b) as: Def: E is sem. sec. under CPA if for all “efficient” A: AdvCPA [A,E] = |Pr[EXP(0)=1] – Pr[EXP(1)=1] | is “negligible.” for i=1,…,q: b Chal. Adv. kK mi,0 , mi,1  M : |mi,0| = |mi,1| ci  E(k, mi,b) b’  {0,1} if adv. wants c = E(k, m) it queries with mj,0= mj,1=m

Security for many-time key Fact: stream ciphers are insecure under CPA. More generally: if E(k,m) always produces same ciphertext, then cipher is insecure under CPA. If secret key is to be used multiple times  given the same plaintext message twice, the encryption alg. must produce different outputs. Chal. m0  M Adv. c0 E(k, m0) kK m0 , m1  M output 0 if c = c0 c  E(k, mb)

Nonce-based Encryption Alice Bob m, n E E(k,m,n)=c c, n D D(k,c,n)=m k k nonce n: a value that changes from msg to msg (k,n) pair never used more than once method 1: encryptor chooses a random nonce, n  N method 2: nonce is a counter (e.g. packet counter) used when encryptor keeps state from msg to msg if decryptor has same state, need not send nonce with CT File encryption: random nonce, no state from file to file SSL encrytpion (in order delivery): counter is fine, no need to send nonce to peer. IP sec (out of order delivery): counter is fine, but need to include nonce in every packet.

Construction 1: CBC with random nonce Cipher block chaining with a random IV (IV = nonce) IV m[0] m[1] m[2] m[3]     E(k,) E(k,) E(k,) E(k,) IV c[0] c[1] c[2] c[3] ciphertext note: CBC where attacker can predict the IV is not CPA-secure. HW.

CBC: CPA Analysis CBC Theorem: For any L>0, If E is a secure PRP over (K,X) then ECBC is a sem. sec. under CPA over (K, XL, XL+1). In particular, for a q-query adversary A attacking ECBC there exists a PRP adversary B s.t.: AdvCPA[A, ECBC]  2AdvPRP[B, E] + 2 q2 L2 / |X| Note: CBC is only secure as long as q2L2 << |X|

Construction 1’: CBC with unique nonce Cipher block chaining with unique IV (IV = nonce) unique IV means: (key,IV) pair is used for only one message IV m[0] m[1] m[2] m[3] E(k2,) IV′     E(k1,) E(k1,) E(k1,) E(k1,) IV c[0] c[1] c[2] c[3] included only if unknown to decryptor ciphertext

A CBC technicality: padding IV m[0] m[1] m[2] m[3] ll pad E(k1,) IV′     E(k,) E(k,) E(k,) E(k,) Solution: ciphertext stealing, but not discussed here. Later: when removing pad must verify its structure, otherwise Poodle attack. IV c[0] c[1] c[2] c[3] removed during decryption TLS: for n>0, n+1 byte pad is if no pad needed, add a dummy block n ⋯

Construction 2: rand ctr-mode msg IV m[0] m[1] … m[L]  F(k,IV) F(k,IV+1) … F(k,IV+L) IV c[0] c[1] … c[L] ciphertext IV - chosen at random for every message note: parallelizable (unlike CBC)

Construction 2’: nonce ctr-mode msg IV m[0] m[1] … m[L]  F(k,IV) F(k,IV+1) … F(k,IV+L) IV c[0] c[1] … c[L] ciphertext To ensure F(K,x) is never used more than once, choose IV as: nonce 128 bits counter IV: starts at 0 for every msg 64 bits 64 bits

rand ctr-mode: CPA analysis Randomized counter mode: random IV. Counter-mode Theorem: For any L>0, If F is a secure PRF over (K,X,X) then ECTR is a sem. sec. under CPA over (K,XL,XL+1). In particular, for a q-query adversary A attacking ECTR there exists a PRF adversary B s.t.: AdvCPA[A, ECTR]  2AdvPRF[B, F] + 2 q2 L / |X| Note: ctr-mode only secure as long as q2L << |X| Better then CBC !

An example AdvCPA [A, ECTR]  2AdvPRF[B, E] + 2 q2 L / |X| q = # messages encrypted with k , L = length of max msg Suppose we want AdvCPA[A, ECTR] ≤ q2 L /|X| ≤ 1/ 232 AES: |X| = 2128 ⇒ q L1/2 < 248 So, after 232 CTs each of len 232 , must change key (total of 264 AES blocks)

Comparison: ctr vs. CBC CBC ctr mode uses PRP PRF parallel processing No Yes Security of rand. enc. q^2 L^2 << |X| q^2 L << |X| dummy padding block 1 byte msgs (nonce-based) 16x expansion no expansion (for CBC, dummy padding block can be avoided using ciphertext stealing)

steam-ciphers det. ctr-mode Summary PRPs and PRFs: a useful abstraction of block ciphers. We examined two security notions: Semantic security against one-time CPA. Semantic security against many-time CPA. Note: neither mode ensures data integrity. Stated security results summarized in the following table: one-time key Many-time key (CPA) CPA and CT integrity Sem. Sec. steam-ciphers det. ctr-mode rand CBC rand ctr-mode later Power Goal