message authentication codes - umd

14
Message Authentication Codes Definition: A message authentication code (MAC) consists of three probabilistic polynomial-time algorithms (, , ) such that: 1. The key-generation algorithm takes as input the security parameter 1 and outputs a key with β‰₯. 2. The tag-generation algorithm takes as input a key and a message ∈ 0,1 βˆ— , and outputs a tag . ← (). 3. The deterministic verification algorithm takes as input a key , a message , and a tag . It outputs a bit with =1 meaning valid and =0 meaning invalid. ≔ (, ). It is required that for every , every key output by (1 ), and every ∈ 0,1 βˆ— , it holds that , = 1.

Upload: others

Post on 07-Jan-2022

13 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Message Authentication Codes - UMD

Message Authentication Codes Definition: A message authentication code (MAC) consists of three probabilistic polynomial-time algorithms (𝐺𝑒𝑛, π‘€π‘Žπ‘, π‘‰π‘Ÿπ‘“π‘¦) such that: 1. The key-generation algorithm 𝐺𝑒𝑛 takes as input the

security parameter 1𝑛 and outputs a key π‘˜ with π‘˜ β‰₯ 𝑛. 2. The tag-generation algorithm π‘€π‘Žπ‘ takes as input a key π‘˜

and a message π‘š ∈ 0,1 βˆ—, and outputs a tag 𝑑. 𝑑 ← π‘€π‘Žπ‘π‘˜(π‘š).

3. The deterministic verification algorithm π‘‰π‘Ÿπ‘“π‘¦ takes as input a key π‘˜, a message π‘š, and a tag 𝑑. It outputs a bit 𝑏 with 𝑏 = 1 meaning valid and 𝑏 = 0 meaning invalid. 𝑏 ≔ π‘‰π‘Ÿπ‘“π‘¦π‘˜(π‘š, 𝑑).

It is required that for every 𝑛, every key π‘˜ output by 𝐺𝑒𝑛(1𝑛), and every π‘š ∈ 0,1 βˆ—, it holds that π‘‰π‘Ÿπ‘“π‘¦π‘˜ π‘š, π‘€π‘Žπ‘π‘˜ π‘š = 1.

Page 2: Message Authentication Codes - UMD

Existential Unforgeability under CMA Attacker

Challenger π‘˜ ← 𝐺𝑒𝑛()

𝑑 ← π‘€π‘Žπ‘(π‘˜,π‘š)

π‘š

𝑑 …

(π‘šβˆ—, π‘‘βˆ—)

Set of queries 𝑄

forgery

Attacker β€œwins” if : 1. π‘šβˆ— βˆ‰ 𝑄 2. π‘‰π‘Ÿπ‘“π‘¦ π‘˜,π‘šβˆ—, π‘‘βˆ— = 1 Security Requirement: Any efficient attacker wins with probability at most 𝑛𝑒𝑔𝑙𝑖𝑔𝑖𝑏𝑙𝑒

Page 3: Message Authentication Codes - UMD

CBC-MAC Let 𝐹 be a pseudorandom function, and fix a length function β„“. The basic CBC-MAC construction is as follows:

β€’ π‘€π‘Žπ‘: on input a key π‘˜ ∈ 0,1 𝑛 and a message π‘š of length β„“ 𝑛 β‹… 𝑛, do the following: 1. Parse π‘š as π‘š = π‘š1, … , π‘šβ„“ where each π‘šπ‘– is of length 𝑛.

2. Set 𝑑0 ≔ 0𝑛. Then, for 𝑖 = 1 π‘‘π‘œ β„“:

Set 𝑑𝑖 ≔ πΉπ‘˜(π‘‘π‘–βˆ’1 βŠ• π‘šπ‘–).

Output 𝑑ℓ as the tag.

β€’ π‘‰π‘Ÿπ‘“π‘¦: on input a key π‘˜ ∈ 0,1 𝑛, a message π‘š, and a tag 𝑑, do: If π‘š is not of length β„“ 𝑛 β‹… 𝑛 then output 0. Otherwise, output 1 if and only if 𝑑 = π‘€π‘Žπ‘π‘˜(π‘š).

Page 4: Message Authentication Codes - UMD

CBC-MAC

Page 5: Message Authentication Codes - UMD

Authenticated Encryption

β€’ Definition: A private-key encryption scheme is an authenticated encryption scheme if it is CCA-secure and unforgeable.

Page 6: Message Authentication Codes - UMD

CCA Security Attacker

Challenger π‘˜ ← 𝐺𝑒𝑛()

𝑏 ← {0,1} π‘βˆ— ← 𝐸𝑛𝑐(π‘˜, π‘š)

…

π‘š0, π‘š1

π‘βˆ—

…

queries to Enc/Dec

queries to Enc/Dec (cannot query π‘βˆ—)

challenge

𝑏′

Attacker β€œwins” if 𝑏′ = 𝑏.

CCA Security: Any efficient attacker wins with probability at most 1

2+ 𝑛𝑒𝑔𝑙𝑖𝑔𝑖𝑏𝑙𝑒

Page 7: Message Authentication Codes - UMD

Generic Constructions

Page 8: Message Authentication Codes - UMD

Encrypt-and-authenticate

Encryption and message authentication are computed independently in parallel.

𝑐 ← πΈπ‘›π‘π‘˜πΈπ‘š 𝑑 ← π‘€π‘Žπ‘π‘˜π‘€

π‘š

𝑐, 𝑑

Is this secure? NO!

Page 9: Message Authentication Codes - UMD

Authenticate-then-encrypt

Here a MAC tag 𝑑 is first computed, and then the message and tag are encrypted together.

𝑑 ← π‘€π‘Žπ‘π‘˜π‘€π‘š 𝑐 ← πΈπ‘›π‘π‘˜πΈ

(π‘š| 𝑑

𝑐 is sent

Is this secure? NO! Encryption scheme may not be CCA-secure.

Page 10: Message Authentication Codes - UMD

Encrypt-then-authenticate

The message π‘š is first encrypted and then a MAC tag is computed over the result

𝑐 ← πΈπ‘›π‘π‘˜πΈπ‘š 𝑑 ← π‘€π‘Žπ‘π‘˜π‘€

𝑐

𝑐, 𝑑

Is this secure? YES! As long as the MAC is strongly secure.

Page 11: Message Authentication Codes - UMD

Examples Consider multiplication modulo 23.

23 is a β€œsafe prime” since 23 = 2*11 +1, where 11 is a prime.

20 π‘šπ‘œπ‘‘ 23 1

21 π‘šπ‘œπ‘‘ 23 2

22 π‘šπ‘œπ‘‘ 23 4

23 π‘šπ‘œπ‘‘ 23 8

24 π‘šπ‘œπ‘‘ 23 16

25 π‘šπ‘œπ‘‘ 23 32 β†’ 9

26 π‘šπ‘œπ‘‘ 23 18

27 π‘šπ‘œπ‘‘ 23 36 β†’ 13

28 π‘šπ‘œπ‘‘ 23 26 β†’ 3

29 π‘šπ‘œπ‘‘ 23 6

210 π‘šπ‘œπ‘‘ 23 12

211 π‘šπ‘œπ‘‘ 23 24 β†’ 1

Consider the following cyclic group generated by 2:

Actually, all of 2, 4, 8, 16, 9, 18, 13, 3, 6, 12 are generators and each of them raised to the 11 will be equal to 1 modulo 23.

Page 12: Message Authentication Codes - UMD

Key Agreement

The key-exchange experiment πΎπΈπ‘’π‘Žπ‘£π΄,Ξ 

𝑛 :

1. Two parties holding 1𝑛 execute protocol Ξ . This results in a transcript π‘‘π‘Ÿπ‘Žπ‘›π‘  containing all the messages sent by the parties, and a key π‘˜ output by each of the parties.

2. A uniform bit 𝑏 ∈ {0,1} is chosen. If 𝑏 = 0 set π‘˜ ≔ π‘˜, and if 𝑏 = 1 then choose π‘˜ ∈ 0,1 𝑛 uniformly at random.

3. 𝐴 is given π‘‘π‘Ÿπ‘Žπ‘›π‘  and π‘˜ , and outputs a bit 𝑏′. 4. The output of the experiment is defined to be 1 if 𝑏′ = 𝑏 and 0

otherwise. Definition: A key-exchange protocol Ξ  is secure in the presence of an eavesdropper if for all ppt adversaries 𝐴 there is a negligible function 𝑛𝑒𝑔 such that

Pr πΎπΈπ‘’π‘Žπ‘£π΄,Ξ 

𝑛 = 1 ≀1

2+ 𝑛𝑒𝑔 𝑛 .

Page 13: Message Authentication Codes - UMD

Diffie-Hellman Key Exchange

Page 14: Message Authentication Codes - UMD

Example for the group we saw above with generator 𝑔 = 2:

Alice:

π‘₯ ← 0,… , 10 Say π‘₯ = 8 28 π‘šπ‘œπ‘‘ 23 = 3 Output: 98 π‘šπ‘œπ‘‘ 23

= 316 π‘šπ‘œπ‘‘ 23 = 311 β‹… 35 π‘šπ‘œπ‘‘ 23 = 1 β‹… 35 π‘šπ‘œπ‘‘ 23 = 27 β‹… 9 π‘šπ‘œπ‘‘ 23 = 4 β‹… 9 π‘šπ‘œπ‘‘ 23

= 36 π‘šπ‘œπ‘‘ 23 = πŸπŸ‘

Bob:

𝑦 ← 0,… , 10 Say 𝑦 = 5 25 π‘šπ‘œπ‘‘ 23 = 9 Output: 35 π‘šπ‘œπ‘‘ 23

= 27 β‹… 9 π‘šπ‘œπ‘‘ 23 = 4 β‹… 9 π‘šπ‘œπ‘‘ 23

= 36 π‘šπ‘œπ‘‘ 23 = πŸπŸ‘

3

9