78
Lecture 1 Introduction to Cryptography Stefan Dziembowski www.dziembowski.net MIM UW 5.10.2012 ver 1.0

Lecture 1 Introduction to Cryptography Stefan Dziembowski MIM UW 5.10.2012ver 1.0

Embed Size (px)

Citation preview

Page 1: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Lecture 1Introduction to Cryptography

Stefan Dziembowskiwww.dziembowski.net

MIM UW

5.10.2012 ver 1.0

Page 2: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Podstawowe informacjeWykładowca: Stefan Dziembowski

Prowadzący ćwiczenia:

Tomasz Kazana Michał Zając

Miejsce i termin zajęć: wykład: piątki 14:15-15:45, sala 4420

ćwiczenia: środy 16:15-17:45, sala 3120 (TK), piątki 16:15-17:45, sala 5870 (MZ)

Strona przedmiotu: dostępna ze strony www.dziembowski.net

Page 3: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Literatura

• Podstawowy podręcznik: Jonathan Katz and Yehuda Lindell Introduction to Modern Cryptography

• Pozostałe

– Doug Stinson Cryptography Theory and Practice, Third Edition – Shafi Goldwasser and Mihir Bellare

Lecture Notes on Cryptography

– Alfred J. Menezes, Paul C. van Oorschot and Scott A. Vanstone Handbook of Applied Cryptography

Page 4: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Plan

1. Introduction2. Historical ciphers3. Information-theoretic security4. Computational security

Page 5: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Historical cryptography

ancient times world war II

cryptography encryptionmain applications: military and diplomacy

Page 6: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Modern cryptographycryptography = much more

than encryption!

sevenites now

public-key cryptography

e-cashelectronic voting

tossing a coin over a telephone

multiparty-computations

mental poker

zero-knowledge

key agreement electronic auctionssignature schemes

Page 7: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

What happened in the seventies?

Theory

the computational complexity theory

is bornthis allows researchers to reason about security in a formal way.

Technology

afforadable hardware

Demand

companies and individuals start to do business electronically

Page 8: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Cryptography

In the past:

the art of encrypting messages (mostly for the military applications).

Now:

the science of securing digital communication and transactions (encryption, authentication, digital signatures, e-cash, auctions, etc..)

Page 9: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Three components of the course

1. practical apects

2. mathematical foundations

3. new horizons

Page 10: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Practical aspects• symmetric encryption: block ciphers (DES, AES) and

tream ciphers (RC4)

• hash functions (MD5, SHA1,…), message authentication (CBC-MAC)

• public-key infrastructure (X.509, PGP, identity-based)

• elements of number theory

• asymetric encrypion (RSA, ElGamal, Rabin,...)

• signature schemes (RSA, ElGamal,…)

Page 11: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Mathematical foundations

• What makes us believe that the protocols are secure?

• Can we formally define “security”?

• Can security be proven?

• Do there exist “unbreakable” ciphers?

Page 12: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

New horizons

Advanced cryptographic protocols, such as:

• zero-knowledge

• multiparty computations

• private information retrieval

Page 13: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

This course is not about• practical data security (firewalls, intrusion-detection, VPNs,

etc.),

(however, we will talk a bit about the cryptographic protocols used in real life)

• history of cryptography,

• number theory and algebra

(we will use them only as tools)

• complexity theory.

Page 14: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Terminology

Cryptology = cryptography + cryptoanalysis

This convention is slightly artificial and often ignored.

Common usage: “cryptoanalysis of X” = “breaking X”

Common abbreviation: “crypto”

constructing secure systems

breaking the systems

Page 15: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Cryptography – general picture

encryption authentication

private key private key encryption

private key authentication

public key public keyencryption signatures

advanced cryptographic protocols

1

3

2

4

5

plan of the course:

Page 16: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Encryption schemes(a very general picture)

Encryption scheme (cipher) = encryption & decryption

encryption ciphertext c decryption mplaintext m

should not learn mIn the past:a text in natural language.

Now:a string of bits.

Alice Bob

Page 17: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Art vs. science

In the past:lack of precise definitions, ad-hoc design,

usually insecure.

Nowadays:formal definitions, systematic design, very

secure constructions.

Page 18: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

We want to construct schemes that are provably secure.

Provable security

But...

• why do we want to do it?• how to define it?• and is it possible to achieve it?

Page 19: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

there cannot exist an experimental proof that a scheme is secure.

In many areas of computer science formal proofs are not essential.

For example, instead of proving that an algorithm is efficient, we can just simulate it on a “typical input”.

Provable security – the motivation

Why?

Because a notion of a“typical adversary”

does not make sense.

In cryptography it’s not true, because

Security definitions are useful also because they allow us to construct schemes in a modular way...

Page 20: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Kerckhoffs' principle

20

Auguste Kerckhoffs (1883):The enemy knows the system

The cipher should remain secure even if the adversary knows the specification of the cipher.

The only thing that is secret is a

short key k

that is usually chosen uniformly at random

Page 21: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

21

A more refined picture

plaintext m encryption ciphertext c decryption m

key k key k

Let us assume that k is unifromly random

(Of course Bob can use the same method to send messages to Alice.)(That’s why it’s called the symmetric setting)

doesn’t know k should not learn m

Page 22: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Kerckhoffs' principle – the motivation

1. In commercial products it is unrealistic to assume that the design details remain secret (reverse-engineering!)

2. Short keys are easier to protect, generate and replaced.

3. The design details can be discussed and analyzed in public.

Not respecting this principle =

``security by obscurity”.

Page 23: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

A mathematical viewK – key spaceM – plaintext spaceC - ciphertext space

An encryption scheme is a pair (Enc,Dec), where Enc : K × M → C is an encryption algorithm, Dec : K × C → M is an decryption algorithm.

We will sometimes write Enck(m) and Deck(c) instead of Enc(k,m) and Dec(k,c).

Correctness

for every k we should have Deck(Enck(m)) = m.

Page 24: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Plan

1. Introduction2. Historical ciphers3. Information-theoretic security4. Computational security

Page 25: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Shift cipherM = words over alphabet {A,...,Z} ≈ {0,...,25} K = {0,...,25}

Enck(m0,...,mn) = (k+m0 mod 25,..., k+mn mod 25)

Deck(c0,...,cn) = (k+c0 mod 25,..., k+cn mod 25)

Cesar: k = 3

Page 26: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Security of the shift cipher

How to break the shift cipher?Check all possible keys!

Let c be a ciphertext.

For every k Є {0,...,25} check if Deck(c) “makes sense”.

Most probably only one such k exists.

Thus Deck(c) is the message.

This is called a brute force attack.Moral: the key space needs to be large!

Page 27: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

27

Substitution cipher

A B C D E F G H I J K L M N O P R S T U W V X Y Z

A B C D E F G H I J K L M N O P R S T U W V X Y Z

M = words over alphabet {A,...,Z} ≈ {0,...,25} K = a set of permutations of {0,...,25}

π

Encπ(m0,...,mn) = (π(m0),..., π(mn))

Decπ(c0,...,cn) = (π-1(c0),..., π-1(cn))

Page 28: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

28

How to break the substitution cipher?

Use statistical patterns of the language.

For example: the frequency tables.

Texts of 50 characters can usually be broken this way.

Page 29: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

29

Other famous historical ciphersVigenère cipher:

Blaise de Vigenère(1523 - 1596)

Leon Battista Alberti(1404 – 1472)

Enigma

Marian Rejewski(1905 - 1980)

Alan Turing(1912-1954)

Page 30: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

In the past ciphers were designed in an ad-hoc manner

In contemporary cryptography the ciphers are designed in a systematic way.

Main goals:1. define security2. construct schemes that are “provably secure”

Page 31: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Plan

1. Introduction2. Historical ciphers3. Information-theoretic security4. Computational security

Page 32: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Defining “security of an encryption scheme” is not trivial.

(m – a message)

1. the key K is chosen uniformly at random

2. C := EncK(m) is given to the adversary

consider the following experiment

how to define security

?

Page 33: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Idea 1

“The adversary should not be able to compute K.”

the encryption scheme that “doesn’t encrypt”: EncK(m) = m

satisfies this definition!

A problem

An idea

(m – a message)

1. the key K is chosen uniformly at random

2. C := EncK(m) is given to the adversary

Page 34: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Idea 2

“The adversary should not be able to compute m.”

What if the adversary can compute, e.g., the first half of m?

A problem

An idea

m1 ... m|m|/2 ? ... ?

(m – a message)

1. the key K is chosen uniformly at random

2. C := EncK(m) is given to the adversary

Page 35: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Idea 3

“The adversary should not learn any information about m.”

But he may already have some a priori information about m!

For example he may know that m is a sentence in English...

(m – a message)

1. the key K is chosen uniformly at random

2. c := Enck(m) is given to the adversary

A problem

An idea

Page 36: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Idea 4

“The adversary should not learn any additional information about m.”

This makes much more sense.But how to formalize it?

(m – a message)

1. the key K is chosen randomly

2. C := EncK(m) is given to the adversary

An idea

Page 37: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Eve knows that

Example

m :=

“I love you” with prob. 0.1“I don’t love you” with prob. 0.7

“I hate you” with prob. 0.2

m

Eve still knows that

m :=

“I love you” with prob. 0.1“I don’t love you” with prob. 0.7

“I hate you” with prob. 0.2

m

k c := EncK(m)

Page 38: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

How to formalize the “Idea 4”?

An encryption scheme is perfectly secret if for every random variable M and every m Є M and c Є C

P(M = m) = P(M = m | (Enc(K,M))= c)

“The adversary should not learn any additional information about m.”

such that P(C = c) > 0

equivalently: M and Enc(K,M) are independent

also called: information-theoretically secret

Page 39: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Equivalently:

for every M we have that: M and Enc(K,M) are independent

for every m0 and m1 we have that Enc(K,m0) and Enc(K,m1) have the same distribution

“the distribution of Enc(K,m) does not depend on m”

Page 40: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

40

A perfectly secret scheme: one-time pad

Gilbert Vernam (1890 –1960)

t – a parameterK = M = {0,1}t

Enck(m) = k xor mDeck(c) = k xor c

Vernam’s cipher:

component-wise xor

Correctness is trivial:

Deck(Enck(m)) = k xor (k xor m)

m

Page 41: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Perfect secrecy of the one-time pad

Perfect secrecy of the one time pad is also trivial.

This is because for every m the distribution of Enc(K,m) is uniform

(and hence does not depend on m).

for every c:P(Enc(K,m) = c) = P(K = m xor c) = 2-t

Page 42: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Observation

One time pad can be generalized as follows.

Let (G,+) be a group. Let K = M = C = G.

The following is a perfectly secret encryption scheme:

• Enc(k,m) = m + k• Dec(k,m) = m – k

Page 43: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

43

Why the one-time pad is not practical?

1. The key has to be as long as the message.

2. The key cannot be reused

This is because:Enck(m0) xor Enck(m1) = (k xor m0) xor (k xor m1)

= m0 xor m1

Page 44: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

44

Observation: |K| ≥ |C’|.

Fact: we always have that |C’| ≥ |M|.This is because for every k we have that

Enck : M → C’ is an injection(otherwise we wouldn’t be able to decrypt).

Theorem (Shannon 1949) (“One time-pad is optimal in the class of perfectly secret schemes”)In every perfectly secret encryption scheme

Enc : K × M → C , Dec : K × C → M

we have |K| ≥ |M|.

Proof

|K| ≥ |M|

Perfect secrecy implies that the distribution of Enc(K,m) does not depend on m. Hence for every m0 and m1 we have

{Enc(k,m0)}kЄK = {Enc(k,m1)}kЄK denote this set with C’

Page 45: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

45

Practicality?Generally, the one-time pad is not very practical, since:• the key has to be as long as the total length of the encrypted messages,• it is hard to generate truly random strings.

However, it is sometimes used (e.g. in the military applications), because of the following advantages:• perfect secrecy,• short messages can be encrypted using pencil and paper .

In the 1960s the Americans and the Soviets established a hotline that was encrypted using the one-time pad.(additional advantage: they didn’t need to share their secret encryption methods)

a KGB one-time pad hiddenin a walnut shell

Page 46: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

46

Venona project (1946 – 1980)

American National Security Agency decrypted Soviet messages that were transmitted in the 1940s.

That was possible because the Soviets reused the keys in the one-time pad scheme.Ethel and Julius Rosenberg

Page 47: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

47

Outlook

We constructed a perfectly secret encryption scheme

Our scheme has certain drawbacks(|K| ≥ |M|).

But by Shannon’s theorem this is unavoidable.

Can we go home and relax? maybe the secrecy

definition is too strong?

Page 48: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

How?

Classical (computationally-secure) cryptography: bound his computational power.

Alternative options: quantum cryptography, bounded-storage model,...

(not too practical)

What to do?

Idea

use a model where the power of the adversary is limited.

Page 49: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Quantum cryptographyStephen Wiesner (1970s), Charles H. Bennett and Gilles Brassard (1984)

quantum link

Eve

Alice Bob

Quantum indeterminacy: quantum states cannot be measured without disturbing the original state.

Hence Eve cannot read the bits in an unnoticeable way.

Page 50: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Quantum cryptographyAdvantage:

security is based on the laws of quantum physics

Disadvantage:needs a dedicated equipment.

Practicality?

Currently: successful transmissions for distances of length around 150 km.Commercial products are available.

Warning:Quantum cryptography should not be confused with quantum computing.

Page 51: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

A satellite scenario

Eve

Alice Bob

000110100111010010011010111001110111111010011101010101010010010100111100001001111111100010101001000101010010001010010100101011010101001010010101

A third party (a satellite) is broadcasting random bits.

Does it help?No...

(Shannon’s theorem of course also holds in this case.)

Page 52: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Ueli Maurer (1993): noisy channel.

1 0 1 0 1 0 0 1 1 0 1 0 0 1 0 1 0 1 0 1 0 0 1 1 0 1 0 0 1 0

1 0 1 0 1 0 0 1 1 0 1 0 0 1 0

1 0 1 0 1 0 0 1 1 0 1 0 0 1 0

0 0 1 0 0 0 0 1 1 0 0 0 0 1 1 1 0 1 1 1 0 0 1 1 0 1 0 0 0 1

1 0 1 1 1 0 0 1 1 0 1 0 0 0 0

Assumption: the data that the adversary receives is noisy.(The data that Alice and Bob receive may be even more noisy.)

some bits get flipped(because of the noise)

Page 53: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Bounded-Storage ModelAnother idea: bound the size of adversary’s memory

000110100111010010011010111001110111111010011101010101010010010100111100001001111111100010101001000101010010001010010100101011010101001010010101

too large to fit in Eve’s memory

Page 54: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Plan

1. Introduction2. Historical ciphers3. Information-theoretic security4. Computational security

Page 55: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

55

How can this be formalized?

We will use the complexity theory!

perfect secrecy:M and EncK(M)

are independent

How to reason about the bounded computing power?

It is enough to require thatM and EncK(M)

are independent “from the point of view of a computationally-limited

adversary’’.

Page 56: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Real cryptography starts here:

Eve is computationally-bounded

We will construct schemes that in principle can be broken if the adversary has a huge computing power.

For example, the adversary will be able to break the scheme by enumerating all possible secret keys.

(this is called a “brute force attack”)

Page 57: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Ideas:

“She has can use at most 1000 Intel Core 2 Extreme X6800 Dual Core Processors

for at most 100 years...”

1. “She can buy equipment worth 1 million euro and use it for 30 years..”.

Computationally-bounded adversary

Eve is computationally-bounded

it’s hard to reasonformally about it

But what does it mean?

Page 58: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

A better idea

We would need to specify exactly what we mean by a “Turing Machine”:

• how many tapes does it have?• how does it access these tapes (maybe a “random access memory” is a more realistic

model..)• ...

”The adversary has access to a Turing Machine that can make at most 1030 steps.”

“a system X is (t,ε)-secure if every Turing Machine

that operates in time t

can break it with probability at most ε.”

More generally, we could have definitions of a type:

This would be quite precise, but...

Moreover, this approach often leads to ugly formulas...

Page 59: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

What to do?

t steps of a Turing Machine → “efficient computation”

ε → a value “very close to zero”.

How to formalize it?

Use the asymptotics!

Idea:

Page 60: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Efficiently computable?“polynomial-time computableon a Probabilistic Turing Machine”

“efficiently computable” =

that is: running in timeO(nc) (for some c)

Here we assume that the poly-time Turing Machines are the right model for the real-life computation.

Not true if a quantum computer is built...

Page 61: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Probabilistic Turing Machines

0 1 1 0 1 0 1 1 0 1

A standard Turing Machine has some number of tapes:

A probabilistic Turing Machine

has an additional tape with

random bits.

Page 62: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Some notation

If M is a Turing Machine then

M(X)

is a random variable denoting the output of M assuming that

the contents of the random tape was chosen uniformly at random.

Page 63: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

More notation

Y ← M(X) means that the variable Y takes the value that M

outputs on input X (assuming the random input is chosen uniformly).

If A is a set then Y ← A

means that Y is chosen uniformly at random from the set A.

Page 64: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

“very small” =

“negligible”=

approaches 0 faster than the inverse of any polynomial

Very small?

Formally

A function µ : N → R is negligible if for every positive integer c there exists an integer N such that for all x > N

Page 65: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Negligible or not?

yes

yes

yes

no

no

Page 66: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Nice properties of these notions• A sum of two polynomials is a polynomial:

poly + poly = poly

• A product of two polynomials is a polynomial:poly * poly = poly

• A sum of two negligible functions is a negligible function:negl + negl = negl

Moreover:

• A negligible function multiplied by a polynomial is negligiblenegl * poly = negl

Page 67: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Security parameter

The terms “negligible” and “polynomial” make sense only if X (and the adversary) take an additional input 1n called

a security parameter.

In other words: we consider an infinite sequence X(1),X(2),...

of schemes.

Typically, we will say that a scheme X is secure ifApolynomial-time

Turing Machine M

P (M breaks the scheme X) is negligible

Page 68: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Examplesecurity parameter n = the length of the secret key k

in other words: k is always a random element of {0,1}n

The adversary can always guess k with probability 2-n.

This probability is negligible.

He can also enumerate all possible keys k in time 2n.(the “brute force” attack)

This time is exponential.

Page 69: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Is this the right approach?Advantages

1. All types of Turing Machines are “equivalent” up to a “polynomial reduction”.

Therefore we do need to specify the details of the model.

2. The formulas get much simpler.

Disadvantage

Asymptotic results don’t tell us anything about security of the concrete systems.

However

Usually one can prove formally an asymptotic result and then argue informally that “the constants are reasonable”

(and can be calculated if one really wants).

Page 70: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

How to change the security definition?

An encryption scheme is perfectly secret if for every m0,m1 Є M

PEnc(K, m0) = PEnc(K, m1)

we will require that m0,m1 are chosen by a poly-time adversary

we will require that no poly-time adversary can distinguishEnc(K, m0) from Enc(K, m1)

Page 71: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

A game

adversary(polynomial-time probabilistic Turing machine) oracle

chooses m0,m1 such that|m0|=|m1|

m0,m1 1. selects k randomly from {0,1}n

2. chooses a random b = 0,13. calculates

c := Enc(k,mb)

(Enc,Dec) – an encryption scheme

chas to guess b

Security definition:We say that (Enc,Dec) is semantically-secure if any polynomial time adversary guesses b correctly with probability at most 0.5 + ε(n), where ε is negligible.

security parameter1n

Alternative name: has indistinguishable encryptions (sometimes we will say: “is computationally-secure”, if the context is clear)

Page 72: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Testing the definition

Suppose the adversary can compute k from Enc(k,m). Can he win the game?

YES!

Suppose the adversary can compute some bit of m from Enc(k,m). Can he win the game?

YES!

Page 73: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Multiple messagesIn real-life applications we need to encrypt

multiple messages with one key.

The adversary may learn something about the key by looking at

ciphertexts c1,...,ct of

some messages m1,...,mt.

How are these messages chosen?let’s say: the adversary can choose them!

(good tradition: be as pessimistic as possible)

Page 74: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

A chosen-plaintext attack (CPA)

oracle

chooses m’1 m’1

c1 = Enc(k,m’1)

has to guess b

chooses m’t m’t

ct = Enc(m’t)

m0,m1

c = Enc(k,mb)

chooses m0,m1

the interaction continues . . .

security parameter1n

1. selects random k Є {0,1}n

2. chooses a random b = 0,1

. . .

challenge phase:

Page 75: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

CPA-security

We say that (Enc,Dec) has indistinguishable encryptions under a chosen-plaintext attack (CPA) if

every randomized polynomial time adversary guesses b correctly

with probability at most 0.5 + ε(n), where ε is negligible.

Alternative name: CPA-secure

Every CPA-secure encryption has to be • randomized, or• “have a state”.

Observation

Security definition

Page 76: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

CPA in real-lifeQ: Aren’t we too pessimistic?A: No! CPA can be implemented in practice.

Example: routing

m

k kEnck(m)

Page 77: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

Other attacks known in the literature

• ciphertext-only attack – the adversary has no information about the plaintext

• known plaintext attack – the plaintext are drawn from some distribution that the adversary does not control

• batch chosen-plaintext attack – like the CPA attack, but the adversary has to choose m1,...,mt at once.

• chosen ciphertext attack – we will discuss it later…

(“our” CPA-attack is also called the “adaptive CPA-attack”)stro

ng

w

eak

Page 78: Lecture 1 Introduction to Cryptography Stefan Dziembowski  MIM UW 5.10.2012ver 1.0

©2012 by Stefan Dziembowski. Permission to make digital or hard copies of part or all of this material is currently granted without fee provided that copies are made only for personal or classroom use, are not distributed for profit or commercial advantage, and that new copies bear this notice and the full citation.