Final 14
Final 14
Final 14
Final Exam
Instructions:
− Answer all five questions.
− The exam is open book and open notes. Wireless devices are not allowed.
− Students are bound by the Stanford honor code.
− You have two and a half hours.
Problem 1. Questions from all over.
a. PRPs vs. PRFs. Let Π : K × X → X be a secure PRP. Explain how an adversary can win
the PRF security game against Π with advantage 1/2 using O(|X |1/2 ) queries.
b. Is the following function collision resistant: f (k, x0 , x1 ) = AES k, AES(k, x0 ) ⊕ x1 ?
If so explain why, if not explain how to find collisions.
c. For nonce-based encrypt-then-MAC mode to provide authenticated encryption the same
nonce must never be reused with a single key. What can go wrong if a nonce is reused? Is
encrypt-then-MAC no longer CPA secure or does it no longer provide ciphertext integrity
(or both)? Explain briefly.
d. When using RSA-FDH to sign messages, how many valid signatures are there for a given
message m for a fixed verification key? (the hash function used in RSA-FDH is fixed)
Same question for Lamport one-time signatures built from a one-way permutation: how
many valid signatures are there for a given message m?
e. Is it the case that for all many-time existentially unforgeable signature schemes there
must only be one valid signature for every message? If so explain why. If not, give a
counter-example.
f. Let H : M → {0, 1}128 be a collision resistant hash function known to the adversary.
Does the function f (k, m) = H(m) ⊕ k give a secure MAC? If so explain why. If not,
describe an attack.
Problem 2. Recall that in the homework you constructed a secure PRF that becomes insecure
if an attacker learns a single bit of the key. Here your goal is to build a PRF that remains
secure even if the attacker learns any single bit of the key.
1
Problem 3. One way functions.
Problem 4. Ciphertext expansion vs. security. Let (E, D) be a symmetric encryption scheme
encrypting bit strings.
a. Suppose that for all keys and all messages m, the encryption of m is the exact same length
as m. Show that (E, D) cannot be CPA-secure.
b. Suppose that for all keys and all messages m, the encryption of m is exactly ` bits longer
than the length of m. Show an attacker that can win the CPA security game using 2`/2
queries and non-negligible advantage (in fact, advantage close to 1/2). Consequently the
cipher becomes insecure if a key is used to encrypt 2`/2 messages.
Hint: for simplicity you may assume that every message m can be mapped to exactly 2`
ciphertexts. Note that a similar statement can be shown to hold without this assumption.
You may also assume that the message space contains more than 2` messages.
2
Problem 5 Let N = pq be an RSA modulus. Let g ∈ [0, N 2 ] be an integer satisfying g = 1 mod N .
Consider the following encryption scheme. The public key is (N, g). To encrypt a message
m ∈ ZN do: (1) choose a random h in ZN 2 , and (2) compute c := g m · hN in ZN 2 . Our goal
is to develop a decryption algorithm.
a. Show that the discrete log problem base g is easy. That is, show that given g and g x
in ZN 2 there is an efficient algorithm to compute x. Recall that g = aN + 1 for some
integer a and you may assume that a is in Z∗N .
Hint: use the binomial theorem.
b. Show that given g and the factorization of N , decrypting c = g m · hN in ZN 2 can be done
efficiently.
2
Hint: consider cϕ(N ) in ZN 2 . Use the fact that by Euler’s theorem xϕ(N ) = 1 mod N 2
for all x ∈ Z∗N 2 . Recall that ϕ(N 2 ) = N ϕ(N ). You may assume that ϕ(N ) is relatively
prime to N .
c. Show that this system is additively homomorphic. That is, show that given E(pk, m0 )
and E(pk, m1 ) it is easy to construct E(pk, m0 + m1 ).