admin管理员组

文章数量:1530020

18340161_田蕊_HW2

Problem1 Commitment protocol

1、Does the above protocol prevent cheating? If not, develop an attack.

不能阻止。因为剪刀石头布这个游戏的可选择项是很少的,x的取值只可能是剪刀,石头,布中的一个。所以当A给B发h(x)之后,B可以通过带入h(剪刀),h(石头),h(布)来和A发来的消息比对,这样就可以很轻松地判断出x的内容,也就是说在这种情况下hash函数是失效的。

2、Give a solution by slightly modifying the protocol.

增加一个随机数变量n,并将协议修改成如下所示

A->B : h(x + n),h(n)
B->A : y
A->B : x, n

在上述简单地修改下,B不在能够通过猜测 验证得到x的内容,而在A给出x和n的值的时候,B可以验证A没有说谎,并且可以确定n没有更改。

Problem2 Authentication

1、 Find an attack on the protocol.

The protocol is vulnerable to man-in-middle attack.

Supposed that there is a C between A and B, then the attack can be like this.
A − > C : A , N A , C C − > B : A , N A , B B − > C : B , N B , { N A } k , A C − > A : C , N B , { N A } k , A A − > C : A , { N B } k , C C − > B : A , { N B } k , B A->C : A,N_A,C \\ C->B : A,N_A,B \\ B->C : B,N_B,\{N_A\}_k, A \\ C->A : C,N_B,\{N_A\}_k, A \\ A->C : A,\{N_B\}_k, C \\ C->B : A,\{N_B\}_k, B A>C:A,NA,CC>B:A,NA,BB>C:B,NB,{NA}k,AC>A:C,NB,{NA}k,AA>C:A,{NB}k,CC>B:A,{NB}k,B

这样一来A和B分别和不知道密钥的C建立了一个认证,但是A和B之间并没有建立认证。

2、 Give a solution.

A − > B : { A , N A , B } k , N A B − > A : { B , N B , { N A } k , A } k , N B A − > B : { A , { N B } k , B } k A->B : \{A, N_A, B\}_k,N_A\\ B->A : \{B,N_B,\{N_A\}_k,A\}_k,N_B\\ A->B : \{A,\{N_B\}_k,B\}_k A>B:{A,NA,B}k,NAB>A:{B,NB,{NA}k,A}k,NBA>B:{A,{NB}k,B}k

在改进的方案中,我们将己方名称和nonces一起放在加密块内,在这种情况下,C不知道密钥就无法修改加密部分的AB字段,这样一来就可以有效抵御man-in-middle攻击。

Problem4 Secure PIN entry

因为输入设备是完全被监视的,所以我们不能通过输入设备泄露任何的信息,但是因为给用户的显示(例如屏幕)是安全的,所以可以利用显示这一方面来展示密码信息。一个可以选择的方案是在屏幕上给出乱序字符,用户通过操作上下左右键来选择自己要输入的字符,选中后输入回车。每输入一次回车,屏幕上的全部字符随机重排,用户继续通过上下左右键移动光标选择字符。当全部密码输入结束后,连续按两次回车。

在上述方案中,攻击者不能够从键盘输入中获得任何关于密码的信息。相关的密码信息显示在屏幕上,但是因为给用户的显示是安全的,所以攻击者不能从这里获得信息,所以在上述方案上用户能够安全登录。

Problem5 Secret sharing.

1、Describe how you would do this with a (30,10) Shamir secret sharing scheme.

  1. Pick a random polynomial f of degree 9, such that f(0) = K
  2. Share s i = f ( i ) s_i = f(i) si=f(i) for i = 1 to 30
  3. The general has { s 1 , s 2 … … s 10 s_1,s_2……s_{10} s1,s2s10}, the first colonel has { s 11 , s 12 , … … s 15 s_{11},s_{12},……s_{15} s11,s12,s15}, the second colonel has { s 16 , s 17 … … s 20 s_{16},s_{17}……s_{20} s16,s17s20}, and the five clerks each have { s 21 , s 22 s_{21},s_{22} s21,s22}, { s 23 , s 24 s_{23},s_{24} s23,s24}, { s 25 , s 26 s_{25},s_{26} s25,s26}, { s 27 , s 28 s_{27},s_{28} s27,s28}, { s 29 , s 30 s_{29},s_{30} s29,s30}

Then according to Shamir secret sharing scheme, a general, two colonels, five clerks or one colonel and three clerks all have exceed 10 shares so that they can launch the missile.

2、Determine who the foreign agent is and what the message is.

由题可知在这个系统中p = 11, t = 2

f ( x ) = y = k x + b m o d 11 f(x) = y = kx + b\quad mod\quad 11 f(x)=y=kx+bmod11

由Shamir secret sharing scheme可知,A,B,C,D四个点中,除了foreign agent另外三个应该同时满足上式且唯一确定一组(k,b),而foreign agent将不满足这组k,b。下面开始验证

由A,B确定(k,b)

将A,B代入可得方程组
{ 4 = k + b m o d 11 7 = 3 k + b m o d 11 \begin{cases} 4 = k+b \quad mod \quad 11 \\ 7 = 3k + b \quad mod \quad 11 \end{cases} {4=k+bmod117=3k+bmod11
解得
{ k = 7 b = 8 \begin{cases} k = 7\\ b = 8 \end{cases} {k=7b=8
所以 f ( x ) = y = 7 x + 8 m o d 11 f(x) = y = 7x + 8\quad mod\quad 11 f(x)=y=7x+8mod11

将C,D分别带入后发现C不满足上式

由A,C确定(k,b)

将A,C代入可得方程组
{ 4 = k + b m o d 11 1 = 5 k + b m o d 11 \begin{cases} 4 = k+b \quad mod \quad 11 \\ 1 = 5k + b \quad mod \quad 11 \end{cases} {4=k+bmod111=5k+bmod11
解得
{ k = 2 b = 2 \begin{cases}k = 2\\b = 2\end{cases} {k=2b=2
所以 f ( x ) = y = 2 x + 2 m o d 11 f(x) = y = 2x + 2\quad mod\quad 11 f(x)=y=2x+2mod11

将B,D分别带入后发现B,D均不满足上式,所以此时可以确定,A,C中一定有一个是foreign agent,又因为由A,B确定的(k,b)可以使D满足而不能使C满足,所以C一定是foreign agent。所以可以同时确定 f ( x ) = y = 7 x + 8 m o d 11 f(x) = y = 7x + 8\quad mod\quad 11 f(x)=y=7x+8mod11, message = f(0) = 8.

Problem6 Zero knowledge proof

  1. Peggy chooses three random integers r1, r2, r3 with r 1 r 2 r 3 = x m o d n r_1r_2r_3 = x\quad mod\quad n r1r2r3=xmodn
  2. Peggy computes x i = r i 2 x_i = r^2_i xi=ri2, for i = 1, 2, 3 and sends x 1 , x 2 , x 3 x_1, x_2, x_3 x1,x2,x3 to Victor.
  3. Victor checks that x 1 x 2 x 3 = s m o d n x_1x_2x_3 = s\quad mod\quad n x1x2x3=smodn
  4. Victor chooses i , j ∈ \in {1,2,3} and sends i , j to Peggy
  5. Peggy sends r i , r j r_i,r_j ri,rj to Victor
  6. Victor checks x i = r i 2 m o d n , x j = r j 2 m o d n x_i = r_i^2 \quad mod \quad n, x_j = r_j^2\quad mod \quad n xi=ri2modn,xj=rj2modn

重复上述操作5次(选择新的 r 1 , r 2 , r 3 r_1,r_2,r_3 r1,r2,r3),即可保证有99%的概率认为Peggy没有说谎。

本文标签: 作业信息安全SYSU