








Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Main points of this past exam are: Ciphertext Block, Plaintext Blocks, Electronic Code, Code Book, Cipher Mode, Block Cipher, Plaintext Block, Corresponding Plaintext, Fully Parallelized, Cbc Block
Typology: Exams
1 / 14
This page cannot be seen from the preview
Don't miss anything!









To encrypt a series of plaintext blocks p 1 , p 2 ,... pn using a block cipher E operating in electronic code book (ECB) mode, each ciphertext block c 1 , c 2 ,... cn is computed as ci = Ek(pi). Which of the following is not a property of this block cipher mode?
(a) Any repeated plaintext blocks will result in identical corresponding ciphertext blocks. (b) Decryption can be fully parallelized. (c) If a ciphertext block is modified or corrupted, then after decryption the corresponding plaintext block and all the following plaintext blocks will be affected. (d) None of the above; that is, (a), (b), and (c) are all properties of the ECB block cipher mode.
Answer: The correct answer is (c). In ECB, altering a ciphertext block only affects a single plaintext block.
To encrypt a series of plaintext blocks p 1 , p 2 ,... pn using a block cipher E operating in cipher block chaining (CBC) mode, each ciphertext block c 1 , c 2 ,... cn is computed as ci = Ek(pi ⊕ ci− 1 ), where c 0 is a public initializa- tion vector (IV) which should be different for each encryption session. Which of the following is a property of this block cipher mode? (a) Any repeated plaintext blocks will result in identical corresponding ciphertext blocks. (b) Decryption can be fully parallelized. (c) If a ciphertext block is modified or corrupted, then after decryption the corresponding plaintext block and all the following plaintext blocks will be affected. (d) None of the above; that is, neither (a), (b), nor (c) are properties of the CBC block cipher mode. Answer: The correct answer is (b). Each plaintext block can be com- puted using only two ciphertext blocks, independent of the other plaintext blocks: pi = Dk(ci) ⊕ ci− 1. Note that (c) is not a property of CBC. A modification to a ciphertext block will affect that plaintext block and the one immediately following it, but none after that.
Consider a k-bit hash function h : { 0 , 1 }∗^ → { 0 , 1 }k. Assume h operates ideally in the sense that each distinct input to h is mapped to a random member of { 0 , 1 }k. Assume an attacker is trying to finding a collision of h, that is, any two x 1 , x 2 ∈ { 0 , 1 }∗^ such that h(x 1 ) = h(x 2 ). How does the expected number of tries (evaluations of h) before the attacker succeeds grow with respect to k?
(a) Ω(2k) (b) Ω(
√ k) (c) Ω(2k/^2 ) (d) Ω(2log^ k)
Answer: The correct answer is (c), Ω(2k/^2 ), i.e., Ω(
2 k).
Alice knows that she will want to send a single 128-bit message to Bob at some point in the future. To prepare, Alice and Bob first select a 128-bit key k ∈ { 0 , 1 }^128 uniformly at random. When the time comes to send a message x ∈ { 0 , 1 }^128 to Bob, Alice considers two ways of doing so. She can use the key as a one time pad, sending Bob k ⊕ x. Alternatively, she can use AES to encrypt x. Recall that AES is a 128-bit block cipher which can use a 128-bit key, so in this case she would encrypt x as a single block and send Bob AESk(x). Assume Eve will see either k ⊕ x or AESk(x), that Eve knows an initial portion of x (a standard header), and that she wishes to recover the remaining portion of x. If Eve is an all powerful adversary and has time to try out every possible key k ∈ { 0 , 1 }^128 , which scheme would be more secure?
(a) The one time pad would be more secure. Even if Eve tried all possible keys, she would not be able to recover the unknown portion of x. If AES was used, Eve could eventually learn the unknown portion of x. (b) AES would be more secure. Even if Eve tried all possible keys, she would not be able to recover the unknown portion of x. If the one time pad was used, Eve could eventually learn the unknown portion of x. (c) They would be equally secure. Either way, Eve could eventually learn the unknown portion of x. (d) They would be equally secure. Either way, Eve would not be able to learn the unknown portion of x.
Answer: The correct answer is (d). Even after trying every possible key (including the actual one), Eve will have no way of recognizing the correct plaintext or even narrowing down the possibilities in any way. Why is this? Well, since AES is a distinct permutation on { 0 , 1 }^128 under each possible key, and the key was selected uniformly at random, given any plaintext, each possible ciphertext is equally likely. So when AES is used for a single block with a random key of the same length, the effect is exactly the same as using a one time pad: the ciphertext reveals no information about the plaintext.
Message authentication codes (MAC) and digital signatures both serve to authenticate the content of a message. Which of the following best describes how they differ?
(a) A MAC can be verified based only on the message, but a digital signa- ture can only be verified with the secret key used to sign the message. (b) A MAC can be verified based only on the message, but a digital signa- ture can only be verified with the public key of the party that signed the message. (c) A MAC can only be verified with the secret key used to generate it, but a digital signature can be verified based only on the message. (d) A MAC can only be verified with the secret key used to generate it, but a digital signature can be verified with the public key of the party that signed the message.
Answer: The correct answer is (d).
Let p be a large prime and g be a generator of Z∗ p. Suppose we are considering the function h : Z → Z∗ p for use as a hash function, where h(m) = gm^ mod p. Four basic properties are typically desired of cryptographic hash func- tions. The compression property requires that messages of any length be hashed to a finite domain. The preimage resistance (a.k.a. one-way) prop- erty requires that it be hard to find a message that hashes to a particular value. The second preimage resistance (a.k.a. weak collision resistance) property requires that, given one message, it is hard to find a second mes- sage with the same hash as the first message. The collision resistance (a.k.a. strong collision resistance) property requires that it be hard to find any two messages with the same hash. Since we treat messages as arbitrary integers (not just members of Z∗ p), h satisfies the compression property. If we assume the difficulty of the discrete logarithm problem in Z∗ p, which of the other three properties does h satisfy?
(a) All of them: preimage resistance, second preimage resistance, and col- lision resistance. (b) Only preimage resistance and second preimage resistance. (c) Only preimage resistance. (d) None of them.
Answer: The correct answer is (c). It can be shown that h satisfies preimage resistance with a reduction from the discrete logarithm problem. The reduction is trivial in that they are almost exactly the same problem. If you have an algorithm which can produce preimages, you need only reduce them modulo p to produce the correct answer for the discrete logarithm problem. To see that it is not second preimage resistant, note that for any message m, the message m + p − 1 will hash to the same value (and m + 2(p − 1), m + 3(p − 1),.. .). And if it is not second preimage resistant, there is no way it can be collision resistant, because that is a strictly stronger condition.
The following protocol is used to establish a shared key Kab between two parties A and B, assuming A and B each share a key with a mutually trusted server S. (^1). A → S : n a, A, B
The values na and nb are nonces selected by A and B. Like the Needham Schroeder protocol, this protocol is vulnerable to a key freshness attack. More specifically, assume an eavesdropper records the messages above in one execution of the protocol, then at some later point manages to compro- mise the session key Kab. With this information, an active adversary can then trick B into reusing Kab in a session with the attacker. B will mistak- enly believe it is communicating with A and that Kab is a fresh key generated for the two of them by S. Show how this may be done. Assume the adversary can arbitrarily intercept messages and drop or modify them before the intended recipient sees them. The adversary can also send new or replayed messages to any party, making them appear to come from any other party. However, the adversary has not compromised either of the long-lived keys (Kas and Kbs).
Answer: The following is the most straightforward way of accomplish- ing this attack. Assume the adversary has already observed one run of the protocol and subsequently compromised Kab somehow. The adversary replays message 2 to B, making it appear to come from S. B (who maintains no state between executions of the protocol, as was clarified during the exam) thinks that A is once again trying to initiate a session with it and that S has generated Kab for them. B then sends a new message 3 to A; it differs from the previous message 3 only in B’s choice of nonce: EKas (na, A, B, Kab), EKab (na), n′ b. The adversary intercepts this message before it reaches A and replies to B with a message EKab (n′ b), making it appear to come from A. Note that the adversary can compute EKab (n′ b) because it has Kab and has just observed n′ b. Now the adversary and B can continue communicating, and B will mistakenly believe it has a secure session with A.
int x; char buf[20];
/* set x to current time (in seconds since the epoch) */ x = time(0);
/* xor in the process ID for more randomness */ x = x ^ getpid();
/* hash x with SHA-1 and put the result in buf */ sha1(buf, &x, 4);
/* now we will use the first 16 bytes of buf as a 128-bit AES key */
In this code, sha1(char* out, char* in, int k) is a function that com- putes the 160-bit SHA-1 hash of a k-byte message starting at address in and places the result at address out. Are Alice’s changes sufficient? If you think the new system is reasonably secure, explain why. If you think it is insecure, state how you would go about breaking it.
Answer: Alice’s changes are in no way sufficient to secure the system; anything encrypted with a key selected in this way can be decrypted in a matter of minutes. This is because the SHA-1 hash is computed over only four bytes, resulting in only about four billion possible keys. The most straightforward way to attack this system is to try each of the 2^32 possible values for x in turn, each time using SHA-1 to hash x then attempting decryption with that key. This is possible regardless of how Alice has set her computer’s clock or how it chooses process ID’s. If an attacker can somehow derive or narrow down the possible settings for Alice’s clock (e.g., using a separate protocol from the one being attacked), they could speed up the attack somewhat, but it may not be worth bothering since the set of possible keys is so small already.
Suppose we have an undirected graph G = (N, E), where N is a set of nodes and we represent the edges as a subset E of N × N. Since G is undirected, E is a symmetric relation on N. A 3-coloring of G is a mapping
f : N → {“red”, “green”, “blue”}
such that (n 1 , n 2 ) ∈ E =⇒ f (n 1 ) 6 = f (n 2 ). Merlin claims to know of a 3-coloring f of G and wants to prove this in zero-knowledge to Arthur (who also has G). Like many other zero-knowledge proofs about graph properties, the protocol they use will take the following general form.
Phase 1 Merlin commits to some information about G and / or his coloring f.
Phase 2 Arthur sends him a random challenge.
Phase 3 Merlin responds, and Arthur checks some property of the response and that it matches the previous commitments, then either accepts or rejects.
The protocol must have the following properties:
Completeness If Merlin is being honest (i.e., he does have such a 3-coloring f ) and both he and Arthur follow the protocol, Arthur will always accept.
Soundness If the claim Merlin is making is impossible (i.e., there is no 3- coloring of G), then no matter what Merlin does, if Arthur follows the protocol he will reject with some probability.
Zero-knowledge If Merlin follows the protocol, then no matter what Arthur does, Arthur will not learn anything about Merlin’s solution (f ).
Efficiency All computations required of Arthur are polynomial time.
same distribution on his own, so his interaction with Merlin does not reveal anything new. A great many students attempted to solve this problem by having Merlin first permute the names of the nodes, but not the colors. Unfortunately, this almost always results in a protocol which is not zero-knowledge. To understand why, let us consider one such protocol. As the first step, Merlin randomly selects a permutation π : N → N. Then for each edge ei ∈ E, Merlin commits to the names and colors of the nodes: ci 1 = c(n, n′), ci 2 = c(f (n), f (n′)), where ei = (n, n′). He also commits to the permutation cπ = c(π). Then Arthur may challenge him to either open cπ and all the name commitments ci 1 (in which case he checks that they match the graph), or the color commitment for one edge (in which case he checks that they differ).^1 The latter possibility is what gradually leaks information to Arthur. Suppose Arthur repeats this protocol a large number of times, obtaining t responses to the second type of challenge. If Arthur totals the number of times he sees each color mentioned as r, g, and b, then he can use those numbers to compute something about the overall coloring. Specifically, as t grows larger, r·| tE | tends toward the sum of the degrees of the red nodes. This sum and the corresponding sums for blue and green may not be useful for some graphs. For other graphs however, Arthur may be able to easily narrow down the possibilities for the color of each of the original nodes and compute the solution. Note that it is not enough to simply hide the coloring of some graphs; in order for the protocol to be considered zero-knowledge, it must not reveal any information at all, no matter which graph it is used on. This is just one way of showing this type of protocol leaks information; there may be other approaches to breaking it. Now, on the following page, we give a correct protocol (which is also much simpler than the incorrect one above).
(^1) As it stands this protocol also has a problem with soundness. We ignore that here because it can be fixed by adding some more commitments and because we are trying to see why it is not zero-knowledge.
= c(s) he forms and sends to Arthur. Answer: Let N = {n 1 , n 2 ,... n|N |}. First Merlin selects a random permutation of the three colors π : {“red”, “green”, “blue”} → {“red”, “green”, “blue”}. Then for each i ∈ { 1 , 2 ,... |N |}, Merlin computes si = π(f (ni)) and sends the commitment ci = c(si) to Arthur.