• No results found

COMP443-4mac-screen.pdf

N/A
N/A
Protected

Academic year: 2020

Share "COMP443-4mac-screen.pdf"

Copied!
27
0
0

Loading.... (view fulltext now)

Full text

(1)

Modern Cryptography

COMP 443 / 543

Chapter 4

Alptekin K¨up¸c¨u

Computer Science and Engineering Ko¸c University

(2)

Main Topics

Message Integrity

Message Authentication Codes Hash Functions

Collision-resistance

Merkle-Damgard transform

Usages

CCA-secure encryption

(3)

Message Integrity

Tampering detection vs. prevention

Encryption not enough (e.g., one-time pad) Guessable ciphertext space

MAC: symmetric-key

(4)

Message Authentication Code

Gen(1n)→k Mack(m)→t

VerifyMack(m,t)→accept/reject

Correctness: ∀m∈ M

(5)

Secure MAC

CPA-like game

Secure MAC = Existentially unforgeable underadaptivechosen message attack.

Mac-forgeA,Π(n) game:

1 Challenger generates keyk upon input 1n

2 Adversary, given 1n and oracle access toMack(.) generates and sends m,t

Adversary wins ifVerifyMack(m,t)→acceptandm was not asked as a query to the oracle.

What about replay attacks ??

(6)

Secure MAC

CPA-like game

Secure MAC = Existentially unforgeable under adaptive chosen message attack.

Mac-forgeA,Π(n) game:

1 Challenger generates keyk upon input 1n

2 Adversary, given 1n and oracle access to Mack(.) generates and sends m,t

Adversary wins ifVerifyMack(m,t)→acceptandm was not asked as a query to the oracle.

What about replay attacks ??

(7)

Secure MAC

CPA-like game

Secure MAC = Existentially unforgeable under adaptive chosen message attack.

Mac-forgeA,Π(n) game:

1 Challenger generates keyk upon input 1n

2 Adversary, given 1n and oracle access to Mack(.) generates and sends m,t

Adversary wins ifVerifyMack(m,t)→acceptandm was not asked as a query to the oracle.

What about replay attacks ??

(8)

PRF-based MAC

For fixed-length messages:

Gen(1n) picks a key for the underlying PRF

Mack(m) outputs t=Fk(m)

VerifyMack(m,t) computest0 =Mack(m) and outputs

accept iff t =t0

(9)

Variable-length Messages

Given a MAC secure for fixed-length messages, convert it to one secure for variable-length messages.

Split message into equal-length piecesmi, after padding if necessary.

Several strategies:

1 Set x =m1m2. . .md andt =Mack(x)

2 Authenticate blocks separately, obtaining multiple tags:

ti =Mack(mi)

(10)

Variable-length Messages

Given a MAC secure for fixed-length messages, convert it to one secure for variable-length messages.

Split message into equal-length piecesmi, after padding if necessary.

Several strategies:

1 Set x =m1m2. . .md andt =Mack(x)

2 Authenticate blocks separately, obtaining multiple tags:

ti =Mack(mi)

(11)

Variable-length Messages

Given a MAC secure for fixed-length messages, convert it to one secure for variable-length messages.

Split message into equal-length piecesmi, after padding if necessary.

Several strategies:

1 Set x =m1m2. . .md andt =Mack(x)

2 Authenticate blocks separately, obtaining multiple tags:

ti =Mack(mi)

(12)

Secure Variable-length MAC

Let (Gen0,Mac0,VerifyMac0) be a secure fixed-length MAC.

Gen(1n) runsGen0(1n) and outputs its output

Mack(m):

Letlenbe the length of the message

Parseminto blocksmi of lengthn/4 (after padding if

necessary)

Pickr ← {0,1}n/4

For each block, computeti =Mack0(r||len||i||mi)WHY??

Outputt = (r,{ti})

VerifyMack(m,t)

Letlenbe the length of the message

Parseminto blocksmi of lengthn/4 (after padding if

necessary)

For each block, runVerifyMac0

k(r ||len||i ||mi,ti) and accept

iff all accept

(13)

Secure Variable-length MAC

Let (Gen0,Mac0,VerifyMac0) be a secure fixed-length MAC.

Gen(1n) runsGen0(1n) and outputs its output

Mack(m):

Letlenbe the length of the message

Parseminto blocksmi of lengthn/4 (after padding if

necessary)

Pickr ← {0,1}n/4

For each block, computeti =Mack0(r||len||i||mi) WHY??

Outputt = (r,{ti})

VerifyMack(m,t)

Letlenbe the length of the message

Parseminto blocksmi of lengthn/4 (after padding if

necessary)

For each block, runVerifyMac0

k(r ||len||i ||mi,ti) and accept

iff all accept

(14)
(15)

Hash Functions

Example: hash table

Compressing functions

Adversarial setting

Keyed-hash functions (e.g., family), butkey is public!

Gen(1n)→hk

hash function (we assume hk is built in tohash, i.e.,

hash=hashhk)

(16)

Collision-Resistant Hash Function

∀PPT adversary A ∃ negligible functionneg(n) s.t.

Pr[Gen(1n)→hash;A(1n,hash)→(x,x0) :

x 6=x0∧ hash(x) =hash(x0)] =neg(n)

(17)

Security of Hash Functions

Pre-image resistance (one-wayness):

Pr[Gen(1n)→hash;M →x;hash(x)→y;A(1n,hash,y)→x0 :

hash(x0) =y] =neg(n)

Note: forrandommessage

Second pre-image resistance

Pr[Gen(1n)→hash;M →x;A(1n,hash,x)→x0:

x 6=x0∧ hash(x0) =hash(x)] =neg(n)

Note: the adversary needs to find a different input giving the same output

Other definitions include Universal One-Way Hash Functions (Target Collision Resistance).

(18)

Security of Hash Functions

Pre-image resistance (one-wayness):

Pr[Gen(1n)→hash;M →x;hash(x)→y;A(1n,hash,y)→x0 :

hash(x0) =y] =neg(n)

Note: for random message

Second pre-image resistance

Pr[Gen(1n)→hash;M →x;A(1n,hash,x)→x0:

x 6=x0∧ hash(x0) =hash(x)] =neg(n)

Note: the adversary needs to find adifferentinput giving the same output

Other definitions include Universal One-Way Hash Functions (Target Collision Resistance).

(19)

Security of Hash Functions

Pre-image resistance (one-wayness):

Pr[Gen(1n)→hash;M →x;hash(x)→y;A(1n,hash,y)→x0 :

hash(x0) =y] =neg(n)

Note: for random message

Second pre-image resistance

Pr[Gen(1n)→hash;M →x;A(1n,hash,x)→x0:

x 6=x0∧ hash(x0) =hash(x)] =neg(n)

Note: the adversary needs to find a different input giving the same output

Other definitions include Universal One-Way Hash Functions (Target Collision Resistance).

(20)

Merkle-Damgard Transform

Figure: Figure from book by Katz and Lindell

(21)

CCA-Secure Encryption

Given CPA-secure encryption scheme (GenE,EncCPA,DecCPA) and MAC scheme (GenM,Mac,VerifyMac)

Gen(1n) runsGen

E(1n)→kE andGenM(1n)→kM and sets

k = (kE,kM)

Enck(m) runsEncCPAkE(m)→c0 andt=MackM(c

0) and sets

c = (c0,t)

Deck(c) first checks VerifyMackM(c

0,t) and if it accepts, outputsDecCPAkE(c0)→m0, else outputs⊥

Correctness??

(22)

CCA-Secure Encryption

Given CPA-secure encryption scheme (GenE,EncCPA,DecCPA) and MAC scheme (GenM,Mac,VerifyMac)

Gen(1n) runsGen

E(1n)→kE andGenM(1n)→kM and sets

k = (kE,kM)

Enck(m) runsEncCPAkE(m)→c0 andt=MackM(c

0) and sets

c = (c0,t)

Deck(c) first checks VerifyMackM(c

0,t) and if it accepts, outputsDecCPAkE(c0)→m0, else outputs⊥

Correctness??

(23)

CCA-Security Proof

Idea: Two reductions: If adversaryAbreaks security of our CCA-secure encryption scheme, we construct:

1 AdversaryBM who breaks security of our MAC scheme (with unique tags)

2 AdversaryBE who breaks security of our CPA-secure encryption scheme

If the adversaryAmanages to submit a valid decryption query on a message that was not encrypted by the oracle, he must have forged MAC.

(24)

Properly Combining Cryptographic Primitives

How to obtain message secrecy and integrity together?

1 Encrypt-and-authenticate

EnckE(m)→c

0 and Mac

kM(m)→t

2 Authenticate-then-encrypt

MackM(m)→t andEnckE(m||t)→c

3 Encrypt-then-authenticate

EnckE(m)→c

0 and Mac kM(c

0)t

IMPORTANT

Never use the same key for multiple primitives! (i.e., kE 6=kM)

(25)

How to obtain CCA-Security

GivenanyCPA-secure encryption scheme and anyMAC scheme (with unique tags)

1 Encrypt-and-authenticate not necessarily secure

EnckE(m)→c

0 and Mac

kM(m)→t

2 Authenticate-then-encrypt not necessarily secure

MackM(m)→t andEnckE(m||t)→c

3 Encrypt-then-authenticateprovably secure

EnckE(m)→c

0 and Mac kM(c

0)t

Not necessarily secure: Thereexists some CPA-secure encryption and MAC schemes that together fail to provide security and integrity at the same time.

Same key problematic example: Given PRPFk, let

(26)

How to obtain CCA-Security

GivenanyCPA-secure encryption scheme and anyMAC scheme (with unique tags)

1 Encrypt-and-authenticate not necessarily secure

EnckE(m)→c

0 and Mac

kM(m)→t

2 Authenticate-then-encrypt not necessarily secure

MackM(m)→t andEnckE(m||t)→c

3 Encrypt-then-authenticateprovably secure

EnckE(m)→c

0 and Mac kM(c

0)t

(27)

TODO Next

Solve exercises 4. 1,2,3,4,7,15,17,18.

Pay special attention to exercises 4. 5,10,11.

Skim throughChapter5, do not worry about details.

Read Chapter6such that you:

Fully understand definitions of OWF, OWP, and

computational indistinguishability.

Are comfortable with hybrid-argument proofs. Understand the proofs more than the results.

Pay special attention to the proof styles. They are very

References

Related documents

Resistance to citrus tristeza virus (CTV) was evaluated in 554 progeny of 10 populations derived from Poncirus trifoliata.. Twenty-one dominant PCR-based DNA markers were identified

Abstract: In This paper presents a efficient texture based recognition on multi scale local binary pattern (LBP) texture features .It’s a simple and fast for implementation,

In this our study we were able to establish a linear relationship between birth weight and placental weight and also derived regression equations to estimate either

So in this study it is concluded that large number of females with breast pathologies present with benign lesions like fibro-adenoma at the age of 20-39 years.. It

Automated Procedures for Phoephorus.. Algal growth response and nitrogen and phosphorous concentration, New Hope sample No. Algal growth response and nitrogen and

As the direction of main beam for the three-port DRA is different from each other when working in different states, 3D radiation patterns are given in Table 4 to explain the

Current and future computerized systems and in- frastructures are going to be based on the layering of dif- ferent systems, designed at different times, with different

Pro-Nps are substituting elements used to replace noun phrases. This term is considered the most appropriate because as Luraghi and parody point out, the so-called pronouns have