Problems
Prev: Protocols
This chapter contains some problems for you to look at.
E.1 Secret Key Encryption
E.1.1 DES
Let be the bitwise complement of the string . Let denote the encryption of under DES using key . It is not hard to see that if
then
We know that a brute-force attack on DES requires searching a space of keys. This means that we have to perform that many DES encryptions in order to find the key, in the worst case.
- Under known plaintext attack, meaning you are given a single pair where , do the equations above change the number of DES encryptions you perform in a brute-force attack to recover ?
- What is the answer to the above question in the case of chosen plaintext attack, meaning when you are allowed to choose many ‘s for which you get the pair with ?
E.1.2 Error Correction in DES Ciphertexts
Suppose that plaintext blocks are encrypted using DES, producing ciphertexts . Suppose that one ciphertext block, say , is transmitted incorrectly, meaning some ‘s are changed into ‘s and vice versa.
How many plaintext blocks will be decrypted incorrectly if ECB mode was used for encryption? What if CBC is used?
E.1.3 Brute Force Search in CBC Mode
A brute-force key search for a known-plaintext attack for DES in ECB mode is straightforward: given the -bit plaintext and the -bit ciphertext, try all of the possible keys until one is found that generates the known ciphertext from the known plaintext. The situation is more complex for CBC mode, which includes the use of a -bit IV. This seems to introduce an additional bits of uncertainty.
- Suggest strategies for known-plaintext attack on CBC mode that are of the same order of magnitude of effort as the ECB attack.
- Now consider a ciphertext-only attack. For ECB mode the strategy is to try to decrypt the given ciphertext with all possible keys and test each result to see if it appears to be a syntactically correct plaintext. Will this strategy work for CBC mode? If so, explain. If not, describe an attack strategy for CBC mode and estimate its level of effort.
E.1.4 E-mail
Electronic mail systems differ in the way in which multiple recipients are handled. In some systems the originating mail handler makes all the necessary copies, and these are sent out independently. An alternative approach is to determine the route for each destination first. Then a single message is sent out on a common portion of the route and copies are made when the routes diverge. This system is known as mail-bagging.
- Leaving aside security considerations, discuss the relative advantages and disadvantages of the two methods.
- Discuss the security requirements and implications of the two methods.
E.2 Passwords
The framework of a simplified version of the Unix password scheme is this. We fix some function . The user chooses a -bit password, and the system stores the value in the password file. When the user logs in, they must supply . The system then computes and declares the user authentic if this value equals .
We assume the attacker has access to the password file and hence to . The intuition is that it is computationally infeasible to recover from . Thus must be chosen to make this true.
The specific choice of made by Unix is , where represents the -bit string of all zeros. Thus and .
In this problem you will analyze the generic scheme and the particular DES-based instantiation. The goal is to see how, given a scheme like this, to use the models we have developed in class, in particular to think of DES as a pseudorandom function family.
To model the scheme, let be a pseudorandom function family, having some given insecurity function , and with . We let denote the time to compute , namely the time, given , to compute . See below for the definition of a one-way function, which we will refer to now.
-
Define by , where represents the -bit string of all zeros. Prove that is a one-way function with
where
Hints: Assume you are given an inverter for , and construct a distinguisher such that
Use this to derive the claimed result.
-
Can you think of possible threats or weaknesses that might arise in a real-world usage of such a scheme, but are not covered by our model? Can you think of how to protect against them? Do you think this is a good password scheme in practice?
One-Way Function Definition Used Above
Let be a function. It is one-way if, intuitively speaking, it is hard, given , to compute a point such that , when was chosen by drawing at random from and setting .
In formalizing this, we say an inverter for is an algorithm that given a point tries to compute this . We let
be the probability that the inverter is successful, taken over a random choice of and any coins the inverter might toss. We let
where the maximum is over all inverters that run in time at most .
E.3 Number Theory
E.3.1 Number Theory Facts
Prove the following facts:
-
If is the number of distinct prime factors of , then the equation has distinct solutions in . Hint: use the Chinese Remainder Theorem.
-
If is prime and , then
-
is a generator of for a prime iff and for all prime divisors of .
E.3.2 Relationship Between Problems
Let be the product of two primes, . Describe reducibilities between the following problems. For example, if we can factor then we can invert RSA. Do not prove anything formally; just state the result.
- computing
- factoring
- computing for some
- computing square roots modulo
- computing -th roots modulo , where
E.3.3 Probabilistic Primality Test
Let denote an expected polynomial-time algorithm that on input outputs such that if is a quadratic residue modulo . Consider the following probabilistic primality test, which takes as input an odd integer and outputs "composite" or "prime".
-
Test if there exist such that . If so output
"composite". -
Choose at random and set .
-
Compute .
-
If or , output
"prime"; otherwise output"composite". -
Does the above primality test always terminate in expected polynomial time? Prove your answer.
-
What is the probability that the above algorithm makes an error if is prime?
-
What is the probability that the above algorithm makes an error if is composite?
E.4 Public Key Encryption
E.4.1 Simple RSA Question
Suppose that we have a set of blocks encoded with the RSA algorithm and we do not have the private key. Assume , and is the public key. Suppose also someone tells us they know one of the plaintext blocks has a common factor with . Does this help us in any way?
E.4.2 Another Simple RSA Question
In the RSA public-key encryption scheme each user has a public key and a private key . Suppose Bob leaks his private key. Rather than generating a new modulus, he decides to generate a new pair . Is this a good idea?
E.4.3 Protocol Failure Involving RSA
Remember that an RSA public key is a pair where is the product of two primes.
Assume that three users in a network, Alice, Bob, and Carl, use RSA public keys , , and respectively. Suppose David wants to send the same message to the three of them. So David computes
and sends the ciphertext to the respective user.
Show how an eavesdropper Eve can now compute the message even without knowing any of the secret keys of Alice, Bob, and Carl.
E.4.4 RSA for Paranoids
The best factoring algorithm known to date, the number field sieve, runs in
That is, the running time does not depend on the size of the smallest factor, but rather on the size of the whole composite number.
The above observation seems to suggest that in order to preserve the security of RSA, it may not be necessary to increase the size of both prime factors, but only of one of them.
Shamir suggested the following version of RSA that he called unbalanced RSA, also known as RSA for paranoids. Choose the RSA modulus to be bits long, the product of a -bit prime and a -bit prime . Since usually RSA is used just to exchange DES keys, we can assume that the messages being encrypted are smaller than .
-
How would you choose the public exponent ? Is a good choice?
-
Once the public exponent is chosen, one computes and keeps it secret. The problem with such a big modulus is that decrypting a ciphertext may take a long time, since one has to compute . But since we know that we can just use the Chinese Remainder Theorem and compute
Shamir claimed that this variant of RSA achieves better security against advances in factoring, without losing efficiency.
Show how, with a single chosen-message attack, meaning obtaining the decryption of a message of your choice, you can completely break the unbalanced RSA scheme by factoring .
E.4.5 Hardness of Diffie-Hellman
Recall the Diffie-Hellman key exchange protocol. is a prime and a generator of . Alice’s secret key is a random and her public key is . Similarly Bob’s secret key is a random and his public key is . Their common key is .
In this problem we will prove that if the Diffie-Hellman key exchange protocol is secure for a small fraction of the values , then it is secure for almost all values .
Assume that there is a ppt algorithm such that
where the probability is taken over the choices of and the internal coin tosses of .
Your task is to prove that for any there exists a ppt algorithm such that for all
where the probability is now taken only over the coin tosses of .
E.4.6 Bit Commitment
Consider the following real-life situation. Alice and Bob are playing “Guess the bit I am thinking.” Alice thinks of a bit and Bob tries to guess it. Bob declares his guess and Alice tells him if the guess is right or not.
However Bob is losing all the time so he suspects that Alice is cheating. She hears Bob’s guess and then declares she was thinking of the opposite bit. So Bob requires Alice to write down the bit on a piece of paper, seal it in an envelope, and place the envelope on the table. At this point Alice is committed to the bit. However Bob has no information about what the bit is.
Our goal is to achieve this bit commitment without envelopes. Consider the following method. Alice and Bob together choose a prime and a generator of . When Alice wants to commit to a bit , she chooses a random such that and she publishes .
Is this a good bit commitment? Do you have a better suggestion?
E.4.7 Perfect Forward Secrecy
Suppose two parties, Alice and Bob, want to communicate privately. They both hold public keys in the traditional Diffie-Hellman model.
An eavesdropper Eve stores all the encrypted messages between them and one day she manages to break into Alice and Bob’s computers and find their secret keys corresponding to their public keys.
Show how, using only public-key cryptography, we can achieve perfect forward secrecy, meaning Eve will not be able to gain any knowledge about the messages Alice and Bob exchanged before the disclosure of the secret keys.
E.4.8 Plaintext-Awareness and Non-Malleability
We say that an encryption scheme is plaintext-aware if it is impossible to produce a valid ciphertext without knowing the corresponding plaintext.
Usually plaintext-aware encryption schemes are implemented by adding some redundancy to the plaintext. Decryption of a ciphertext results either in a valid message or in a flag indicating non-validity, if the redundancy is not of the correct form. Correct decryption convinces the receiver that the sender knows the plaintext that was encrypted.
The concept of plaintext-awareness is related to the concept of malleability. We say that an encryption scheme is non-malleable if, given a ciphertext , it is impossible to produce a valid ciphertext of a related message .
Compare the two definitions and tell us if one implies the other.
E.4.9 Probabilistic Encryption
Assume that you have a message that you want to encrypt in a probabilistic way. For each of the following methods, tell us if you think it is a good or a bad method.
- Fix a large prime and let be a generator. For each bit in , choose at random such that , where is the least significant bit of . The ciphertext is the concatenation of the . What about if you use such that ?
- Choose an RSA public key such that . Pad with random bits to get it to the same length as . Let be the padded plaintext. Encrypt .
- Choose an RSA public key . Assume that is smaller than ; you can always break the message in blocks of that size. Pad with random bits to get it to the same length as . Let be the padded plaintext. Encrypt .
- Choose two large primes . Let . For each bit in , choose at random and set if or if . The ciphertext is the concatenation of the ‘s.
E.5 Secret Key Systems
E.5.1 Simultaneous Encryption and Authentication
Let be a symmetric encryption scheme, cf. Chapter 6, and let be a message authentication code, cf. Chapter 9.
Suppose Alice and Bob share two keys and for privacy and authentication respectively. They want to exchange messages in a private and authenticated way. Consider sending each of the following as a means to this end:
- where encodes the identity of Alice. Bob decrypts the ciphertext and checks that the second half of the plaintext is .
For each, say if it is secure or not and briefly justify your answer.
E.6 Hash Functions
E.6.1 Birthday Paradox
Let be a hash function that outputs -bit values. Assume that behaves as a random oracle, meaning that for each string , is uniformly and independently distributed between and .
Consider the following brute-force search for a collision: try all possible until a collision is found. That is, keep hashing until some string yields the same hash value as a previously hashed string.
Prove that the expected number of hashings performed is approximately
E.6.2 Hash Functions from DES
In this problem we will consider two proposals to construct hash functions from symmetric block encryption schemes such as DES.
Let denote a symmetric block encryption scheme. Let denote the encryption of the one-block message under key . Let
denote a message of blocks.
The first proposed hash function works as follows: let and then define
The value of the hash function is defined as
The second proposed hash function is similar. Again and then
The value of the hash function is defined as
For both proposals, show how to find collisions if the encryption scheme is chosen to be DES.
E.6.3 Hash Functions from RSA
Consider the following hash function . Fix an RSA key and denote
Let the message to be hashed be . Denote and for ,
Then . Show how to find a collision.
E.7 Pseudo-randomness
E.7.1 Extending PRGs
Suppose you are given a PRG which stretches a -bit seed into a -bit pseudorandom sequence. We would like to construct a PRG which stretches a -bit seed into a -bit pseudorandom sequence.
Let denote the first bits of the string and let denote the last bits, that is
where denotes the concatenation of strings and .
Consider the two constructions:
For each construction say whether it works or not and justify your answer. That is, if the answer is no, provide a simple statistical test that distinguishes the output of, say, from a random -bit string. If the answer is yes, prove it.
E.7.2 From PRG to PRF
Let us recall the construction of PRFs from PRGs we saw in class. Let be a length-doubling PRG, from seeds of length to sequences of length .
Let denote the first bits of and the last bits. In other words
and
For any bit string , recursively define
with
The PRF family we constructed in class was defined as where
Suppose instead that we defined
Would that be a PRF family?
E.8 Digital Signatures
E.8.1 Table of Forgery
For both RSA and ElGamal, say if the scheme is:
- universally forgeable
- selectively forgeable
- existentially forgeable
and under which kind of attack.
E.8.2 ElGamal
Suppose Bob is using the ElGamal signature scheme. Bob signs two messages and with signatures and , where the same value of occurs in both signatures. Suppose also that
- Show how can be computed efficiently given this information.
- Show how the signature scheme can subsequently be broken.
E.8.3 Suggested Signature Scheme
Consider the following discrete-log-based signature scheme. Let be a large prime and a generator. The private key is . The public key is .
To sign a message , calculate the hash . If is different from then append to and hash again. Repeat this until . Then solve for in
The signature of the message is
To verify the signature, a user checks that
- Show that valid signatures are always accepted.
- Is the scheme secure?
E.8.4 Ong-Schnorr-Shamir
Ong, Schnorr, and Shamir suggested the following signature scheme.
Let be a large integer; it is not necessary to know the factorization of . Then choose . Let
The public key is , and the secret key is .
To sign a message , generate a random number such that and are relatively prime. Then calculate
and
The pair is the signature.
To verify the signature, check that
- Prove that reconstructing the private key from the public key is equivalent to factoring .
- Is that enough to say that the scheme is secure?
E.9 Protocols
E.9.1 Unconditionally Secure Secret Sharing
Consider a generic secret-sharing scheme. A dealer wants to share a secret between trustees so that no of them have any information about , but can reconstruct the secret. Let be the share of trustee . Let denote the number of possible values that might have, and let denote the number of different possible share values that a given trustee might receive, as is varied. Assume that is the same for each trustee.
Argue that for any secret-sharing scheme. It then follows that the number of bits needed to represent a share cannot be smaller than the number of bits needed to represent the secret itself.
Hint: Use the fact that players have no information about the secret. No matter what values they have received, any value of is possible.
E.9.2 Secret Sharing with Cheaters
Dishonest trustees can prevent the reconstruction of the secret by contributing bad shares . Using the cryptographic tools you have seen so far in the class, show how to prevent this denial-of-service attack.
E.9.3 Zero-Knowledge Proof for Discrete Logarithms
Let be a prime and a generator modulo . Given , Alice claims she knows the discrete logarithm of . She wants to convince Bob of this fact but she does not want to reveal to him. How can she do that?
Give a zero-knowledge protocol for this problem.
E.9.4 Oblivious Transfer
An oblivious transfer protocol is a communication protocol between Alice and Bob. Alice runs it on input a value . At the end of the protocol either Bob learns or he has no information about it. Alice has no idea which event occurred.
A - oblivious transfer protocol is a communication protocol between Alice and Bob. Alice runs it on input two values and . Bob runs it on input a bit . At the end of the protocol, Bob learns but has no information about . Alice has no information about .
Show that given an oblivious transfer protocol as a black box, one can design a - oblivious transfer protocol.
E.9.5 Electronic Cash
Real-life cash has two main properties:
- It is anonymous, meaning when you use cash to buy something your identity is not revealed, compared with credit cards where your identity and spending habits are disclosed.
- It is transferable, that is the vendor who receives cash from you can in turn use it to buy something else. They would not have this possibility if you had paid with a non-transferable check.
The electronic cash proposals we saw in class are all non-transferable. That is, the user gets a coin from the bank, spends it, and the vendor must return the coin to the bank in order to get credit. As such they really behave as anonymous non-transferable checks. In this problem we are going to modify such proposals in order to achieve transferability.
The proposal we saw in class can be abstracted as follows. We have three agents: the Bank, the User, and the Vendor.
The Bank has a pair of keys . A signature with is a coin worth a fixed amount, say . It is possible to make blind signatures, meaning the User gets a signature on a message , but the Bank gets no information about .
Withdrawal protocol:
- The User chooses a message .
- The Bank blindly signs and withdraws from the User’s account.
- The User recovers . The coin is the pair .
Payment protocol:
- The User gives the coin to the Vendor.
- The Vendor verifies the Bank’s signature and sends a random challenge to the User.
- The User replies with an answer .
- The Vendor verifies that the answer is correct.
The challenge-response protocol is needed in order to detect double-spending. Indeed the system is constructed in such a way that if the User answers two different challenges on the same coin, meaning they are trying to spend the coin twice, their identity will be revealed to the Bank when the two coins return to the bank. This is why the whole history of the payment protocol must be presented to the Bank when the Vendor deposits the coin.
Deposit protocol:
- The Vendor sends to the Bank.
- The Bank verifies it and adds to the Vendor’s account.
- The Bank searches its database to see if the coin was deposited already and, if it was, reconstructs the identity of the double-spender User.
In order to make the whole scheme transferable we give the bank a different pair of keys . It is still possible to make blind signatures with . However messages signed with have no value. We will call them pseudo-coins. When people open an account with the Bank, they get a lot of these anonymous pseudo-coins by running the withdrawal protocol with as the signature key.
Suppose now the Vendor received a paid coin and instead of depositing it wants to use it to buy something from another vendor. What they could do is the following:
Transfer protocol:
- The Vendor sends and a pseudo-coin to OtherVendor.
- OtherVendor verifies all signatures and the pair . Then sends a random challenge for the pseudo-coin.
- Vendor replies with .
- OtherVendor checks the answer.
Notice however that Vendor can still double-spend the coin if they use two different pseudo-coins to transfer it to two different people. Indeed since they will never answer two different challenges on the same pseudo-coin, their identity will never be revealed. The problem is that there is no link between the real coin and the pseudo-coin used during the transfer protocol. If we could force Vendor to use only one pseudo-coin for each real coin they want to transfer, then the problem would be solved.
Show how to achieve the above goal. You will need to modify both the payment and the transfer protocol.
Hint: If Vendor wants to transfer the true coin they are receiving during the payment protocol, they must be forced then to create a link between the true coin and the pseudo-coin they will use for the transfer later. Notice that Vendor chooses at random; maybe can be chosen in some different way?
E.9.6 Atomicity of Withdrawal Protocol
Recall the protocol that allows a User to withdraw a coin of from the Bank. Let be the RSA public key of the Bank.
-
The User prepares messages which are all -dollar coins. The User blinds them, that is, they choose at random and compute
The User sends to the Bank.
-
The Bank chooses at random of the blindings and asks the User to open them. That is, the Bank chooses and sends them to the User.
-
The User opens the required blindings by revealing .
-
The Bank checks that the blindings are constructed correctly and then finally signs the unopened blinding. Without loss of generality, assume this to be the first one. So the Bank signs by sending to the User
-
The User divides this signature by and gets a signature on which is a valid coin.
Notice that the User has a probability of to successfully cheat.
Suppose now that the protocol is not atomic. That is, the communication line may go down at the end of each step between the Bank and the User. What protocol should be followed for each step if the line goes down at the end of that step in order to prevent abuse or fraud by either party?
E.9.7 Blinding with ElGamal/DSS
In class we saw a way to blind messages for signatures using RSA. In this problem we ask you to construct blind signatures for a variation of the ElGamal signature scheme.
The ElGamal-like signature we will consider is as follows. Let be a large prime, a large prime dividing , an element of order in , the secret key of the Bank, and the corresponding public key. Let be a collision-free hash function.
When the Bank wants to sign a message she computes
for a random , and
and finally
The signature of the message is . Given the triple the verification is performed by computing and checking that
So the withdrawal protocol could be as follows:
-
The User tells the bank she wants a -dollar coin.
-
The Bank replies with values for random .
-
The User sends back where the are all -dollar coins.
-
The Bank asks the user to open of those.
-
The User reveals of the ‘s.
-
The Bank replies with
for the unopened index .
However this is not anonymous since the Bank can recognize the User when the coin comes back. In order to make the protocol really anonymous, the User has to change the value of the “challenge” computed at step . This modification will allow the User to compute a different signature on on their own which will not be recognizable to the Bank when the coin comes back. During the protocol the Bank will check as usual that this modification has been performed correctly by asking the User to open random blindings.