🎉 从330转为WashU帮助手册啦!

CSE442
模块
Cse442t L14

Lecture 14

Recap

\exists one-way functions     \implies \exists PRG expand by any polynomial amount

G:{0,1}n{0,1}l(n)\exists G:\{0,1\}^n \to \{0,1\}^{l(n)} s.t. GG is efficiently computable, l(n)>nl(n) > n, and GG is pseudorandom

{G(Un)}{Ul(n)}\{G(U_n)\}\approx \{U_{l(n)}\}

Back to the experiment we did long time ago:

Group 1Group 2
0000000000 or 1111111111316
4 of 1's4256
balancedtoo oftenusual
consecutive repeats04

So Group 1 is human, Group 2 is computer.

New material

Computationally secure encryption

Recall with perfect security,

P[kGen(1n):Enck(m1)=c]=P[kGen(1n):Enck(m2)=c]P[k\gets Gen(1^n):Enc_k(m_1)=c] = P[k\gets Gen(1^n):Enc_k(m_2)=c]

for all m1,m2Mm_1,m_2\in M and cCc\in C.

(Gen,Enc,Dec)(Gen,Enc,Dec) is single message secure if n.u.p.p.tD\forall n.u.p.p.t \mathcal{D} and for all nNn\in \mathbb{N}, m1,m2{0,1}nMn\forall m_1,m_2\gets \{0,1\}^n \in M^n, D\mathcal{D} distinguishes Enck(m1)Enc_k(m_1) and Enck(m2)Enc_k(m_2) with at most negligble probability.

P[kGen(1n):D(Enck(m1),Enck(m2))=1]ϵ(n)P[k\gets Gen(1^n):\mathcal{D}(Enc_k(m_1),Enc_k(m_2))=1] \leq \epsilon(n)

By the prediction lemma, (A\mathcal{A} is a ppt, you can also name it as D\mathcal{D})

P[b{0,1}:kGen(1n):A(Enck(mb))=b]12+ϵ(n)2P[b\gets \{0,1\}:k\gets Gen(1^n):\mathcal{A}(Enc_k(m_b)) = b] \leq \frac{1}{2} + \frac{\epsilon(n)}{2}

and the above equation is 12\frac{1}{2} for perfect secrecy.

Construction of single message secure cryptosystem

cryptosystem with shorter keys. Mimic OTP(one time pad) with shorter keys with pseudorandom randomness.

K={0,1}nK=\{0,1\}^n, M={0,1}l(n)\mathcal{M}=\{0,1\}^{l(n)}, G:KMG:K \to \mathcal{M} is a PRG.

Gen(1n)Gen(1^n): k{0,1}nk\gets \{0,1\}^n; output kk.

Enck(m)Enc_k(m): r{0,1}l(n)r\gets \{0,1\}^{l(n)}; output G(k)mG(k)\oplus m.

Deck(c)Dec_k(c): output G(k)cG(k)\oplus c.

Proof of security:

Let m0,m1Mm_0,m_1\in \mathcal{M} be two messages, and D\mathcal{D} is a n.u.p.p.t distinguisher.

Suppose {KGen(1n):Enck(mi)}\{K\gets Gen(1^n):Enc_k(m_i)\} is distinguished for i=0,1i=0,1 by D\mathcal{D} and by μ(n)1poly(n)\mu(n)\geq\frac{1}{poly(n)}.

Strategy: Move to OTP, then flip message.

H0(Enck(m0))={k{0,1}n:m0G(k)}H_0(Enc_k(m_0)) = \{k\gets \{0,1\}^n: m_0\oplus G(k)\} H1(OTP(m1))={uUl(n):mou}H_1(OTP(m_1)) = \{u\gets U_{l(n)}: m_o\oplus u\} H2(OTP(m1))={uUl(n):m1u}H_2(OTP(m_1)) = \{u\gets U_{l(n)}: m_1\oplus u\} H3(Enck(m0))={k{0,1}n:m1G(k)}H_3(Enc_k(m_0)) = \{k\gets \{0,1\}^n: m_1\oplus G(k)\}

By hybrid argument, 2 neighboring messages are indistinguishable.

However, H0H_0 and H1H_1 are indistinguishable since G(Un)G(U_n) and Ul(n)U_{l(n)} are indistinguishable.

H1H_1 and H2H_2 are indistinguishable by perfect secrecy of OTP.

H2H_2 and H3H_3 are indistinguishable since G(Un)G(U_n) and Ul(n)U_{l(n)} are indistinguishable.

Which leads to a contradiction.

Multi-message secure encryption

(Gen,Enc,Dec)(Gen,Enc,Dec) is multi-message secure if n.u.p.p.tD\forall n.u.p.p.t \mathcal{D} and for all nNn\in \mathbb{N}, and q(n)poly(n)q(n)\in poly(n).

m=(m1,,mq(n))\overline{m}=(m_1,\dots,m_{q(n)}) m=(m1,,mq(n))\overline{m}'=(m_1',\dots,m_{q(n)}')

are list of q(n)q(n) messages in {0,1}n\{0,1\}^n.

D\mathcal{D} distinguishes Enck(m)Enc_k(\overline{m}) and Enck(m)Enc_k(\overline{m}') with at most negligble probability.

P[kGen(1n):D(Enck(m),Enck(m))=1]12+ϵ(n)P[k\gets Gen(1^n):\mathcal{D}(Enc_k(\overline{m}),Enc_k(\overline{m}'))=1] \leq \frac{1}{2} + \epsilon(n)

THIS IS NOT MULTI-MESSAGE SECURE.

We can take m=(0n,0n)(G(k),G(k))\overline{m}=(0^n,0^n)\to (G(k),G(k)) and m=(0n,1n)(G(k),G(k)+1n)\overline{m}'=(0^n,1^n)\to (G(k),G(k)+1^n) the distinguisher can easily distinguish if some message was sent twice.

What we need is that the distinguisher cannot distinguish if some message was sent twice. To achieve multi-message security, we need our encryption function to use randomness (or change states) for each message, otherwise Enck(0n)Enc_k(0^n) will return the same on consecutive messages.

Our fix is, if we can agree on a random function F:{0,1}n{0,1}nF:\{0,1\}^n\to \{0,1\}^n satisfied that: for each input x{0,1}nx\in\{0,1\}^n, F(x)F(x) is chosen uniformly at random.

Gen(1n):Gen(1^n): Choose random function F:{0,1}n{0,1}nF:\{0,1\}^n\to \{0,1\}^n.

EncF(m):Enc_F(m): let rUnr\gets U_n; output (r,F(r)m)(r,F(r)\oplus m).

DecF(m):Dec_F(m): Given (r,c)(r,c), output m=F(r)cm=F(r)\oplus c.

Idea: Adversary sees rr but has no idea about F(r)F(r). (we choose all outputs at random)

If we could do this, this is MMS (multi-message secure).

Proof:

Suppose m1,m2,,mq(n)m_1,m_2,\dots,m_{q(n)}, m1,,mq(n)m_1',\dots,m_{q(n)}' are sent to the encryption oracle.

Suppose the encryption are distinguished by D\mathcal{D} with probability 12+ϵ(n)\frac{1}{2}+\epsilon(n).

Strategy: move to OTP with hybrid argument.

Suppose we choose a random function

H0:{FRFn:((r1,m1F(r1)),(r2,m2F(r2)),,(rq(n),mq(n)F(rq(n))))}H_0:\{F\gets RF_n:((r_1,m_1\oplus F(r_1)),(r_2,m_2\oplus F(r_2)),\dots,(r_{q(n)},m_{q(n)}\oplus F(r_{q(n)})))\}

and

H1:{OTP:(r1,m1u1),(r2,m2u2),,(rq(n),mq(n)uq(n))}H_1:\{OTP:(r_1,m_1\oplus u_1),(r_2,m_2\oplus u_2),\dots,(r_{q(n)},m_{q(n)}\oplus u_{q(n)})\}

ri,uiUnr_i,u_i\in U_n.

By hybrid argument, H0H_0 and H1H_1 are indistinguishable if r1,,rq(n)r_1,\dots,r_{q(n)} are different, these are the same.

F(r1),,F(rq(n))F(r_1),\dots,F(r_{q(n)}) are chosen uniformly and independently at random.

only possible problem is ri=rjr_i=r_j for some iji\neq j, and P[ri=rj]=12nP[r_i=r_j]=\frac{1}{2^n}.

And the probability that at least one pair are equal

P[at least one pair are equal]=P[ij{ri=rj}]ijP[ri=rj]=(n2)12n<n22n+1P[\text{at least one pair are equal}] =P[\bigcup_{i\neq j}\{r_i=r_j\}] \leq \sum_{i\neq j}P[r_i=r_j]=\binom{n}{2}\frac{1}{2^n} < \frac{n^2}{2^{n+1}}

which is negligible.

Unfortunately, we cannot do this in practice.

How many random functions are there?

The length of description of FF is n2nn 2^n.

For each x{0,1}nx\in \{0,1\}^n, there are 2n2^n possible values for F(x)F(x).

So the total number of random functions is (2n)2n=2n2n(2^n)^{2^n}=2^{n2^n}.