lecture 3 symmetric encryption, ind-cpa, ctr, cbc

55
Lecture 3 โ€“ Symmetric encryption, IND-CPA, CTR, CBC TEK4500 08.09.2020 Hรฅkon Jacobsen [email protected]

Upload: others

Post on 24-Feb-2022

7 views

Category:

Documents


0 download

TRANSCRIPT

Lecture 3 โ€“ Symmetric encryption, IND-CPA,

CTR, CBC

TEK4500

08.09.2020

Hรฅkon Jacobsen

[email protected]

Basic goals of cryptography

2

Message privacyMessage integrity /

authentication

Symmetric keys Symmetric encryptionMessage authentication

codes (MAC)

Asymmetric keys

Asymmetric encryption

(a.k.a. public-key

encryption)

Digital signatures

Encryption schemes โ€“ syntax

โ€ข A symmetric encryption scheme ฮฃ = KeyGen, Enc, Dec consists of three

algorithms:

โ€ข Associated to ฮฃ:

โ€ข Key space ๐’ฆ

โ€ข Message space โ„ณ

โ€ข Ciphertext space ๐’ž

โ€ข KeyGen and Enc may be randomized ($), but Dec must be deterministic3

Adversary

EncC

M M / โŠฅ

KeyGen

Dec$

K

$

Correctness requirement: For all

๐พ โ† KeyGen :

Dec ๐พ, Enc ๐พ,๐‘€ = ๐‘€

Electronic Code Book (ECB) mode

Given a block cipher โ„ฐ: 0,1 ๐‘˜ ร— 0,1 ๐‘› โ†’ 0,1 ๐‘› how to encrypt a long message?

ECB โ„ฐ = KeyGen, Enc, Dec

4

โ„ฐ๐พ

๐‘€1

๐ถ1

โ„ฐ๐พ

๐‘€2

๐ถ2

โ„ฐ๐พ

๐‘€3

๐ถ3

โ„ฐ๐พ

๐‘€4

๐ถ4

Alg Enc ๐พ,๐‘€---------------------------------1. for ๐‘– = 1,โ€ฆ ,๐‘š do2. ๐ถ๐‘– โ† โ„ฐ๐พ ๐‘€๐‘–

3. return ๐ถ

Alg Dec ๐พ, ๐ถ---------------------------------1. for ๐‘– = 1,โ€ฆ ,๐‘š do2. ๐‘€๐‘– โ† โ„ฐ๐พ

โˆ’1 ๐ถ๐‘–3. return ๐‘€

ECB problems

โ€ข Weakness: ๐‘€1 = ๐‘€2 โŸน ๐ถ1 = ๐ถ2

โ€ข Example: Suppose message space only contains two messages: ๐‘‹ = 0128

and ๐‘Œ = 1128; could represent:

โ€ข Vote YES or NO

โ€ข BUY or SELL a stock

โ€ข FIRE or DON'T FIRE a missile

5

ECB penguin

6

Plaintext ECB encrypted Properly encrypted

Wanted: security definition for symmetric encryption

โ€ข Perfect privacy: for any ๐‘€0, ๐‘€1 โˆˆ โ„ณ and any ๐ถ โˆˆ ๐’ž:

Pr โ„ฐ๐พ ๐‘€0 = ๐ถ = Pr โ„ฐ๐พ ๐‘€1 = ๐ถ

โ€ข Security holds for any adversary (no limit on resource usage)

โ€ข Very strict requirements:

โ€ข Keys need to be as long as message

โ€ข Key can only be used for one message

7

Wanted: security definition for symmetric encryption

โ€ข Perfect privacy: for any ๐‘€0, ๐‘€1 โˆˆ โ„ณ and any ๐ถ โˆˆ ๐’ž:

Pr โ„ฐ๐พ ๐‘€0 = ๐ถ = Pr โ„ฐ๐พ ๐‘€1 = ๐ถ

โ€ข Security holds for any adversary (no limit on resource usage)

โ€ข Very strict requirements:

โ€ข Keys need to be as long as messageโ€ฆwant keys to be short

โ€ข Key can only be used for one messageโ€ฆwant to encrypt many messages

8

Idea

โ€ข Computational privacy: for any ๐‘€0, ๐‘€1 โˆˆ โ„ณ and any ๐ถ โˆˆ ๐’ž:

Pr โ„ฐ๐พ ๐‘€0 = ๐ถ โ‰ˆ Pr โ„ฐ๐พ ๐‘€1 = ๐ถ

โ€ข Security only required to hold for resource bounded adversaries

โ€ข Very strict requirements:

โ€ข Keys need to be as long as messageโ€ฆwant keys to be short

โ€ข Key can only be used for one messageโ€ฆwant to encrypt many messages

9

IND-CPA โ€“ Indistinguishability against chosen-plaintext attacks

10

๐„๐ฑ๐ฉฮฃindโ€“cpa

๐ด

1. ๐‘โ†$

0,1

2. ๐พโ†$ฮฃ. KeyGen

3. ๐‘€0, ๐‘€1 โ† ๐ดโ„ฐ๐พ โ‹… // find stage4.5.6. ๐ถโˆ— โ† ฮฃ. Enc ๐พ,๐‘€๐‘

7. ๐‘โ€ฒ โ† ๐ดโ„ฐ๐พ โ‹… ๐ถโˆ— // guess stage

8. ๐ซ๐ž๐ญ๐ฎ๐ซ๐ง ๐‘โ€ฒ =?๐‘

โ„ฐ๐พ ๐‘€---------------------------------1. return ฮฃ. Enc ๐พ,๐‘€

Definition: The IND-CPA-advantage of an

adversary ๐ด is

๐€๐๐ฏฮฃindโ€“cpa

๐ด = Pr ๐„๐ฑ๐ฉฮฃindโ€“cpa

๐ด โ‡’ true โˆ’ 1/2

Test me on ๐‘€0, ๐‘€1

๐ถโˆ—

๐‘‹1, ๐‘‹2, โ€ฆ

๐ถ1, ๐ถ2, โ€ฆ

Enc(๐พ,โ‹…)

๐‘‹1, ๐‘‹2, โ€ฆ

๐ถ1, ๐ถ2, โ€ฆ

Enc(๐พ,โ‹…)

What if ๐‘จ submits ๐‘ด๐’ = ๐ŸŽand ๐‘ด๐Ÿ = ๐ŸŽ๐Ÿ๐ŸŽ๐ŸŽ๐ŸŽ๐ŸŽ?

๐ถโˆ— was an

encryption of ๐‘€1

IND-CPA โ€“ Indistinguishability against chosen-plaintext attacks

11

๐„๐ฑ๐ฉฮฃindโ€“cpa

๐ด

1. ๐‘โ†$

0,1

2. ๐พโ†$ฮฃ. KeyGen

3. ๐‘€0, ๐‘€1 โ† ๐ดโ„ฐ๐พ โ‹… // find stage4. if ๐‘€0 โ‰  ๐‘€1 then5. returnโŠฅ6. ๐ถโˆ— โ† ฮฃ. Enc ๐พ,๐‘€๐‘

7. ๐‘โ€ฒ โ† ๐ดโ„ฐ๐พ โ‹… ๐ถโˆ— // guess stage

8. ๐ซ๐ž๐ญ๐ฎ๐ซ๐ง ๐‘โ€ฒ =?๐‘

โ„ฐ๐พ ๐‘€---------------------------------1. return ฮฃ. Enc ๐พ,๐‘€

Definition: The IND-CPA-advantage of an

adversary ๐ด is

๐€๐๐ฏฮฃindโ€“cpa

๐ด = Pr ๐„๐ฑ๐ฉฮฃindโ€“cpa

๐ด โ‡’ true โˆ’ 1/2

Test me on ๐‘€0, ๐‘€1

๐ถโˆ—

๐‘‹1, ๐‘‹2, โ€ฆ

๐ถ1, ๐ถ2, โ€ฆ

Enc(๐พ,โ‹…)

๐‘‹1, ๐‘‹2, โ€ฆ

๐ถ1, ๐ถ2, โ€ฆ

Enc(๐พ,โ‹…)

๐ถโˆ— was an

encryption of ๐‘€1

IND-CPA โ€“ Indistinguishability against chosen-plaintext attacks

12

๐„๐ฑ๐ฉฮฃindโ€“cpa

๐ด

1. ๐‘โ†$

0,1

2. ๐พโ†$ฮฃ. KeyGen

3. ๐‘€0, ๐‘€1 โ† ๐ดโ„ฐ๐พ โ‹… // find stage4. if ๐‘€0 โ‰  ๐‘€1 then5. returnโŠฅ6. ๐ถโˆ— โ† ฮฃ. Enc ๐พ,๐‘€๐‘

7. ๐‘โ€ฒ โ† ๐ดโ„ฐ๐พ โ‹… ๐ถโˆ— // guess stage

8. ๐ซ๐ž๐ญ๐ฎ๐ซ๐ง ๐‘โ€ฒ =?๐‘

โ„ฐ๐พ ๐‘€---------------------------------1. return ฮฃ. Enc ๐พ,๐‘€

Definition: The IND-CPA-advantage of an

adversary ๐ด is

๐€๐๐ฏฮฃindโ€“cpa

๐ด = 2 โ‹… Pr ๐„๐ฑ๐ฉฮฃindโ€“cpa

๐ด โ‡’ true โˆ’ 1

Test me on ๐‘€0, ๐‘€1

๐ถโˆ—

๐‘‹1, ๐‘‹2, โ€ฆ

๐ถ1, ๐ถ2, โ€ฆ

Enc(๐พ,โ‹…)

๐‘‹1, ๐‘‹2, โ€ฆ

๐ถ1, ๐ถ2, โ€ฆ

Enc(๐พ,โ‹…)

๐ถโˆ— was an

encryption of ๐‘€1

๐€๐๐ฏฮฃindโ€“cpa

๐ด โ‰ˆ 1 = adversary is doing well

๐€๐๐ฏฮฃindโ€“cpa

๐ด โ‰ˆ 0 = adversary is doing poorly

ECB IND-CPA insecurity

13

๐„๐ฑ๐ฉECB[โ„ฐ]indโ€“cpa

๐ด

1. ๐‘โ†$

0,1

2. ๐พโ†$ECB. KeyGen

3. ๐‘€0, ๐‘€1 โ† ๐ดโ„ฐ๐พ โ‹… // find stage4. if ๐‘€0 โ‰  ๐‘€1 then5. returnโŠฅ6. ๐ถโˆ— โ† ECB. Enc ๐พ,๐‘€๐‘

7. ๐‘โ€ฒ โ† ๐ดโ„ฐ๐พ โ‹… ๐ถโˆ— // guess stage

8. ๐ซ๐ž๐ญ๐ฎ๐ซ๐ง ๐‘โ€ฒ =?๐‘

โ„ฐ๐พ ๐‘€---------------------------------1. return ECB. Enc ๐พ,๐‘€

Adversary ๐‘จ

1. Query ๐ถ โ† โ„ฐ๐พ 0128 in find stage 2. Submit ๐‘€0 = 0128 and ๐‘€1 = 1128

3. Receive challenge ๐ถโˆ—

4. if ๐ถโˆ— = ๐ถ output 05. else, output 1

Pr ๐„๐ฑ๐ฉECB[โ„ฐ]indโ€“cpa

๐ด โ‡’ true

= 1

= Pr ๐‘โ€ฒ = 0 ๐‘ = 0 โ‹… 1/2 + Pr ๐‘โ€ฒ = 1 ๐‘ = 1 โ‹… 1/2

= Pr โ„ฐ๐พ 0128 = โ„ฐ๐พ 0128 ๐‘ = 0 + Pr โ„ฐ๐พ 0128 โ‰  โ„ฐ๐พ 1128 ๐‘ = 1 โ‹… 1/ 2

1

= Pr ๐‘โ€ฒ = ๐‘

1

๐€๐๐ฏฮฃindโ€“cpa

๐ด = 2 โ‹… Pr ๐„๐ฑ๐ฉฮฃindโ€“cpa

๐ด โ‡’ true โˆ’ 1 = 1

Consequences of the definition

โ€ข An IND-CPA secure scheme cannot be deterministic

โ€ข IND-CPA security implies other properties that we want:

โ€ข P1: Should be hard to obtain ๐พ from ๐‘Œ โ† ๐ธ๐พ(๐‘‹) for secret ๐พ

โ€ข P2: Should be hard to obtain ๐พ from ๐‘Œ1, ๐‘Œ2, โ€ฆ where ๐‘Œ๐‘– โ† ๐ธ๐พ ๐‘‹๐‘–โ€ข P3: Should be hard to obtain ๐‘‹ from ๐‘Œ โ† ๐ธ๐พ(๐‘‹)

โ€ข P4: Should be hard to obtain any ๐‘‹๐‘– from ๐‘Œ1, ๐‘Œ2 , โ€ฆ where ๐‘Œ๐‘– โ† ๐ธ๐พ ๐‘‹๐‘–โ€ข P5: Should be hard to learn any bit of ๐‘‹ from ๐‘Œ โ† ๐ธ๐พ(๐‘‹)

โ€ข P6: Should be hard to detect repetitions among ๐‘‹1, ๐‘‹2, โ€ฆ from ๐‘Œ1, ๐‘Œ2, โ€ฆ

โ€ข

โ€ข But does it give us all the properties we want? I.e., is IND-CPA the "master property"?

14

Semantic security

โ€ข The conceptually "right" definition

โ€ข High level idea: an encryption scheme is semantically secure if by observing

a ciphertext ๐ถ the adversary learns nothing about the plaintext (except its

length)

โ€ข Harder to formalize + IND-CPA is easier to work with

15

Theorem: (Goldwasser & Micali '83)

An encryption scheme ฮฃ is IND-CPA secure โŸบ ฮฃ is semantically secure.

Length-leaking attacks

โ€ข Google maps

โ€ข World regions have unique "fingerprints" based on length of data (based on map tiles)

โ€ข Variable-bitrate encoding

โ€ข Can e.g., fingerprint movies streamed over Netflix

โ€ข To combat length-leaking attacks: message padding

โ€ข Can be expensive

โ€ข Supported in TLS, but seldom used

โ€ข Used by TOR

16

CONSTRUCTING SYMMETRIC ENCRYPTION

SCHEMES

17

How to achieve non-deterministic encryption?

โ€ข Randomized encryption

โ€ข Coins flipped internally by the algorithm

โ€ข Nonce-based encryption

โ€ข Encryption scheme itself is deterministic

โ€ข Non-determinism injected from the outside

18

๐‘€

Ciphertext

๐‘€โ€ฒ

Plaintext

CTR$ mode

Block cipher โ„ฐ: 0,1 ๐‘˜ ร— 0,1 ๐‘› โ†’ 0,1 ๐‘›

CTR$ โ„ฐ = KeyGen, Enc, Dec :

19

Alg Enc ๐พ,๐‘€---------------------------------

1. ctrโ†$

0,1 ๐‘›

2. ๐ถ0 โ† ctr3. for ๐‘– = 1,โ€ฆ ,๐‘š do4. ๐ถ๐‘– โ† โ„ฐ๐พ ctr + ๐‘– โŠ•๐‘€๐‘–

5. return ๐ถ0||๐ถ1||โ‹ฏ ||๐ถ๐‘š

Alg Dec ๐พ, ๐ถ---------------------------------1. ctr โ† ๐ถ02. for ๐‘– = 1,โ€ฆ ,๐‘š do3. ๐‘€๐‘– โ† โ„ฐ๐พ ctr + ๐‘– โŠ• ๐ถ๐‘–4. return๐‘€1||๐‘€2||โ‹ฏ ||๐‘€๐‘š

ctr + 1

๐ถ1

ctr

๐ถ0

โ„ฐ๐พ

๐‘€1

ctr + 2

๐ถ2

โ„ฐ๐พ

๐‘€2

ctr + 3

๐ถ3

โ„ฐ๐พ

๐‘€3

CTR properties

โ€ข Fully parallelizable

โ€ข Inverse direction of โ„ฐ๐พ not needed

โ€ข Can use a PRF instead of a PRP

โ€ข Key stream can be generated in advance

โ€ข No padding needed for messages not a multiple of block length

โ€ข What about security?

20

ctr + 1

๐ถ1

ctr

๐ถ0

โ„ฐ๐พ

๐‘€1

ctr + 2

๐ถ2

โ„ฐ๐พ

๐‘€2

ctr + 3

๐ถ3

โ„ฐ๐พ

๐‘€3

Modern approach to cryptography

โ€ข Trying to make cryptography more a science than an art

โ€ข Focus on formal definitions of security (and insecurity)

โ€ข Clearly stated assumptions

โ€ข Analysis supported by mathematical proofs

21

Security of CTR$

22

Theorem (idea):

If ๐น: 0,1 ๐‘˜ ร— 0,1 ๐‘› โ†’ 0,1 ๐‘› is a secure PRF then CTR$[๐น] is IND-CPA secure.

Logic 101

is equivalent to:

Theorem (idea):

If CTR$[๐น] is not IND-CPA secure then ๐น is not a secure PRF.

โŸบ equivalent!

Security of CTR$

Proof idea:

โ€ข CTR$[๐น] not IND-CPA secure โŸน there exists adversary ๐ด with good advantage ๐€๐๐ฏCTR$ ๐นindโ€“cpa

๐ด

โ€ข Can use ๐ด to create a new adversary ๐ต that has good advantage ๐€๐๐ฏ๐นprf

๐ต against ๐น

โŸน ๐น is not a secure PRF!

23

Theorem (idea):

If CTR$[๐น] is not IND-CPA secure then ๐น is not a secure PRF.

Security of CTR$

24

Theorem (actual): For any IND-CPA adversary ๐ด against CTR$ ๐น that runs in time ๐‘ก๐ดand asks at most ๐‘ž queries (each of max length ๐‘ž ๐‘›-bit blocks), there exists an PRF-

adversary ๐ต such that

๐€๐๐ฏCTR$ ๐นindโ€“cpa

๐ด โ‰ค ๐€๐๐ฏ๐นprf

๐ต +2๐‘ž2

2๐‘›

where ๐ต runs in time ๐‘ก๐ต = ๐‘ก๐ด + ๐‘‚(๐‘ž2) and asks at most ๐‘ž๐ต = ๐‘ž2 PRF-queries.

Security of CTR$

โ€ข Logic 101: ๐น secure PRF โŸน๐€๐๐ฏ๐นprf

๐ต โ‰ˆ 0

โŸน๐€๐๐ฏCTR$ ๐นindโ€“cpa

๐ด โ‰ค2๐‘ž2

2๐‘›

โŸน๐€๐๐ฏCTR$ ๐นindโ€“cpa

๐ด โ‰ˆ 0

โŸน CTR$[๐น] is IND-CPA secure!

25

Theorem (actual): For any IND-CPA adversary ๐ด against CTR$ ๐น that runs in time ๐‘ก๐ดand asks at most ๐‘ž queries (each of max length ๐‘ž ๐‘›-bit blocks), there exists an PRF-

adversary ๐ต such that

๐€๐๐ฏCTR$ ๐นindโ€“cpa

๐ด โ‰ค ๐€๐๐ฏ๐นprf

๐ต +2๐‘ž2

2๐‘›

where ๐ต runs in time ๐‘ก๐ต = ๐‘ก๐ด + ๐‘‚(๐‘ž2) and asks at most ๐‘ž๐ต = ๐‘ž2 PRF-queries.

๐‘ž โ‰ช 2๐‘›/2

Example:

AES: ๐‘› = 128๐‘ž = 240 โ‰ˆ 17.5 TB of data

Security of CTR$ โ€“ proof idea

26

๐„๐ฑ๐ฉCTR$ โ„ฐindโ€“cpa

๐ด

1. ๐‘โ†$

0,1

2. ๐พโ†$CTR$ ๐น . KeyGen

3. ๐‘€0,๐‘€1 โ† ๐ดโ„ฐ๐พ โ‹… // find stage4. if ๐‘€0 โ‰  ๐‘€1 then5. returnโŠฅ6. ๐ถโˆ— โ† CTR$ โ„ฐ . Enc ๐พ,๐‘€๐‘

7. ๐‘โ€ฒ โ† ๐ดโ„ฐ๐พ โ‹… ๐ถโˆ— // guess stage

8. ๐ซ๐ž๐ญ๐ฎ๐ซ๐ง ๐‘โ€ฒ =?๐‘

โ„ฐ๐พ ๐‘€---------------------------------1. return CTR$ ๐น . Enc ๐พ,๐‘€

๐‘€1 ๐‘€2 ๐‘€3 โ‹ฏ ๐‘€๐ฟ

๐น๐พ(๐‘…โˆ— + 1) ๐น๐พ(๐‘…

โˆ— + 2) ๐น๐พ(๐‘…โˆ— + 3) โ‹ฏ ๐น๐พ(๐‘…

โˆ— + ๐ฟ) Alg CTR ๐น . Enc ๐พ,๐‘€---------------------------------

1. ctrโ†$

0,1 ๐‘›

2. ๐ถ0 โ† ctr3. for ๐‘– = 1,โ€ฆ ,๐‘š do4. ๐ถ๐‘– โ† ๐น๐พ ctr + ๐‘– โŠ•๐‘€๐‘–

5. return๐ถ0||๐ถ1||โ‹ฏ ||๐ถ๐‘š

๐ถ1โˆ— ๐ถ2

โˆ— ๐ถ3โˆ— โ‹ฏ ๐ถ๐ฟ

โˆ—

=

๐‘€๐‘

๐ถโˆ—

Theorem: For any ๐ด โ€ฆ there exists ๐ต such that

๐€๐๐ฏCTR$ ๐นindโ€“cpa

๐ด โ‰ค ๐€๐๐ฏ๐นprf

๐ต +2๐‘ž2

2๐‘›

Security of CTR$ โ€“ proof idea

27

Theorem: For any ๐ด โ€ฆ there exists ๐ต such that

๐€๐๐ฏCTR$ ๐นindโ€“cpa

๐ด โ‰ค ๐€๐๐ฏ๐นprf

๐ต +2๐‘ž2

2๐‘›

๐„๐ฑ๐ฉCTR$ โ„ฐindโ€“cpa

๐ด

1. ๐‘โ†$

0,1

2. ๐พโ†$CTR$ ๐น . KeyGen

3. ๐‘€0,๐‘€1 โ† ๐ดโ„ฐ๐พ โ‹… // find stage4. if ๐‘€0 โ‰  ๐‘€1 then5. returnโŠฅ6. ๐ถโˆ— โ† CTR$ โ„ฐ . Enc ๐พ,๐‘€๐‘

7. ๐‘โ€ฒ โ† ๐ดโ„ฐ๐พ โ‹… ๐ถโˆ— // guess stage

8. ๐ซ๐ž๐ญ๐ฎ๐ซ๐ง ๐‘โ€ฒ =?๐‘

โ„ฐ๐พ ๐‘€---------------------------------1. return CTR$ ๐น . Enc ๐พ,๐‘€

Alg CTR ๐น . Enc ๐พ,๐‘€---------------------------------

1. ctrโ†$

0,1 ๐‘›

2. ๐ถ0 โ† ctr3. for ๐‘– = 1,โ€ฆ ,๐‘š do4. ๐ถ๐‘– โ† ๐น๐พ ctr + ๐‘– โŠ•๐‘€๐‘–

5. return๐ถ0||๐ถ1||โ‹ฏ ||๐ถ๐‘š

๐‘€1 ๐‘€2 ๐‘€3 โ‹ฏ ๐‘€๐ฟ

=

๐‘€๐‘

๐ถโˆ— ๐œŒโ†$Func[๐‘›, ๐‘›] โ‰ˆ ๐น๐พ by PRF-security

๐œŒ(๐‘…โˆ— + 1) ๐œŒ(๐‘…โˆ— + 2) ๐œŒ(๐‘…โˆ— + 3) โ‹ฏ ๐œŒ(๐‘…โˆ— + ๐ฟ)

๐ถ1โˆ— ๐ถ2

โˆ— ๐ถ3โˆ— โ‹ฏ ๐ถ๐ฟ

โˆ—

Security of CTR$ โ€“ proof idea

28

Theorem: For any ๐ด โ€ฆ there exists ๐ต such that

๐€๐๐ฏCTR$ ๐นindโ€“cpa

๐ด โ‰ค ๐€๐๐ฏ๐นprf

๐ต +2๐‘ž2

2๐‘›

๐„๐ฑ๐ฉCTR$ โ„ฐindโ€“cpa

๐ด

1. ๐‘โ†$

0,1

2. ๐พโ†$CTR$ ๐น . KeyGen

3. ๐‘€0,๐‘€1 โ† ๐ดโ„ฐ๐พ โ‹… // find stage4. if ๐‘€0 โ‰  ๐‘€1 then5. returnโŠฅ6. ๐ถโˆ— โ† CTR$ โ„ฐ . Enc ๐พ,๐‘€๐‘

7. ๐‘โ€ฒ โ† ๐ดโ„ฐ๐พ โ‹… ๐ถโˆ— // guess stage

8. ๐ซ๐ž๐ญ๐ฎ๐ซ๐ง ๐‘โ€ฒ =?๐‘

โ„ฐ๐พ ๐‘€---------------------------------1. return CTR$ ๐น . Enc ๐พ,๐‘€

Alg CTR ๐น . Enc ๐พ,๐‘€---------------------------------

1. ctrโ†$

0,1 ๐‘›

2. ๐ถ0 โ† ctr3. for ๐‘– = 1,โ€ฆ ,๐‘š do4. ๐ถ๐‘– โ† ๐น๐พ ctr + ๐‘– โŠ•๐‘€๐‘–

5. return๐ถ0||๐ถ1||โ‹ฏ ||๐ถ๐‘š

๐‘€1 ๐‘€2 ๐‘€3 โ‹ฏ ๐‘€๐ฟ

=

๐‘€๐‘

๐ถโˆ— ๐œŒโ†$Func[๐‘›, ๐‘›] โ‰ˆ ๐น๐พ by PRF-security

๐œŒ(๐‘…โˆ— + 1) ๐œŒ(๐‘…โˆ— + 2) ๐œŒ(๐‘…โˆ— + 3) โ‹ฏ ๐œŒ(๐‘…โˆ— + ๐ฟ)

๐ถ1โˆ— ๐ถ2

โˆ— ๐ถ3โˆ— โ‹ฏ ๐ถ๐ฟ

โˆ—

๐ถ1โˆ— ๐ถ2

โˆ— ๐ถ3โˆ— โ‹ฏ ๐ถ๐ฟ

โˆ—

Security of CTR$ โ€“ proof idea

29

Theorem: For any ๐ด โ€ฆ there exists ๐ต such that

๐€๐๐ฏCTR$ ๐นindโ€“cpa

๐ด โ‰ค ๐€๐๐ฏ๐นprf

๐ต +2๐‘ž2

2๐‘›

๐„๐ฑ๐ฉCTR$ โ„ฐindโ€“cpa

๐ด

1. ๐‘โ†$

0,1

2. ๐พโ†$CTR$ ๐น . KeyGen

3. ๐‘€0,๐‘€1 โ† ๐ดโ„ฐ๐พ โ‹… // find stage4. if ๐‘€0 โ‰  ๐‘€1 then5. returnโŠฅ6. ๐ถโˆ— โ† CTR$ โ„ฐ . Enc ๐พ,๐‘€๐‘

7. ๐‘โ€ฒ โ† ๐ดโ„ฐ๐พ โ‹… ๐ถโˆ— // guess stage

8. ๐ซ๐ž๐ญ๐ฎ๐ซ๐ง ๐‘โ€ฒ =?๐‘

โ„ฐ๐พ ๐‘€---------------------------------1. return CTR$ ๐น . Enc ๐พ,๐‘€

Alg CTR ๐น . Enc ๐พ,๐‘€---------------------------------

1. ctrโ†$

0,1 ๐‘›

2. ๐ถ0 โ† ctr3. for ๐‘– = 1,โ€ฆ ,๐‘š do4. ๐ถ๐‘– โ† ๐น๐พ ctr + ๐‘– โŠ•๐‘€๐‘–

5. return๐ถ0||๐ถ1||โ‹ฏ ||๐ถ๐‘š

๐‘€1 ๐‘€2 ๐‘€3 โ‹ฏ ๐‘€๐ฟ

=

๐‘€๐‘

๐ถโˆ— ๐œŒโ†$Func[๐‘›, ๐‘›] โ‰ˆ ๐น๐พ by PRF-securityOTP

๐œŒ(๐‘…โˆ— + 1) ๐œŒ(๐‘…โˆ— + 2) ๐œŒ(๐‘…โˆ— + 3) โ‹ฏ ๐œŒ(๐‘…โˆ— + ๐ฟ)

๐ถ1โˆ— ๐ถ2

โˆ— ๐ถ3โˆ— โ‹ฏ ๐ถ๐ฟ

โˆ—

Security of CTR$ โ€“ proof idea

30

Theorem: For any ๐ด โ€ฆ there exists ๐ต such that

๐€๐๐ฏCTR$ ๐นindโ€“cpa

๐ด โ‰ค ๐€๐๐ฏ๐นprf

๐ต +2๐‘ž2

2๐‘›

๐„๐ฑ๐ฉCTR$ โ„ฐindโ€“cpa

๐ด

1. ๐‘โ†$

0,1

2. ๐พโ†$CTR$ ๐น . KeyGen

3. ๐‘€0,๐‘€1 โ† ๐ดโ„ฐ๐พ โ‹… // find stage4. if ๐‘€0 โ‰  ๐‘€1 then5. returnโŠฅ6. ๐ถโˆ— โ† CTR$ โ„ฐ . Enc ๐พ,๐‘€๐‘

7. ๐‘โ€ฒ โ† ๐ดโ„ฐ๐พ โ‹… ๐ถโˆ— // guess stage

8. ๐ซ๐ž๐ญ๐ฎ๐ซ๐ง ๐‘โ€ฒ =?๐‘

โ„ฐ๐พ ๐‘€---------------------------------1. return CTR$ ๐น . Enc ๐พ,๐‘€

Alg CTR ๐น . Enc ๐พ,๐‘€---------------------------------

1. ctrโ†$

0,1 ๐‘›

2. ๐ถ0 โ† ctr3. for ๐‘– = 1,โ€ฆ ,๐‘š do4. ๐ถ๐‘– โ† ๐น๐พ ctr + ๐‘– โŠ•๐‘€๐‘–

5. return๐ถ0||๐ถ1||โ‹ฏ ||๐ถ๐‘š

๐‘€1 ๐‘€2 ๐‘€3 โ‹ฏ ๐‘€๐ฟ

=

๐‘€๐‘

๐ถโˆ— ๐œŒโ†$Func[๐‘›, ๐‘›] โ‰ˆ ๐น๐พ by PRF-security

๐‘€(1)โ„ฐ๐พ

๐‘…1||๐ถ11||๐ถ2

(1)โ€ฆ

๐‘€(2)โ„ฐ๐พ

๐‘…2||๐ถ12||๐ถ2

(2)โ€ฆ

โ‹ฎ

๐‘€(๐‘ž)โ„ฐ๐พ

๐‘…๐‘ž||๐ถ1๐‘ž||๐ถ2

(๐‘ž)โ€ฆ

๐œŒ(๐‘…โˆ— + 1) ๐œŒ(๐‘…โˆ— + 2) ๐œŒ(๐‘…โˆ— + 3) โ‹ฏ ๐œŒ(๐‘…โˆ— + ๐ฟ)

๐ถ1โˆ— ๐ถ2

โˆ— ๐ถ3โˆ— โ‹ฏ ๐ถ๐ฟ

โˆ—

Security of CTR$ โ€“ proof idea

31

Theorem: For any ๐ด โ€ฆ there exists ๐ต such that

๐€๐๐ฏCTR$ ๐นindโ€“cpa

๐ด โ‰ค ๐€๐๐ฏ๐นprf

๐ต +2๐‘ž2

2๐‘›

๐„๐ฑ๐ฉCTR$ โ„ฐindโ€“cpa

๐ด

1. ๐‘โ†$

0,1

2. ๐พโ†$CTR$ ๐น . KeyGen

3. ๐‘€0,๐‘€1 โ† ๐ดโ„ฐ๐พ โ‹… // find stage4. if ๐‘€0 โ‰  ๐‘€1 then5. returnโŠฅ6. ๐ถโˆ— โ† CTR$ โ„ฐ . Enc ๐พ,๐‘€๐‘

7. ๐‘โ€ฒ โ† ๐ดโ„ฐ๐พ โ‹… ๐ถโˆ— // guess stage

8. ๐ซ๐ž๐ญ๐ฎ๐ซ๐ง ๐‘โ€ฒ =?๐‘

โ„ฐ๐พ ๐‘€---------------------------------1. return CTR$ ๐น . Enc ๐พ,๐‘€

Alg CTR ๐น . Enc ๐พ,๐‘€---------------------------------

1. ctrโ†$

0,1 ๐‘›

2. ๐ถ0 โ† ctr3. for ๐‘– = 1,โ€ฆ ,๐‘š do4. ๐ถ๐‘– โ† ๐น๐พ ctr + ๐‘– โŠ•๐‘€๐‘–

5. return๐ถ0||๐ถ1||โ‹ฏ ||๐ถ๐‘š

๐‘€1 ๐‘€2 ๐‘€3 โ‹ฏ ๐‘€๐ฟ

=

๐‘€๐‘

๐ถโˆ— ๐œŒโ†$Func[๐‘›, ๐‘›] โ‰ˆ ๐น๐พ by PRF-security

๐‘€(1)โ„ฐ๐พ

๐‘…1||๐ถ11||๐ถ2

1โ€ฆ = ๐‘…1||๐œŒ(๐‘…1 + 1)โŠ•๐‘€1

1||๐œŒ(๐‘…1 + 2)โŠ•๐‘€2

1|| โ€ฆ

๐‘€(2)โ„ฐ๐พ

๐‘…2||๐ถ12||๐ถ2

(2)โ€ฆ = ๐‘…2||๐œŒ(๐‘…2 + 1)โŠ•๐‘€1

2||๐œŒ(๐‘…2 + 2)โŠ•๐‘€2

2|| โ€ฆ

โ‹ฎ

๐‘€(๐‘ž)โ„ฐ๐พ

๐‘…๐‘ž||๐ถ1๐‘ž||๐ถ2

(๐‘ž)โ€ฆ = ๐‘…๐‘ž||๐œŒ(๐‘…๐‘ž + 1)โŠ•๐‘€1

๐‘ž||๐œŒ(๐‘…๐‘ž + 2)โŠ•๐‘€2

๐‘ž|| โ€ฆ

๐œŒ(๐‘…โˆ— + 1) ๐œŒ(๐‘…โˆ— + 2) ๐œŒ(๐‘…โˆ— + 3) โ‹ฏ ๐œŒ(๐‘…โˆ— + ๐ฟ)

๐ถ1โˆ— ๐ถ2

โˆ— ๐ถ3โˆ— โ‹ฏ ๐ถ๐ฟ

โˆ—

Security of CTR$ โ€“ proof idea

32

Theorem: For any ๐ด โ€ฆ there exists ๐ต such that

๐€๐๐ฏCTR$ ๐นindโ€“cpa

๐ด โ‰ค ๐€๐๐ฏ๐นprf

๐ต +2๐‘ž2

2๐‘›

๐„๐ฑ๐ฉCTR$ โ„ฐindโ€“cpa

๐ด

1. ๐‘โ†$

0,1

2. ๐พโ†$CTR$ ๐น . KeyGen

3. ๐‘€0,๐‘€1 โ† ๐ดโ„ฐ๐พ โ‹… // find stage4. if ๐‘€0 โ‰  ๐‘€1 then5. returnโŠฅ6. ๐ถโˆ— โ† CTR$ โ„ฐ . Enc ๐พ,๐‘€๐‘

7. ๐‘โ€ฒ โ† ๐ดโ„ฐ๐พ โ‹… ๐ถโˆ— // guess stage

8. ๐ซ๐ž๐ญ๐ฎ๐ซ๐ง ๐‘โ€ฒ =?๐‘

โ„ฐ๐พ ๐‘€---------------------------------1. return CTR$ ๐น . Enc ๐พ,๐‘€

Alg CTR ๐น . Enc ๐พ,๐‘€---------------------------------

1. ctrโ†$

0,1 ๐‘›

2. ๐ถ0 โ† ctr3. for ๐‘– = 1,โ€ฆ ,๐‘š do4. ๐ถ๐‘– โ† ๐น๐พ ctr + ๐‘– โŠ•๐‘€๐‘–

5. return๐ถ0||๐ถ1||โ‹ฏ ||๐ถ๐‘š

๐‘€1 ๐‘€2 ๐‘€3 โ‹ฏ ๐‘€๐ฟ

๐œŒ(๐‘…โˆ— + 1) ๐œŒ(๐‘…โˆ— + 2) ๐œŒ(๐‘…โˆ— + 3) โ‹ฏ ๐œŒ(๐‘…โˆ— + ๐ฟ)

=

๐‘€๐‘

๐ถโˆ— ๐œŒโ†$Func[๐‘›, ๐‘›] โ‰ˆ ๐น๐พ by PRF-security

๐‘€(1)โ„ฐ๐พ

๐‘…1||๐ถ11||๐ถ2

1โ€ฆ = ๐‘…1||๐œŒ(๐‘…1 + 1)โŠ•๐‘€1

1||๐œŒ(๐‘…1 + 2)โŠ•๐‘€2

1|| โ€ฆ

๐‘€(2)โ„ฐ๐พ

๐‘…2||๐ถ12||๐ถ2

(2)โ€ฆ = ๐‘…2||๐œŒ(๐‘…2 + 1)โŠ•๐‘€1

2||๐œŒ(๐‘…2 + 2)โŠ•๐‘€2

2|| โ€ฆ

โ‹ฎ

๐‘€(๐‘ž)โ„ฐ๐พ

๐‘…๐‘ž||๐ถ1๐‘ž||๐ถ2

(๐‘ž)โ€ฆ = ๐‘…๐‘ž||๐œŒ(๐‘…๐‘ž + 1)โŠ•๐‘€1

๐‘ž||๐œŒ(๐‘…๐‘ž + 2)โŠ•๐‘€2

๐‘ž|| โ€ฆ

Event ๐‚๐จ๐ฅ๐ฅ๐’Š:

๐‘…๐‘– + ๐‘— = ๐‘…โˆ— + ๐‘—โ€ฒ โŸน ๐œŒ ๐‘…๐‘– + ๐‘— = ๐œŒ ๐‘…โˆ— + ๐‘—โ€ฒ = ๐‘ƒ

โŸน ๐ถ๐‘—๐‘–โŠ•๐ถ๐‘—โ€ฒ

โˆ— = ๐‘ƒ โŠ•๐‘€๐‘—๐‘–

โŠ• ๐‘ƒ โŠ•๐‘€๐‘—โ€ฒโˆ— = ๐‘€๐‘—

๐‘–โŠ•๐‘€๐‘—โ€ฒ

โˆ—

Security of CTR$ โ€“ proof idea

33

๐‘…โˆ—, ๐‘…โˆ— + 1,โ€ฆ ๐‘…๐‘— , ๐‘…๐‘—+1,โ€ฆ๐‘…๐‘– , ๐‘…๐‘–+1,โ€ฆ ๐‘…๐‘˜, ๐‘…๐‘˜+1,โ€ฆ

0 1 โ€ฆ 2๐‘› โˆ’ 1

Security of CTR$ โ€“ proof idea

34

๐‘…โˆ—, ๐‘…โˆ— + 1,โ€ฆ ๐‘…๐‘— , ๐‘…๐‘—+1,โ€ฆ๐‘…๐‘– , ๐‘…๐‘–+1,โ€ฆ ๐‘…๐‘˜, ๐‘…๐‘˜+1,โ€ฆ

0 1 โ€ฆ 2๐‘› โˆ’ 1Coll๐‘—

Coll = Coll1 โˆจ Coll2 โˆจ โ‹ฏโˆจ Coll๐‘ž

Pr Coll = Pr Coll1 โˆจ Coll2 โˆจ โ‹ฏโˆจ Coll๐‘ž โ‰ค

๐‘—=1

๐‘ž

Pr Coll๐‘—

Pr Coll๐‘— = Pr ๐‘…โˆ— + 1 โˆ’ ๐ฟ โ‰ค ๐‘…๐‘— โ‰ค ๐‘…โˆ— + ๐ฟ โˆ’ 1

Security of CTR$ โ€“ proof idea

35

๐‘…โˆ—, ๐‘…โˆ— + 1,โ€ฆ ๐‘…๐‘— , ๐‘…๐‘—+1,โ€ฆ๐‘…๐‘– , ๐‘…๐‘–+1,โ€ฆ ๐‘…๐‘˜, ๐‘…๐‘˜+1,โ€ฆ

0 1 โ€ฆ 2๐‘› โˆ’ 1

Coll = Coll1 โˆจ Coll2 โˆจ โ‹ฏโˆจ Coll๐‘ž

Pr Coll = Pr Coll1 โˆจ Coll2 โˆจ โ‹ฏโˆจ Coll๐‘ž โ‰ค

๐‘—=1

๐‘ž

Pr Coll๐‘—

Pr Coll๐‘— = Pr ๐‘…โˆ— + 1 โˆ’ ๐ฟ โ‰ค ๐‘…๐‘— โ‰ค ๐‘…โˆ— + ๐ฟ โˆ’ 1

Coll๐‘—

Security of CTR$ โ€“ proof idea

36

๐‘…โˆ—, ๐‘…โˆ— + 1,โ€ฆ๐‘…๐‘— , ๐‘…๐‘—+1,โ€ฆ๐‘…๐‘– , ๐‘…๐‘–+1,โ€ฆ ๐‘…๐‘˜, ๐‘…๐‘˜+1,โ€ฆ

0 1 โ€ฆ 2๐‘› โˆ’ 1

Coll = Coll1 โˆจ Coll2 โˆจ โ‹ฏโˆจ Coll๐‘ž

Pr Coll = Pr Coll1 โˆจ Coll2 โˆจ โ‹ฏโˆจ Coll๐‘ž โ‰ค

๐‘—=1

๐‘ž

Pr Coll๐‘—

Pr Coll๐‘— = Pr ๐‘…โˆ— + 1 โˆ’ ๐ฟ โ‰ค ๐‘…๐‘— โ‰ค ๐‘…โˆ— + ๐ฟ โˆ’ 1

Coll๐‘—

Security of CTR$ โ€“ proof idea

37

Coll = Coll1 โˆจ Coll2 โˆจ โ‹ฏโˆจ Coll๐‘ž

Pr Coll = Pr Coll1 โˆจ Coll2 โˆจ โ‹ฏโˆจ Coll๐‘ž โ‰ค

๐‘—=1

๐‘ž

Pr Coll๐‘—

Pr Coll๐‘— = Pr ๐‘…โˆ— + 1 โˆ’ ๐ฟ โ‰ค ๐‘…๐‘— โ‰ค ๐‘…โˆ— + ๐ฟ โˆ’ 1 โ‰ค2๐ฟ

2๐‘›

๐‘…โˆ—, ๐‘…โˆ— + 1,โ€ฆ๐‘…๐‘— , ๐‘…๐‘—+1,โ€ฆ๐‘…๐‘– , ๐‘…๐‘–+1,โ€ฆ ๐‘…๐‘˜, ๐‘…๐‘˜+1,โ€ฆ

0 1 โ€ฆ 2๐‘› โˆ’ 1

โ‰ค ๐‘ž โ‹…2๐ฟ

2๐‘›=2๐‘ž2

2๐‘›

Coll๐‘—

Security of CTR$ โ€“ proof idea

38

Theorem: For any ๐ด โ€ฆ there exists ๐ต such that

๐€๐๐ฏCTR$ ๐นindโ€“cpa

๐ด โ‰ค ๐€๐๐ฏ๐นprf

๐ต +2๐‘ž2

2๐‘›

๐„๐ฑ๐ฉCTR$ โ„ฐindโ€“cpa

๐ด

1. ๐‘โ†$

0,1

2. ๐พโ†$CTR$ ๐น . KeyGen

3. ๐‘€0,๐‘€1 โ† ๐ดโ„ฐ๐พ โ‹… // find stage4. if ๐‘€0 โ‰  ๐‘€1 then5. returnโŠฅ6. ๐ถโˆ— โ† CTR$ โ„ฐ . Enc ๐พ,๐‘€๐‘

7. ๐‘โ€ฒ โ† ๐ดโ„ฐ๐พ โ‹… ๐ถโˆ— // guess stage

8. ๐ซ๐ž๐ญ๐ฎ๐ซ๐ง ๐‘โ€ฒ =?๐‘

โ„ฐ๐พ ๐‘€---------------------------------1. return CTR$ ๐น . Enc ๐พ,๐‘€

Alg CTR ๐น . Enc ๐พ,๐‘€---------------------------------

1. ctrโ†$

0,1 ๐‘›

2. ๐ถ0 โ† ctr3. for ๐‘– = 1,โ€ฆ ,๐‘š do4. ๐ถ๐‘– โ† ๐น๐พ ctr + ๐‘– โŠ•๐‘€๐‘–

5. return๐ถ0||๐ถ1||โ‹ฏ ||๐ถ๐‘š

๐‘€1 ๐‘€2 ๐‘€3 โ‹ฏ ๐‘€๐ฟ

=

๐‘€๐‘

๐ถโˆ— ๐œŒโ†$Func[๐‘›, ๐‘›] โ‰ˆ ๐น๐พ by PRF-security

๐œŒ(๐‘…โˆ— + 1) ๐œŒ(๐‘…โˆ— + 2) ๐œŒ(๐‘…โˆ— + 3) โ‹ฏ ๐œŒ(๐‘…โˆ— + ๐ฟ)

๐ถ1โˆ— ๐ถ2

โˆ— ๐ถ3โˆ— โ‹ฏ ๐ถ๐ฟ

โˆ—

Nonce-based encryption

โ€ข Initial value in CTR$ chosen at random

โ€ข Not actually neccessary; sufficient that no inputs to underlying PRF/PRP

repeat

โ€ข A simple counter works

โ€ข More generally: any number not used more than once โ€“ a nonce (number

used once)

โ€ข CTR: nonce-based counter-mode

39

Nonce-based encryption โ€“ new syntax

โ€ข Enc is now a deterministic function

โ€ข Non-determinism comes from varying ๐‘

โ€ข Choose ๐‘ at random โŸน recover probabilistic notion

40

Enc โˆถ ๐’ฆ ร—๐’ฉ ร—โ„ณ โ†’ ๐’ž

Enc ๐พ,๐‘,๐‘€ = Enc๐พ ๐‘,๐‘€ = Enc๐พ๐‘ ๐‘€ Enc

๐พ๐‘€ ๐ถ

๐‘

Nonce-based

Enc๐พ๐‘€ ๐ถ

$

Randomized

IND-CPA โ€“ Indistinguishability against chosen-plaintext attacks

41

๐„๐ฑ๐ฉฮฃindโ€“cpa

๐ด

1. ๐‘โ†$

0,1

2. ๐พโ†$ฮฃ. KeyGen

3. ๐‘€0, ๐‘€1 โ† ๐ดโ„ฐ๐พ โ‹… // find stage4. if ๐‘€0 โ‰  ๐‘€1 then5. returnโŠฅ6. ๐ถโˆ— โ† ฮฃ. Enc ๐พ,๐‘€๐‘

7. ๐‘โ€ฒ โ† ๐ดโ„ฐ๐พ โ‹… ๐ถโˆ— // guess stage

8. ๐ซ๐ž๐ญ๐ฎ๐ซ๐ง ๐‘โ€ฒ =?๐‘

โ„ฐ๐พ ๐‘€---------------------------------1.2.3. return ฮฃ. Enc ๐พ,๐‘€

IND-CPA โ€“ Indistinguishability against chosen-plaintext attacks

42

๐„๐ฑ๐ฉฮฃindโ€“cpa

๐ด

1. ๐‘โ†$

0,1

2. ๐พโ†$ฮฃ. KeyGen

3. ๐‘,๐‘€0, ๐‘€1 โ† ๐ดโ„ฐ๐พ โ‹…,โ‹… // find stage4. if ๐‘€0 โ‰  ๐‘€1 then5. returnโŠฅ6. ๐ถโˆ— โ† ฮฃ. Enc ๐พ,๐‘,๐‘€๐‘

7. ๐‘โ€ฒ โ† ๐ดโ„ฐ๐พ โ‹…,โ‹… ๐ถโˆ— // guess stage

8. ๐ซ๐ž๐ญ๐ฎ๐ซ๐ง ๐‘โ€ฒ =?๐‘

โ„ฐ๐พ ๐‘,๐‘€---------------------------------1.2.3. return ฮฃ. Enc ๐พ,๐‘,๐‘€

IND-CPA โ€“ Indistinguishability against chosen-plaintext attacks

43

๐„๐ฑ๐ฉฮฃindโ€“cpa

๐ด

1. ๐‘โ†$

0,1

2. ๐พโ†$ฮฃ. KeyGen

3. ๐‘,๐‘€0, ๐‘€1 โ† ๐ดโ„ฐ๐พ โ‹…,โ‹… // find stage4. if ๐‘€0 โ‰  ๐‘€1 then5. returnโŠฅ6. ๐ถโˆ— โ† ฮฃ. Enc ๐พ,๐‘,๐‘€๐‘

7. ๐‘โ€ฒ โ† ๐ดโ„ฐ๐พ โ‹…,โ‹… ๐ถโˆ— // guess stage

8. ๐ซ๐ž๐ญ๐ฎ๐ซ๐ง ๐‘โ€ฒ =?๐‘

โ„ฐ๐พ ๐‘,๐‘€---------------------------------1. if ๐‘ queried before:2. returnโŠฅ3. return ฮฃ. Enc ๐พ,๐‘,๐‘€

Definition: The (nonce-based) IND-CPA-advantage

of an adversary ๐ด is

๐€๐๐ฏฮฃindโ€“cpa

๐ด = 2 โ‹… Pr ๐„๐ฑ๐ฉฮฃindโ€“cpa

๐ด โ‡’ true โˆ’ 1

(๐‘1, ๐‘‹1), (๐‘2, ๐‘‹2), โ€ฆ

๐ถ1, ๐ถ2, โ€ฆ

Enc(๐พ,โ‹…)

๐ถ1, ๐ถ2, โ€ฆ

Enc(๐พ,โ‹…)

Test me on ๐‘,๐‘€0 , (๐‘,๐‘€1)

๐ถโˆ—

(๐‘1, ๐‘‹1), (๐‘2, ๐‘‹2), โ€ฆ

๐ถโˆ— was an

encryption of ๐‘€1

Nonce-based CTR

โ€ข Nonce value must be updated and stored by sender

โ€ข Stateful encryption

โ€ข Receiver doesn't need to store state

โ€ข Alternatively: pick nonce at random

โ€ข Gives CTR$

โ€ข Common in practice:

โ€ข pick some parts of N at random and let the rest be a counter

(always starting at 0)

โ€ข e.g., 96 bits random and 32 bits counter for 128-bits N

44

Alg Enc ๐พ,๐‘,๐‘€---------------------------------1. for ๐‘– = 1, โ€ฆ ,๐‘š do2. ๐ถ๐‘– โ† โ„ฐ๐พ ๐‘ + ๐‘– โŠ•๐‘€๐‘–

3. return ๐ถ1||๐ถ2||โ‹ฏ ||๐ถ๐‘š

AlgDec ๐พ,๐‘, ๐ถ---------------------------------1. for ๐‘– = 1, โ€ฆ ,๐‘š do2. ๐‘€๐‘– โ† โ„ฐ๐พ ๐‘ + ๐‘– โŠ• ๐ถ๐‘–3. return๐‘€1||๐‘€2||โ‹ฏ ||๐‘€๐‘š

Nonce-based CTR โ€“ IND-CPA security

45

Theorem: For any IND-CPA adversary ๐ด against CTR ๐น that runs in time ๐‘ก๐ด and asks

at most ๐‘ž๐ด queries (each of at most ๐œŽ๐‘›-bits) โ€“ such that no input values to ๐น are

identical โ€“ there exists an PRF-adversary ๐ต such that

๐€๐๐ฏCTR ๐นindโ€“cpa

๐ด โ‰ค ๐€๐๐ฏ๐นprf

๐ต

where ๐ต runs in time ๐‘ก๐ต = ๐‘ก๐ด + ๐‘‚(๐‘ž๐ด + ๐‘›๐œŽ) and asks at most ๐‘ž๐ต = ๐œŽ PRF-queries.

CBC$ โ€“ Cipher Block Chaining mode

46

CBC

โ€ข IND-CPA secure for random IV

โ€ข Not IND-CPA secure for nonce-based IV (exercise: show this)

โ€ข Not parallelizable; cannot precompute values

โ€ข Inverse of block cipher โ„ฐ needed for decryption

โ€ข Padding needed for messages not a multiple of block length

โ€ข โ€ฆhistorically one of the most used modes-of-operation

47

Alternative definition I โ€“ Left-or-Right CPA

48

๐„๐ฑ๐ฉฮฃlorโ€“cpa

๐ด

1. ๐‘โ†$

0,1

2. ๐พโ†$ฮฃ. KeyGen

3. ๐‘โ€ฒ โ† ๐ดLR๐‘ โ‹…,โ‹…

4. ๐ซ๐ž๐ญ๐ฎ๐ซ๐ง ๐‘โ€ฒ =?๐‘

LR๐‘ ๐‘€0, ๐‘€1

---------------------------------1. if ๐‘€0 โ‰  ๐‘€1 then2. returnโŠฅ3.4. return ฮฃ. Enc ๐พ,๐‘€๐‘

Definition: The LOR-CPA-advantage of an

adversary ๐ด is

๐€๐๐ฏฮฃlorโ€“cpa

๐ด = 2 โ‹… Pr ๐„๐ฑ๐ฉฮฃlorโ€“cpa

๐ด โ‡’ true โˆ’ 1

Theorem: ฮฃ is IND-CPA secure โŸบ ฮฃ is LOR-CPA

secure.

Alternative definition II โ€“ Real-or-random CPA

49

๐„๐ฑ๐ฉฮฃrorโ€“cpa

๐ด

1. ๐‘โ†$

0,1

2. ๐พโ†$ฮฃ. KeyGen

3. ๐‘โ€ฒ โ† ๐ดRoR๐‘ โ‹…

4. ๐ซ๐ž๐ญ๐ฎ๐ซ๐ง ๐‘โ€ฒ =?๐‘

RoR๐‘ ๐‘€---------------------------------

1. ๐‘€0โ†$

0,1 ๐‘€

2. ๐‘€1 โ† ๐‘€3. return ฮฃ. Enc ๐พ,๐‘€๐‘

Definition: The ROR-CPA-advantage of an

adversary ๐ด is

๐€๐๐ฏฮฃrorโ€“cpa

๐ด = 2 โ‹… Pr ๐„๐ฑ๐ฉฮฃrorโ€“cpa

๐ด โ‡’ true โˆ’ 1

Theorem: ฮฃ is IND-CPA secure โŸบ ฮฃ is ROR-CPA

secure.

Alternative definition III โ€“ Real-or-random ciphertext CPA

50

๐„๐ฑ๐ฉฮฃind$โ€“cpa

๐ด

1. ๐‘โ†$

0,1

2. ๐พโ†$ฮฃ. KeyGen

3. ๐‘โ€ฒ โ† ๐ด$๐‘ โ‹…

4. ๐ซ๐ž๐ญ๐ฎ๐ซ๐ง ๐‘โ€ฒ =?๐‘

$๐‘ ๐‘€---------------------------------1. ๐ถ1 โ† ฮฃ. Enc ๐พ,๐‘€

2. ๐ถ0โ†$

0,1 ๐ถ1

3. return ๐ถ๐‘

Definition: The IND$-CPA-advantage of an

adversary ๐ด is

๐€๐๐ฏฮฃind$โ€“cpa

๐ด = 2 โ‹… Pr ๐„๐ฑ๐ฉฮฃind$โ€“cpa

๐ด โ‡’ true โˆ’ 1

Theorem:

ฮฃ is IND-CPA$ secure โŸน ฮฃ is IND-CPA secure.

ฮฃ is IND-CPA$ secure โŸธ ฮฃ is IND-CPA secure.

Relations between notions

51

LOR-CPA โŸบ IND-CPA โŸบ ROR-CPA

IND$-CPA

โŸน

Semantic securityโŸบ

When we say "IND-CPA" without

further qualification, we think of any

of these (equivalent) definitions

IND-CPA โ€“ Indistinguishability against chosen-plaintext attacks

52

๐„๐ฑ๐ฉฮฃindโ€“cpa

๐ด

1. ๐‘โ†$

0,1

2. ๐พโ†$ฮฃ. KeyGen

3. ๐‘€0, ๐‘€1 โ† ๐ดโ„ฐ๐พ โ‹… // find stage4. if ๐‘€0 โ‰  ๐‘€1 then5. returnโŠฅ6. ๐ถโˆ— โ† ฮฃ. Enc ๐พ,๐‘€๐‘

7. ๐‘โ€ฒ โ† ๐ดโ„ฐ๐พ โ‹… ๐ถโˆ— // guess stage

8. ๐ซ๐ž๐ญ๐ฎ๐ซ๐ง ๐‘โ€ฒ =?๐‘

โ„ฐ๐พ ๐‘€---------------------------------1. return ฮฃ. Enc ๐พ,๐‘€

IND-CCA โ€“ Indistinguishability against chosen-ciphertext attacks

53

๐„๐ฑ๐ฉฮฃindโ€“cca ๐ด

1. ๐‘โ†$

0,1

2. ๐พโ†$ฮฃ. KeyGen

3. ๐‘€0, ๐‘€1 โ† ๐ดโ„ฐ๐พ โ‹… ,๐’Ÿ๐พ โ‹… // find stage4. if ๐‘€0 โ‰  ๐‘€1 then5. returnโŠฅ6. ๐ถโˆ— โ† ฮฃ. Enc ๐พ,๐‘€๐‘

7. ๐‘โ€ฒ โ† ๐ดโ„ฐ๐พ โ‹… ,๐’Ÿ๐พ(โ‹…) ๐ถโˆ— // guess stage

8. ๐ซ๐ž๐ญ๐ฎ๐ซ๐ง ๐‘โ€ฒ =?๐‘

โ„ฐ๐พ ๐‘€---------------------------------1. return ฮฃ. Enc ๐พ,๐‘€

๐’Ÿ๐พ ๐ถ---------------------------------1. if ๐ถ = ๐ถโˆ— then2. returnโŠฅ3. return ฮฃ. Dec ๐พ,๐‘€

๐„๐ฑ๐ฉฮฃindโ€“cca ๐ด

1. ๐‘โ†$

0,1

2. ๐พโ†$ฮฃ. KeyGen

3. ๐‘€0, ๐‘€1 โ† ๐ดโ„ฐ๐พ โ‹… ,๐’Ÿ๐พ โ‹… // find stage4. if ๐‘€0 โ‰  ๐‘€1 then5. returnโŠฅ6. ๐ถโˆ— โ† ฮฃ. Enc ๐พ,๐‘€๐‘

7. ๐‘โ€ฒ โ† ๐ดโ„ฐ๐พ โ‹… ,๐’Ÿ๐พ(โ‹…) ๐ถโˆ— // guess stage

8. ๐ซ๐ž๐ญ๐ฎ๐ซ๐ง ๐‘โ€ฒ =?๐‘

โ„ฐ๐พ ๐‘€---------------------------------1. return ฮฃ. Enc ๐พ,๐‘€

๐’Ÿ๐พ ๐ถ---------------------------------1. if ๐ถ = ๐ถโˆ— then2. returnโŠฅ3. return ฮฃ. Dec ๐พ,๐‘€

IND-CCA โ€“ Indistinguishability against chosen-ciphertext attacks

54

Definition: The IND-CCA-advantage of an

adversary ๐ด is

๐€๐๐ฏฮฃindโ€“cca ๐ด = 2 โ‹… Pr ๐„๐ฑ๐ฉฮฃ

indโ€“cca ๐ด โ‡’ true โˆ’ 1

Test me on ๐‘€0, ๐‘€1

๐ถโˆ—

๐‘‹1, ๐‘‹2, โ€ฆ

๐ถ1, ๐ถ2, โ€ฆ

Enc(๐พ,โ‹…)

๐‘‹1, ๐‘‹2, โ€ฆ

๐ถ1, ๐ถ2, โ€ฆ

Enc(๐พ,โ‹…)Dec(๐พ,โ‹…)

Dec(๐พ,โ‹…)

๐ถโˆ— was an

encryption of ๐‘€1

IND-CCA

โ€ข None of the schemes we have looked at today are IND-CCA secure

โ€ข Attacks are easy to demonstrate (exercise)

โ€ข New techniques are needed

โ€ข Next week: message authentication codes

55