Presentation is loading. Please wait.

Presentation is loading. Please wait.

SECURITY AND VERIFICATION Lecture 3: What kind of attacks are there? - Chosen Ciphertexts Attacks Tamara Rezk INDES TEAM, INRIA January 17 th, 2012.

Similar presentations


Presentation on theme: "SECURITY AND VERIFICATION Lecture 3: What kind of attacks are there? - Chosen Ciphertexts Attacks Tamara Rezk INDES TEAM, INRIA January 17 th, 2012."— Presentation transcript:

1 SECURITY AND VERIFICATION Lecture 3: What kind of attacks are there? - Chosen Ciphertexts Attacks Tamara Rezk INDES TEAM, INRIA January 17 th, 2012

2 Plan Lecture 1 Chosen Plaintext Attacks (CPA assumption) CPA schemes: ElGamal, Paillier Lecture 2 Game-based proofs CPA proof: ElGamal Today: CPA proof: Paillier Limits on provable cryptography Chosen Ciphertext Attacks (CCA assumption) CCA1 proof: using proof of knowledge-zero knowledge (PKZK) From interactive to non-interactive PKZK CCA2 an example of a CCA2 scheme

3 Observational Equivalence P 0 and P 1 are observational equivalent with respect to variable x, denoted P 0  {x} P 1 if Pr[P 0 ; x = v] = Pr[P 1 ; x =v] for all v P 0 and P 1 are observational equivalent with respect to variable x, denoted P 0  {x1..xn} P 1 if Pr[P 0 ; x1 = v1 ˄.. x2 = v2 ˄..] = Pr[P 1 ; x1 = v1 ˄.. x2 = v2 ˄..] for all v1…vn

4 Game-based proofs How to prove cryptography? G 0  G 1  G 2 …  G n For each arrow, we have that either : Pr[G i; g=b] ≤ Pr[G i+1; g=b] or G i  {g} G i+1

5 PAILLIER ENCRYPTION Paillier encryption Assume that generateN() is a probabilistic function that generates two primes with the property that gcd(p*q,  (p*q) ) = 1 and g with g a generator for the multiplicative group {1 … n 2 -1}. Then Paillier encryption is defined by: G () = p,q,g:= generateN(); n := p * q; k e := (n, g); k d := (p,q) Assume x is in {1…n-1} E (x, (n,g)) = y := {1.. n-1}; c:= y n * g x mod n 2

6 PROVABLE CRYPTOGRAPHY Decisional Reduosity Assumption CR (x 0, x 1 ) = if (b = 0) then {y:= {1..n-1}; c :=y n mod n 2 } else {c:= {1.. n 2 -1}} DRA = b := {0,1}; p,q,q:= generateN(); n := p * q; B [ CR ] | Pr[DRA; g’ =b] - ½ | is negligible for ɳ ( ɳ is called security parameter, order of the group, ie n 2 -1 ). Attacker B does not have p, or q.

7 PROVABLE CRYPTOGRAPHY Decisional Reduosity Assumption CR (x 0, x 1 ) = if (b = 0) then {y:= {1..n-1}; c :=y n mod n 2 } else {c:= {1.. n 2 -1}} DRA = b := {0,1}; p,q,g:= generateN(); n := p * q; B [ CR ] | Pr[DRA; g’ =b] - ½ | is negligible for ɳ ( ɳ is called security parameter, order of the group, ie n 2 -1 ) nth residuo modulo n 2

8 PROVABLE CRYPTOGRAPHY Chosen-plaintext attack (CPA) E (x 0, x 1 ) = if (b = 0) then {c := E (x 0, k e )} else {c := E (x 1,k e )}; CPA = b := {0,1}; k e, k d := G (); A [ E ] | Pr[CPA; g =b] - ½ | is negligible for ɳ ( ɳ is called security parameter)

9 THEOREM Theorem Paillier encryption scheme is resistent to Chosen Plaintext Attacks

10 PROOF OF CPA OF PAILLIER GAME 0 E (x 0, x 1 ) = if (b = 0) then {c := E (x 0, k e )} else {c := E (x 1,k e )}; CPApaillier = b := {0,1}; k e, k d := G (); A [ E ]

11 PROOF OF CPA OF PAILLIER step 1: INLINE E (x 0, x 1 ) = if (b = 0) then { y := {1.. n-1}; c:= y n * g x0 mod n 2 } else { y := {1.. n-1}; c:= y n * g x1 mod n 2 } CPApaillier1 = b := {0,1}; p,q,q:= generateN(); n := p * q; k e := (n, g); k d := (p,q); A [ E ]

12 PROOF OF CPA OF PAILLIER step 1: INLINE E (x 0, x 1 ) = if (b = 0) then { y := {1.. n-1}; c:= y n * g x0 mod n 2 } else { y := {1.. n-1}; c:= y n * g x1 mod n 2 } CPApaillier1 = b := {0,1}; p,q,q:= generateN(); n := p * q; k e := (n, g); k d := (p,q); A [ E ] CPApaillier  {g} CPApaillier1

13 PROOF OF CPA OF PAILLIER step 2: DEADCODE E (x 0, x 1 ) = if (b = 0) then { y := {1.. n-1}; c:= y n * g x0 mod n 2 } else { y := {1.. n-1}; c:= y n * g x1 mod n 2 } CPApaillier1 = b := {0,1}; p,q,q:= generateN(); n := p * q; k e := (n, g); k d := (p,q); A [ E ]

14 PROOF OF CPA OF PAILLIER step 2: DEADCODE E (x 0, x 1 ) = if (b = 0) then { y := {1.. n-1}; c:= y n * g x0 mod n 2 } else { y := {1.. n-1}; c:= y n * g x1 mod n 2 } CPApaillier2 = b := {0,1}; p,q,q:= generateN(); n := p * q; k e := (n, g); A [ E ] CPApaillier1  {g} CPApaillier2

15 PROOF OF CPA OF PAILLIER step 3 INLINE CR (x 0, x 1 ) = if (b = 0) then {y:= {1..n-1}; c :=y n mod n 2 } else {c:= {1.. n 2 -1}} E (x 0, x 1 ) = if (b = 0) then { y := {1.. n-1}; c:= y n * g x0 mod n 2 } else { y := {1.. n-1}; c:= y n * g x1 mod n 2 } DRA = b := {0,1}; p,q,q:= generateN(); n := p * q; B[CR] B = k e := (n, g); A [ CR; c:= c * g x0 mod n 2 ]; g0:=g; A [ CR; c:= c * g x1 mod n 2 ]; g1:=g; if (g0 =0 OR g1 =1 ) then g’ = 0 else g’:= 1

16 PROOF OF CPA OF PAILLIER Calculating probabilities CR (x 0, x 1 ) = if (b = 0) then {y:= {1..n-1}; c :=x n mod n 2 } else {c:= {1.. n 2 -1}} DRA = b := {0,1}; p,q,q:= generateN(); n := p * q; B[CR] B = k e := (n, g); A [ CR; c:= c * g x0 mod n 2 ]; g0:=g; A [ CR; c:= c * g x1 mod n 2 ]; g1:=g; if (g0 =0 OR g1 =1 ) then g’ = 0 else g’:= 1 ½ Pr[CPApaillier2;g=b] = Pr[DRA;g’=0 and b=0] ½ Pr[CPApaillier2;g=b] ≤ Pr[DRA;g’=b]

17 ½ Pr[CPApaillier2;g=b] = Pr[DRA;g’=1 and b=1] ½ Pr[CPApaillier2;g=b] ≤ Pr[DRA;g’=b] PROOF OF CPA O F PAILLIER step 3 INLINE CR (x 0, x 1 ) = if (b = 0) then {y:= {1..n-1}; c :=x n mod n 2 } else {c:= {1.. n 2 -1}} DRA = b := {0,1}; p,q,q:= generateN(); n := p * q; B[CR] B = k e := (n, g); A [ CR; c:= c * g x0 mod n 2 ]; g0:=g; A [ CR; c:= c * g x1 mod n 2 ]; g1:=g; if (g0 =0 OR g1 =1 ) then g’ = 1 else g’:= 0 negligible

18 We have proved Paillier to be CPA. Then is Paillier encryption secure?

19 NO

20 Assume that generateN() is a probabilistic function that generates two primes with the property that gcd(p*q,  (p*q) ) = 1 and g with g a generator for the multiplicative group {1 … n 2 -1}. Then Paillier encryption is defined by: G () = p,q,q:= generateN(); n := p * q; k e := (n, g); k d := (p,q) Assume x is in {1…n-1} E (x, (n,g)) = y := {1.. n-1}; c:= y n * g x mod n 2 E (x 0, (n,g)) * E (x 1, (n,g)) = y 0 n * g x0 mod n 2 * y 1 n * g x1 mod n 2 = y 0 n *y 1 n * g x0 *g x1 mod n 2 = (y 0 *y 1 ) n * g x0 + x1 mod n 2 = E (x 0 +x 1, (n,g)) A property of Paillier encryptions:

21 E (x 0, x 1 ) = if (b = 0) then { y := {1.. n-1}; c:= y n * g x0 mod n 2 } else { y := {1.. n-1}; c:= y n * g x1 mod n 2 }; log := log + m D (m) = if (m  log) then {x := 0} else {x := D (m,k d )}; GamePaillier = b := {0,1}; p,q,q:= generateN(); n := p * q;k e := (n, g); k d := (p,q); A [ E, D ] An attack to Paillier encryption:

22 E (x 0, x 1 ) = if (b = 0) then {m:=x0; y := {1.. n-1}; c:= y n * g x0 mod n 2 } else {m:=x1; y := {1.. n-1}; c:= y n * g x1 mod n 2 }; log := log + c D (m) = if (m  log) then {x := 0} else {x := D (m,k d )}; GamePaillier = b := {0,1}; p,q,q:= generateN(); n := p * q;k e := (n, g); k d := (p,q); A [ E, D ] A [ E, D ] = x 0 := 1; x 1 := 2; E; m:=c * c; D; if (x = 2) then g:=0 else g:=1 An attack to Paillier encryption:

23 We have proved Paillier to be CPA. This is only one kind of attack. Paillier is secure for an adversary with the power of making chosen plaintext attacks (usually, the weaker kind of attack possible), but not for all possible attacks: for example, it is not secure for chosen ciphertext attacks. Important: Provable cryptography only guarantees that no partial information is reveal for a given class of attack. It does not imply total security.

24 Another Look to Provable Cryptography “the treatment of hashed ElGamal encryption in is in some sense a remarkable achievement … so successful in turning something that should be interesting and accessible to everyone into something lengthy, unreadable, and boring.” Neal Koblitz

25 Another Look to ElGammal …

26 Another Look to Provable Cryptography A security theorem is conditional in a strong sense — it assumes the intractability of some mathematical problem… Often the intractability assumption is made for a complicated and contrived problem that has never been carefully studied. In fact, in some cases the problem is trivially equivalent to the cryptanalysis problem for the protocol whose security is being "proved," and the "proof" is essentially circular. Certain attacks — especially side-channel attacks — are very hard to model, and the models that have been proposed are woefully inadequate. The problem is that the adversary is always coming up with ingenious new methods to compromise the security of a cryptographic system. AND MORE Neal Koblitz

27 Chosen Ciphertext Attacks (CCA) CCA are strong forms of active attacks We will see two type of them a priori CCA and a posteriori CCA In both, the adversary has access to decryption requests CAVEAT: some use CCA to mean CCA2

28 Chosen-cyphertext attack 2 (CCA1) E = if (b = 0) then {m := E (x 0, k e )} else {m := E (x 1,k e )}; CCA1 = b := {0,1}; k e, k d := G e (); A [ D ]; E;A’ D = x := D (m,k d );

29 Example: A CCA1 scheme We will define a CCA1 scheme It is based on a CPA scheme It is based on a non-interactive ZK scheme (P, V, R, S)

30 Proof of Knowledge Zero Knowledge a prover gives a proof of some secret that he knows

31 Proof of Knowledge Zero Knowledge a prover gives a proof of some secret that he knows but without revealing the secret!

32 Proof of Knowledge Zero Knowledge a prover gives a proof of some secret that he knows but without revealing the secret! Example: If x in Z q is the secret, the prover can exhibit witnesses based on g x, showing that he knows x (a concrete protocol later)

33 Proof of Knowledge Zero Knowledge: properties ZK schemes have to satisfy: Soundness: the verification procedure cannot “accept” valid false statements, except for negligible probability Completeness: if a statement is true then the verifier “accepts” it, except for negligible probability Zero-Knowledge: the adversary cannot guess the secret by using the scheme!

34 Proof Systems Schemes for ZK A proof of knowledge zero knowledge scheme is a tuple (P, V, R, S) P (prover) is a probabilistic program that takes as inputs a secret s, a witness w, and outputs a proof p in D V (verifier) is a probabilistic program that takes a witness and a proof and outputs zero or one R is a NP relation that depends on secret s S is a simulator, a probabilistic program that outputs a “proof” in D without using secret s. (we do not include here the algorithm for “extraction”)

35 Zero Knowledge (indistinguishability) O = if (b = 0) then {p := P (s, w)} else {p:= S (w)}; ZK = b := {0,1}; A[O]

36 Example: A CCA1 scheme (Naor-Yung) We will define a CCA1 scheme It is based on a CPA scheme It is based on a ZK scheme (P, V, R, S) G ’ ‘ ( ) = k0 e, k0 d := G ( ); k1 e, k1 d := G ( ) E ‘(x, (k0 e, k1 e )) = e0, e1 := E (x, k0 e ); E (x, k1 e ); p:= P (e0, e1, x); c:= e0,e1, p0,p1,p D ‘ ((e0,e1, p), (k0 e, k1 e )) = if V (e0, e1,,p) = true then x: = D (e1, k1 d )

37 Proof of CCA1 of Naor-Yung scheme Naor-Yung scheme is CCA1 Theorem Naor-Yung encryption scheme is resistent to Chosen Ciphertext Attacks version 1 (CCA1)

38 E = if (b = 0) then {m := E (x 0, k e )} else {m := E (x 1,k e )}; CCA1 = b := {0,1}; k e, k d := G e (); A [ D ]; E;A’ D = x := D (m,k d );

39 E = if (b = 0) then { e0, e1 := E r0 (x0, k0 e ); E r1 (x0, k1 e ); p0,p1,p:= P (e0, e1, x0, r0,r1, ); c:= e0,e1, p0,p1,p } else { e0, e1 := E r0’ (x1, k0 e ); E r1’ (x1, k1 e ); p:= P (e0, e1, x1, r0’,r1’); c:= e0,e1, p0,p1,p }; CCA1-1 = b := {0,1}; k0 e, k0 d := G ( ); k1 e, k1 d := G ( ) A [ D ]; E;A’ D = if V (e0, e1,p0,p1,p) = true then x: = D (e1, k1 d ) Inline CCA1  {g} CCA1-1

40 E = if (b = 0) then { e0, e1 := E (x0, k0 e ); E (x0, k1 e ); p0,p1,p:= S (e0, e1);c:= e0,e1, p0,p1,p } else { e0, e1 := E (x1, k0 e ); E (x1, k1 e ); p0,p1,p:= S (e0, e1); c:= e0,e1, p0,p1,p }; CCA1-2 = b := {0,1}; k0 e, k0 d := G ( ); k1 e, k1 d := G ( ) A [ D ]; E; A’ D = if V (e0, e1,p0,p1,p) = true then x: = D (e1, k1 d ) Zero knowledge CCA1-1  {g} CCA1-2

41 E = if (b = 0) then { e0, e1 := E (x0, k0 e ); E (x0, k1 e ); } else { e0, e1 := E (x1, k0 e ); E (x1, k1 e ); }; CCA1-3 = b := {0,1}; k0 e, k0 d := G ( ); k1 e, k1 d := G ( ) A [ D ]; E; p0,p1,p:= S (e0, e1); c:= e0,e1, p0,p1,p ; A’ D = if V (e0, e1,p0,p1,p) = true then x: = D (e1, k1 d ) Code motion CCA1-2  {g} CCA1-3

42 E = if (b = 0) then { e0, e1 := E (x0, k0 e ); E (x0, k1 e ); } else { e0, e1 := E (x1, k0 e ); E (x1, k1 e ); }; CCA1-4 = b := {0,1}; k0 e, k0 d := G ( ); B B = k1 e, k1 d := G ( ) ; A [ D ]; E; p0,p1,p:= S (e0, e1); c:= e0,e1, p0,p1,p ; A’ D = if V (e0, e1,p0,p1,p) = true then x: = D (e1, k1 d ) Inline CCA1-3  {g} CCA1-4

43 E = if (b = 0) then { e0, e1 := E (x0, k0 e ); E (x0, k1 e ); } else { e0, e1 := E (x1, k0 e ); E (x1, k1 e ); }; E’ = if (b = 0) then { e0, := E (x0, k0 e ) } else { e0 := E (x1, k0 e ) }; CPA = b := {0,1}; k0 e, k0 d := G ( ); B B = k1 e, k1 d := G ( ) ; A [ D ]; E’; e1 := E (x0, k1 e ); p0,p1,p:= S (e0, e1); c:= e0,e1, p0,p1,p ; if V (e0, e1,p0,p1,p) = true then A’ else g:=1 D = if V (e0, e1,p0,p1,p) = true then x: = D (e1, k1 d ) A cpa attacker

44 E = if (b = 0) then { e0, e1 := E (x0, k0 e ); E (x0, k1 e ); } else { e0, e1 := E (x1, k0 e ); E (x1, k1 e ); }; E’ = if (b = 0) then { e0, := E (x0, k0 e ) } else { e0 := E (x1, k0 e ) }; CPA = b := {0,1}; 0 e, k0 d := G ( ); B B = k1 e, k1 d := G ( ) ; A [ D ]; E’; e1 := E (x0, k1 e ); p0,p1,p:= S (e0, e1); c:= e0,e1, p0,p1,p ; if V (e0, e1,p0,p1,p) = true then A’ else g:=1 D = if V (e0, e1,p0,p1,p) = true then x: = D (e1, k1 d ) A cpa attacker Pr[CCA1-4;g=b]= Pr[CCA1-4;g=0 and b=0] + Pr[CCA1-4;g=1 and b=1] = 1/2 Pr[CPA;g=b] + 1/2

45 E = if (b = 0) then { e0, e1 := E (x0, k0 e ); E (x0, k1 e ); } else { e0, e1 := E (x1, k0 e ); E (x1, k1 e ); }; E’ = if (b = 0) then { e0, := E (x0, k0 e ) } else { e0 := E (x1, k0 e ) }; CPA = b := {0,1}; 0 e, k0 d := G ( ); B B = k1 e, k1 d := G ( ) ; A [ D ]; E’; e1 := E (x0, k1 e ); p0,p1,p:= S (e0, e1); c:= e0,e1, p0,p1,p ; if V (e0, e1,p0,p1,p) = true then A’ else g:=1 D = if V (e0, e1,p0,p1,p) = true then x: = D (e1, k1 d ) A cpa attacker Pr[CCA1-4;g=b]= Pr[CCA1-4;g=0 and b=0] + Pr[CCA1-4;g=1 and b=1] = 1/2 Pr[CPA;g=b] + 1/2 negligeable

46 A simple ZK protocol There is a secret x that the prover wants to prove that he knows The NP relation that depends on x is “log g z = x and log h z’ = x“, where g and h are generators for the multiplicative group { 1…q-1} The protocol for generating a proof is P0;V0;P1 and to verify isV1 where: P0(g,h) = w := {1…q-1} la, lb := g w, h w V0 (la,lb) = l c := {1…q-1}; P1 (w,x,lc) = p := w + x * lc mod q V0 ( p, la,lb, g x, h x ) = if (g p = la * g x*lc and h p = lb * h x*lc ) then true else false

47 A simple ZK protocol Exercise: Assume that l c := {1…q-1} and that lc is a parameter of P0. Show that in the protocol for generating a proof is P0; P1 and to verify V1 the prover can cheat (he can prove he knows x, without knowing it) P0(g,h,lc) = w := {1…q-1} la, lb := g w, h w P1 (w,x,lc) = p := w + x * lc mod q V0 ( p, la,lb, g x, h x ) = if (g p = la * g x*lc and h p = lb * h x*lc ) then true else false

48 A simple ZK protocol From interactive to non-interactive There is a secret x that the prover wants to prove that he knows The NP relation that depends on x is “log g z = x and log h z’ = x“, where g and h are generators for the multiplicative group { 1…q-1} The protocol for generating a proof is P and to verify is V where: P(g,h,x) = w := {1…q-1} a, b := g w, h w l c := H( a + b); p := w + x * lc mod q V ( p, lc, g x, h x ) = a, b := g x lc * g p, h x lc * h p if (H(a+b) = lc ) then true else false

49 Chosen-cyphertext attack 2 (CCA2) E = if (b = 0) then {m := E (x 0, k e )} else {m := E (x 1,k e )}; log := log + m CCA2 = b := {0,1}; log := nil; k e, k d := G e (); A [ E,D ] D = if (m  log) then {x := 0} else {x := D (m,k d )};

50 Example of CCA2 scheme: RSA-OAEP (in PKCS standard) Let H : { 0,1} l  {0,1} l G : { 0,1} l  {0,1} p-l be two hash functions RSA-OAEP –ENC (m,ke)= r := { 0,1} l ; s:= H( r ) + m; t := G(s) + r c:= rsa-enc(s++t,ke) RSA-OAEP –DEC (c,kd)= (s,t) := rsa-dec(c,kd) ; r:= t + G(s) ; m: = s + H( r )

51 READING Slides, Notes, Bibliography Slides and exercises: www-sop.inria.fr/members/Tamara.Rezk/teaching Public-key Cryptosystems Provably Secure against Chosen Ciphertext Attacks – Naor, Yung Non-Interactive Proof of Knowledge and Chosen Ciphertext Attacks Rackoff, Simon Another Look to Provable Cryptography – Neal Koblitz Code-based Game-Playing Proofs and the Security of Triple Encryption – Bellare, Rogaway


Download ppt "SECURITY AND VERIFICATION Lecture 3: What kind of attacks are there? - Chosen Ciphertexts Attacks Tamara Rezk INDES TEAM, INRIA January 17 th, 2012."

Similar presentations


Ads by Google