Stream ciphers

52
Van Hoang Nguyen Mail: [email protected] Department of Computer Science FITA HUA Information Security Course --------------------------------------------- Fall 2013 Dept. of Computer Science FITA HUA

description

Introduce stream ciphers, perfect secrecy, semantic secrecy

Transcript of Stream ciphers

Page 1: Stream ciphers

Van Hoang Nguyen

Mail: [email protected]

Department of Computer Science – FITA – HUA

Information Security Course --------------------------------------------- Fall 2013

Dept. of Computer Science – FITA – HUA

Page 2: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

What is a secure cipher?

Page 3: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

What is the best cipher?

Page 4: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Page 5: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Page 6: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

The cipher text should reveal no

information about the plaintext.

Page 7: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Information Theoretic Security (Shannon 1949)

perfect

secrecy

P (len( )=len( )) and c C

Pr(E(k,m0)=c) = Pr(E(k,m1)=c)

Page 8: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

K

xor

xor

Page 9: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

K

|K|

K

Page 10: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

P C

None

1

Page 11: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

xor xor

K

Page 12: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Page 13: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Page 14: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

“random”

“pseudorandom”

the random seed

Page 15: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Page 16: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

(key-length < message-length)

Page 17: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen 16

Yes, if the PRG is really ”secure”

No, there are no ciphers with perfect secrecy

Yes, every cipher has perfect secrecy

No, since the key is shorter than the message

Can a stream cipher have perfect secrecy?

Sourced by Online Cryptography Course – Dan Boneh

Page 18: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Page 19: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Page 20: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Page 21: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Page 22: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Page 23: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Page 24: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

PRG must be unpredictable.

Page 25: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Page 26: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Def: PRG is unpredictable if it is not predictable

⇒ ∀ i: no “eff” adv. can predict bit (i+1) for “non-neg” ε

Page 27: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

ε

ε ε ≥ 1/230

ε ε ≤ 1/280 (won’t happen over life of key)

ε ε: Z≥0 ⟶ R

≥0and

ε ∃d: ε(λ) ≥ 1/λd inf. often ε

ε ∀d, λ≥λd: ε(λ) ≤ 1/λd ε

Page 28: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

How must PRG be?

Page 29: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

⟶ n

Page 30: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Statistical test on {0,1}n

is an algorithm A such that A(x) outputs 0 or 1.

Page 31: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Advantage

⟶ n

n

A(x) = 0 ⇒ AdvPRG [A,G] =

Page 32: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Def: We say that G: K ⟶{0,1}n

is a secure PRG if

∀ “eff” statistical test A:

AdvPRG(A,G) is “negligible”

Page 33: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

PRG predictable ⇒ PRG is insecure

A secure PRG is unpredictable

Suppose A is an efficient algorithm s.t

for non-negligible ε

Page 34: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Define statistical test B as:

A secure PRG is unpredictable

ε

AdvPRG[B, G]=|Pr[B(r)=1] - Pr[B(G(k))=1]|>ε

Page 35: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Thm (Yao’82): an unpredictable PRG is secure

Let G:K ⟶{0,1}n

be PRG

“Thm”: if ∀ i ∈ {0, … , n-1} PRG G is unpredictable

at position i then G is a secure PRG.

Page 36: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

computationally indistinguishable P1 ≈p P2

∀ “eff” statistical test A:

{ k ⟵K : G(k) } ≈p uniform({0,1}n)

Page 37: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Silvio Micali Shafi Goldwasser

Page 38: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Chal.

b

Adv. AkK

m0 , m1 : |m0| = |m1|

c E(k, mb)

b’ {0,1}

Page 39: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

semantically secure

AdvSS[A, ]

{ E(k,m0) } ≈p { E(k,m1) }

Page 40: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Adv. B (us)Chal.

b{0,1}

Adv. A

(given)

kK

C E(k, mb)

m0, LSB(m0)=0

m1, LSB(m1)=1

C

LSB(mb)=b

Then AdvSS[B, E] = | Pr[ EXP(0)=1 ] − Pr[ EXP(1)=1 ] |= |0 – 1| = 1

Page 41: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

For all A: AdvSS[A,OTP] = | Pr[ A(k⊕m0)=1 ] − Pr[ A(k⊕m1)=1 ] |= 0

Chal.

b

Adv. AkK

m0 , m1 M : |m0| = |m1|

c k⊕m0 or c k⊕m1

b’ {0,1}

Page 42: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

secure PRG

semantically secure

Page 43: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Chal.

b

Adv. A

kK

m0 , m1 M : |m0| = |m1|

c mb⊕ r

b’ {0,1}

r{0,1}n

For b=0,1: Rb := [ event that b’=1 ]

Page 44: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Chal.

b

Adv. Am0 , m1 M : |m0| = |m1|

c mb⊕ G(k)

b’ {0,1}For b=0,1: Rb := [ event that b’=1 ]

kK

r{0,1}n

Page 45: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Claim 1: |Pr[R0] – Pr[R1]| = AdvSS[A,OTP] = 0

Claim 2: ∃B: |Pr[Wb] – Pr[Rb]| = AdvPRG[B,G] for b = 0,1

0 1Pr[W0] Pr[W1]Pr[Rb]

≤AdvPRG[B,G] ≤AdvPRG[B,G]

⇒ AdvSS[A,E] = |Pr[W0] – Pr[W1]| ≤ 2AdvPRG[B,G]

Page 46: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Proof: ∃B: |Pr[W0] – Pr[R0]| = AdvPRG[B,G]

PRG adv. B (us)

Adv. A

(given)c m0⊕y

y ∈ {0,1}n

m0, m1

b’ ∈ {0,1}

|Pr[W0] – Pr[R0]| = = AdvPRG[B,G]

Page 47: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Real-world stream ciphers

Page 48: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Ronald L. Rivest

RC4 (1987)

For i=0 to 255 do S[i]=i;

For i=0 to 255 do T[i]=K[i mode keylen];

j=0;

For i=0 to 255 do

Begin

j=(j+S[i]+T[i]) mode 256;

swap(S[i],S[j]);

End

Page 49: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Ronald L. Rivest

RC4 (1987)

i,j=0;

While (true) do

Begin

i=(i+1) mode 256;

j=(j+S[i]) mode 256;

swap(S[i],S[j]);

t=(S[i]+S[j]) mode 256;

ks=S[t];

End

Page 50: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Ronald L. Rivest

RC4 (1987)

2048 bits128 bits

seed

1 byte

per round

Page 51: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen

Page 52: Stream ciphers

Information Security ------------- Fall 2013

Van Hoang Nguyen