SLIDE 1
MIT 6.875 & Berkeley CS276
Lecture 2 Foundations of Cryptography
SLIDE 2 Administrivia
- Piazza Time-zone Survey & Office hours
- PS1 Released, due Sept 15
SLIDE 3 The Secure Communication Problem
Alice Key k
- Alice and Bob have a common key k
Bob Key k Eve
- Algorithms (Gen, Enc, Dec)
- Correctness: Dec(k, Enc(k,m)) = m
- Security: No Eve learns anything about m.
m
SLIDE 4
How to Define Security
Perfect secrecy: A Posteriori = A Priori Perfect indistinguishability: The two definitions are equivalent! For all ๐, ๐: Pr ๐ = ๐ ๐น ๐ฟ, ๐ = ๐] = Pr[๐ = ๐] For all ๐!, ๐", ๐: Pr[๐น ๐ฟ, ๐! = ๐] = Pr[๐น ๐ฟ, ๐" = ๐]
SLIDE 5 Is there a perfectly secure scheme?
- One-time Pad: ๐น ๐, ๐ = ๐โจ๐
- However: Keys are as long as Messages
- WORSE, Shannonโs theorem:
for any perfectly secure scheme, |key|โฅ|message|.
Can we overcome Shannonโs conundrum?
SLIDE 6
Letโs first rewriteโฆ
Perfect indistinguishability: as a Turing test For all ๐!, ๐", ๐: Pr[๐น ๐ฟ, ๐! = ๐] = Pr[๐น ๐ฟ, ๐" = ๐] World 0: World 1: ๐ = ๐น ๐, ๐! ๐ = ๐น ๐, ๐" is a distinguisher. For all EVE and all ๐!, ๐": Pr ๐ โ K; ๐ = ๐น ๐, ๐! : ๐น๐๐น ๐ = 0 = Pr ๐ โ K; ๐ = ๐น ๐, ๐" : ๐น๐๐น ๐ = 0 k โ K k โ K
SLIDE 7
Letโs first rewriteโฆ
Perfect indistinguishability: as a Turing test For all ๐!, ๐", ๐: Pr[๐น ๐ฟ, ๐! = ๐] = Pr[๐น ๐ฟ, ๐" = ๐] World 0: World 1: ๐ = ๐น ๐, ๐! ๐ = ๐น ๐, ๐" is a distinguisher. For all EVE and all ๐!, ๐": Pr ๐ โ K; ๐ โ 0,1 ; ๐ = ๐น ๐, ๐# : ๐น๐๐น ๐ = ๐ = 1/2 k โ K k โ K
SLIDE 8 The Axiom of Modern Crypto
Feasible Computation = Probabilistic polynomial-time*
(p.p.t. = Probabilistic polynomial-time) So, Alice and Bob are fixed p.p.t. algorithms. (e.g., run in time n^2) Eve is any p.p.t. algorithm. (e.g., run in time n^4, or n^100, or n^10000,โฆ)
* in recent years, quantum polynomial-time
(polynomial in a security parameter n)
SLIDE 9
Computational Indistinguishability
World 0: World 1: ๐ = ๐น ๐, ๐! ๐ = ๐น ๐, ๐" is a p.p.t. distinguisher. For all p.p.t. EVE and all ๐!, ๐": Pr ๐ โ K; ๐ โ 0,1 ; ๐ = ๐น ๐, ๐# : ๐น๐๐น ๐ = ๐ = 1/2 k โ K k โ K Still subject to Shannonโs impossibility!
(take 1)
SLIDE 10 Still subject to Shannonโs impossibility! c
Set of messages consistent with c = {D(k,c): all k} Messages n+1 bits
๐! ๐"
ciphertexts
Consider Eve that picks a random key k and
- utputs 0 if D(k,c) = ๐!
- utputs 1 if D(k,c) = ๐"
and a random bit if neither holds. w.p โฅ ๐/๐๐ w.p = 0 Bottomline: Pr[EVE succeeds] โฅ 1/2 + 1/2%
SLIDE 11
New Notion: Negligible Functions
Functions that grow slower than 1/p(n) for any polynomial p. Definition: A function ๐: โ โ โ is negligible if for every polynomial function p, for all sufficiently large n: ๐(n) < 1/p(n) there exists an ๐! s.t. for all ๐ > ๐!: Key property: Events that occur with negligible probability look to poly-time algorithms like they never occur.
SLIDE 12
New Notion: Negligible Functions
Functions that grow slower than 1/p(n) for any polynomial p. Definition: A function ๐: โ โ โ is negligible if for every polynomial function p, for all sufficiently large n: ๐(n) < 1/p(n) there exists an ๐! s.t. for all ๐ > ๐!: Question: Let ๐ ๐ = ๐/๐๐ฆ๐ฉ๐ก ๐. Is ๐ negligible?
SLIDE 13
New Notion: Negligible Functions
Functions that grow slower than 1/p(n) for any polynomial p. Definition: A function ๐: โ โ โ is negligible if for every polynomial function p, for all sufficiently large n: ๐(n) < 1/p(n) there exists an ๐! s.t. for all ๐ > ๐!: Question: Let ๐ ๐ = ๐/๐๐๐๐ if n is prime and ๐ ๐ = ๐/๐๐ otherwise. Is ๐ negligible?
SLIDE 14
Computational Indistinguishability
World 0: World 1: ๐ = ๐น ๐, ๐! ๐ = ๐น ๐, ๐" is a distinguisher. For all p.p.t. EVE, there is a negligible function ๐ s.t. for all ๐!, ๐": Pr ๐ โ K; ๐ โ 0,1 ; ๐ = ๐น ๐, ๐# : ๐น๐๐น ๐ = ๐ โค 1 2 + ๐(๐) k โ K k โ K
SLIDE 15
Our First Crypto Tool: Pseudorandom Generators (PRG)
SLIDE 16
PRG Definition
A function ๐ป: {0,1}%โ {0,1}%+" is a pseudorandom generator if for no p.p.t. EVE can distinguish between ๐ป(๐%) and ๐%+". ๐%= uniform distribution on n bits. ๐%+"= uniform distribution on n+1 bits.
SLIDE 17
PRG Definition
A function ๐ป: {0,1}%โ {0,1}%+" is a pseudorandom generator if for for all p.p.t. EVE, there is a negligible function ๐ s.t. |Pr ๐ง โ ๐%+": ๐น๐๐น ๐ง = 0 โ Pr[๐ฆ โ ๐%; y = G x : EVE y = 0]| โค ๐(n) Question: What happens to this de_inition if EVE is unbounded?
SLIDE 18
PRG โน Overcoming Shannonโs Conundrum
๐ป๐๐ 1% : Generate a random ๐-bit key k. ๐น๐๐ ๐, ๐ where ๐ is an (๐ + ๐)-bit message: Expand k into a (n+1)-bit pseudorandom string k, = ๐ป(k) One-time pad with k,: ciphertext is ๐โฒโจ๐ ๐ธ๐๐ ๐, ๐ outputs G(๐)โจ๐ (or, How to Encrypt n+1 bits using an n-bit key) ๐๐ฉ๐ฌ๐ฌ๐๐๐ฎ๐จ๐๐ญ๐ญ: ๐ธ๐๐ ๐, ๐ outputs G ๐ โจ๐ = G ๐ โจ๐ป ๐ โจm = m
SLIDE 19
PRG โน Overcoming Shannonโs Conundrum
Suppose for contradiction that there is a p.p.t. EVE, a polynomial function ๐ and ๐!, ๐" ๐ก. ๐ข. Pr ๐ โ K; ๐ โ 0,1 ; ๐ = ๐น ๐, ๐# : ๐น๐๐น ๐ = ๐ โฅ 1 2 + 1/๐(๐)
Security: by contradiction.
SLIDE 20 PRG โน Overcoming Shannonโs Conundrum
Suppose for contradiction that there is a p.p.t. EVE, a polynomial function ๐ and ๐!, ๐" ๐ก. ๐ข. ฯ = Pr ๐ โ {0,1}% ; ๐ โ 0,1 ; ๐ = ๐ป(๐)โจ๐#: ๐น๐๐น ๐ = ๐ โฅ 1 2 + 1/๐(๐)
Security: by contradiction.
Let ฯ, = Pr ๐โฒ โ 0,1 %+" ; ๐ โ 0,1 ; ๐ = ๐โฒโจ๐#: ๐น๐๐น ๐ = ๐ = "
- This will give us a distinguisher EVEโ for G, contradicting the
assumption that G is a pseudorandom generator. QED.
SLIDE 21 PRG โน Overcoming Shannonโs Conundrum
Get as input a string y, run EVE(yโจ๐#) for a random b, and let EVEโs
- utput be bโ. Output โPRGโ if b=bโ and โRANDOMโ otherwise.
Distinguisher EVEโ for G.
Pr ๐น๐๐น,๐๐ฃ๐ข๐๐ฃ๐ข๐ก โ๐๐๐ปโ ๐ง ๐๐ก ๐๐ก๐๐ฃ๐๐๐ ๐๐๐๐๐] = ฯ โฅ "
Pr ๐น๐๐น,๐๐ฃ๐ข๐๐ฃ๐ข๐ก โ๐๐๐ปโ ๐ง ๐๐ก ๐ ๐๐๐๐๐] = ฯ, = 1 2 Therefore, Pr ๐น๐๐น,๐๐ฃ๐ข๐๐ฃ๐ข๐ก โ๐๐๐ปโ ๐ง ๐๐ก ๐๐ก๐๐ฃ๐๐๐ ๐๐๐๐๐] โ Pr ๐น๐๐น,๐๐ฃ๐ข๐๐ฃ๐ข๐ก โ๐๐๐ปโ ๐ง ๐๐ก ๐ ๐๐๐๐๐] โฅ 1/๐(๐)
SLIDE 22
PRG โน Overcoming Shannonโs Conundrum
๐น๐:
Do PRGs exist? (or, How to Encrypt n+1 bits using an n-bit key)
๐น๐:
(Exercise: If P=NP, PRGs do not exist.) How do we encrypt ๐"!! message bits with ๐ key bits? (Length extension: If there is a PRG that stretches by one bit, there is one that stretches by polynomially many bits)
SLIDE 23 Constructing PRGs: Two Methodologies
The Practical Methodology
- 1. Start from a design framework
(e.g. โappropriately chosen functions composed appropriately many times look randomโ)
SLIDE 24 Constructing PRGs: Two Methodologies
The Practical Methodology
- 1. Start from a design framework
(e.g. โappropriately chosen functions composed appropriately many times look randomโ)
- 2. Come up with a candidate construction
MA MATH TH Rijndael (now the Advanced Encryption Standard)
SLIDE 25 Constructing PRGs: Two Methodologies
The Practical Methodology
- 1. Start from a design framework
(e.g. โappropriately chosen functions composed appropriately many times look randomโ)
- 2. Come up with a candidate construction
- 3. Do extensive cryptanalysis.
SLIDE 26 Constructing PRGs: Two Methodologies
The Foundational Methodology (much of this course) Reduce to simpler primitives. OWF well-studied, average-case hard, problems โScience wins either wayโ โSilvio Micali PRG PRF
Hashing Digital Signatures
SLIDE 27 Constructing PRGs: Two Methodologies
The Foundational Methodology (much of this course) A PRG Candidate from the hardness of Subset-sum: G(๐", โฆ , ๐%, ๐ฆ", โฆ , ๐ฆ%) = (๐", โฆ , ๐%,โ./"
%
๐ฆ.๐. mod 2%+") where ๐. are random (n+1)-bit numbers, and ๐ฆ. are random bits. Beautiful Function: If G is a one-way function, then G is a PRG (Pset 1). If lattice problems are hard on the worst-case, G is a PRG (6.876 Fall18 / CS294-168 Spring20)
SLIDE 28
PRG โน Overcoming Shannonโs Conundrum
๐น๐:
Do PRGs exist? (or, How to Encrypt n+1 bits using an n-bit key)
๐น๐:
(Exercise: If P=NP, PRGs do not exist.) How do we encrypt ๐"!! message bits with ๐ key bits? (Length extension: If there is a PRG that stretches by one bit, there is one that stretches by polynomially many bits)
SLIDE 29
Length extension: One bit to Many bits
Let G: {0,1}% โ {0,1}%+" be a pseudorandom generator. Goal: use G to generate many pseudorandom bits.
SLIDE 30
Let G: {0,1}% โ {0,1}%+" be a pseudorandom generator. Goal: use G to generate poly many pseudorandom bits.
Length extension: One bit to Many bits
SLIDE 31
Let G: {0,1}% โ {0,1}%+" be a pseudorandom generator. G ๐ฆ! ๐ฆ" = ๐ป(๐ฆ!) Construction of Gโ(๐ฆ!) Goal: use G to generate poly many pseudorandom bits.
Length extension: One bit to Many bits
SLIDE 32
Let G: {0,1}% โ {0,1}%+" be a pseudorandom generator. G ๐ฆ! ๐ฆ" Construction of Gโ(๐ฆ!) Goal: use G to generate poly many pseudorandom bits.
Length extension: One bit to Many bits
๐"๐ง"
SLIDE 33
Let G: {0,1}% โ {0,1}%+" be a pseudorandom generator. G ๐ฆ! ๐" Construction of Gโ(๐ฆ!) Goal: use G to generate poly many pseudorandom bits.
Length extension: One bit to Many bits
๐ง" G ๐ง- ๐- G ๐ง01" ๐01" โฆ Output ๐" ๐- ๐2 ๐3 ๐4 โฆ ๐ง0. Also called a stream cipher by the applied people. G ๐0 ๐ง0
SLIDE 34 Are we all set with encryption?
To encrypt the i-th bit, use the i-th pseudorandom bit.
- 1. Runtime (an efficiency issue)
- 2. Need to remember state (a security issue)
In a couple of weeks, Shafi will solve both problems in one shot. Two problems:
SLIDE 35
Next Lecture:
Define one-way functions (OWF), Hardcore bits (HCB), Goldreich-Levin Theorem: every OWF has a HCB. Show that OWF โ PRG (how to construct a PRG from any OWF*)