




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





1. [14 points] Are n=187 and e=9 valid numbers for RSA. Explain. If you answer yes, obtain the corresponding d.
Solution
There are two requirements: n must be a product of two primes e must be relatively prime to φ(n) (so that d, which equals e−^1 mod-n, exists)
First requirement [2 points] n = 187 = 11·17. 11 and 17 are primes. So this holds.
Second requirement [6 points] Recall that if n =p·q where p and q are distinct primes, then φ(p⋅q) = (p−1)⋅(q−1) So φ(187) = (11−1)⋅(17−1) = 160. e, which equals 9, is relatively prime to 160 (because 9=3^2 and 160=10·16=2·5·2^4 =2^5 ·5) So this requirement holds.
Obtaining d [6 points]
So we need to find 9−1^ mod 160, i.e., need to find a and b such that 1 = a·9 + b·160 (then a = 9−1^ mod 160). We can use Euclid's algorithm to obtain a and b [Below, rows n = −2 and n = −1 are initialization. rn remainder (rn-2/rn-1); qn quotient ( rn-2/rn-1 ); un un-2 − qn⋅un-1; vn vn-2 − qn⋅vn-1; ]
n qn rn un vn − 2 160 1 0 − 1 9 0 1 (^0 17 7 1) − 17 (^1 1 2) − 1 18 2 3 1 4 − 3 2 0
From row n=2, we have rn = gcd(9,160) = 1 (which we already knew), and 1 = (4)·(160) + (−71)·9 = 1 So d = −71 mod 160 = 160−71 mod 160 = 89
2. [6 points] Consider a sensor X that periodically sends a 64-octet measurement to a receiver Y. One day the administrator decides that X should encrypt the measurement data using DES in CBC mode. How many octets does X now send for each measurement? Explain your answer.
Solution
DES takes a 8-octet (64-bit) plaintext block and yields a 8-octet cipherblock. [2 points]
CBC requires a 8-octet initialization vector (IV) to be sent along with the cipherblocks. [2 points]
So X now sends 64 octets of cipherblocks [1 point] plus 8 octets of IV, for a total of 72 octets. [1 point]
[3 points if you don’t say anything wrong and you say that CBC sends cipherblocks + IV.]
4. [4 points] In the authentication protocol below, pw is A's password and J is a key derived from pw. Can an attacker that can eavesdrop messages (but not intercept or spoof messages) obtain pw by off-line password guessing. If you answer no, explain briefly. If you answer yes, describe the attack.
A (has pw) B (has J)
send [conn] to B
generate random challenge R send [R] compute J from pw compute X encrypt(R) with key J send [X] to B compute Y decrypt(X) with key J if Y = R then A is authenticated
Solution
Yes, an eavesdropping attacker can do off-line password guessing. [1 point]
The attacker has R and X, and does the following: [3 points] repeat { choose candidate password cpw; compute cJ from cpw; compute cX encrypt(R) with key J } until cX = X; // cpw = pw
[Lose 1 point for saying: obtain J from R and X, and then use offline password guessing to get pw from J.]
5. [4 points] In the authentication protocol below, pw is A's password, J is a key derived from pw, and L is a high-quality key (which A gets from B as shown below). Can an attacker that can eavesdrop messages (but not intercept or spoof messages) obtain pw by off- line password guessing. If you answer no, explain briefly. If you answer yes, describe the attack.
A (has pw) B (has J, L)
send [ conn ] to B
X encrypt(L) with key J generate random challenge R send [ X, R ] compute J from pw L decrypt(X) with key J Y encrypt(R) with key L send [ Y ] to B compute Y encrypt(R) with key L if Y = Y then A is authenticated
Solution
Yes, an eavesdropping attacker can do off-line password guessing.
The attacker has X, R, and Y, and does the following: [4 points] repeat { choose candidate password cpw; compute cJ from cpw; compute cL decrypt(X) with key cJ compute cY encrypt(R) with key cL } until cY = Y; // cpw = pw
[0 points if you say: obtain J from R, X, and Y, and then use offline password guessing to get pw from J.]
Solution to 6
There are several solutions based on some form of authenticated Diffie-Hellman (DH). Two are outlined below.
Solution 1 (detailed handshake at end) : After obtaining L, principal A initiates DH to establish a session key S, where the DH messages are encrypted by L. Encrypting the DH messages by L ensures that the attacker cannot hijack the data exchange phase (otherwise the attacker can spoof A in the DH and thus have the session key established between itself and B).
Solution 2: After obtaining L, principal A initiates DH (with unencrypted messages) to establish a session key S. Then B sends a challenge, say R, encrypted with S, to which A responds with a message M applying S and L to R, for example: [encrypt(encrypt(R) with L) with S] [encrypt(hash(R | L) with S] [encrypt(R+1) with S]
Grading: 2 points for Diffie-Hellman.
2 points for secure authentication:
Solution 1 handshake details
A (has pw) B (has J, L)
send [ conn ] to B
X encrypt(L) with key J send [ X ] compute J from pw L decrypt(X) with key J
<- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solution Start - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ->
choose Diffie-Helman g, p [2 points] generate random number SA compute TA g SA mod p compute YA encrypt( TA ) with L send [ YA , g, p ] to B
generate random number SB [2 points] compute TB g SB mod p compute YB encrypt( TB ) with L send [ YB ] to B session key S TA^ SB^ mod p
(^) session key S TB^ SA^ mod p
A and B now have session key S (= S )
<- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solution End -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ->
<------------------- A and B exchange data ----------------->
<------------------- A and B disconnect ---------------------->