CMSC 414 Fall 2002 Homework # 2 Due October 3, 2002 Note Change: The written exercises may be handed in prior to the beginning of class. The programming portion still must be electronically SUBMITted by 12:00 Noon on the above date. Directions use of the SUBMIT program are still on the class webpage: http://www.cs.umd.edu/class/fall2002/cmsc414/submit/submit.txt Written Exercises: 1. (Problem #19 from page 290) Suppose Alice and Bob have RSA public keys in a file on a server. They communicate regularly using authenticated, confidential messages. Eve wants to read the messages but is unable to crack the RSA private keys of Alice and Bob. However, she is able to break into the server and alter the file containing Alice's and Bob's public keys. a. How should Eve alter that file so that she can read confidential messages sent between Alice and Bob, and forge messages from either? b. How might Alice and/or Bob detect Eve's subversion of the public keys? 2. (Problem # 8 from page 323) Consider an RSA digital signature scheme (see section 10.6.2.1). Alice tricks Bob into signing messages M1 and M2 such that M = M1 * M2 mod Nbob. Show how Alice can forge Bob's signature on M. 3. (Problem # 9 from page 323) Consider the example on page 317. Show that if Alice first signs the message, and then encrypts the result Bob will be unable to successfully complete the attack he used when she enciphered first and then signed. 4. Discuss the use of three different ciphers discussed in class and in the textbook. Consider a) a single substitution cipher, b) two substitution ciphers applied one after the other, and c) a cipher which is the combination of a substitution cipher followed by a transposition cipher. Specifically, discuss the in-class Vigenere example (still at: http://www.cs.umd.edu/class/fall2002/cmsc414/Examples/vigenere_ex1.txt which was encrypted with the key "BISHOP" as an example of a), the same cipher followed by a second Vigenere encryption using the key "UCDAVIS" as an example of b), and the original example followed by the rail fence transposition cipher as an example of c). Use words like "confusion" and "diffusion" in your analysis of the effectiveness of each of these three ciphers. Programming Exercises: You must use Java, JDK 1.3.1 . Submit a tar file including the source code, the executable version, and all relevant documentation (as in the previous assignment). See the web page for format and usage specifications. If the problems below seem underspecified, make a reasonable assumption and proceed. State your assumption in the documentation, and attempt to justify it. For example, although obviously insufficient in a real world application, assuming that the following programs will be running on the same machine (e.g. "localhost" can be used as the internet address) is sufficient to demonstrate proof of concept. On the other hand, hard- coding socket numbers is just a rookie error that we do not expect to see in senior level CS classes. To be polite, and not use up all the popular sockets the night before the program is due, you may consider using sockets that are some function of the last 3 digits of your class account (1XXX, 500 + XXX, etc). 1. Write two java programs to implement Diffie-Hellman key exchange, using sockets. After the exchange, each program should output the derived secret. Call your programs Alice.java and Bob.java 2. Write a third program, Eve.java, to perform a "man in the middle" attack. Each program should output the derived secrets, and what they _think_ the secret represents. You may assume that Alice and Bob have no out of band method of confirming which socket(s) the other party will use. 3. Augment your above programs, and name the new programs A1.java, B1.java, and E1,java. The new programs should take messages from standard input and encrypt them with the shared (or assumed shared) secret. The sending program should echo the cipher- text before sending the message, and the receiving program should first output the ciphertext, then decrypt and output the corresponding plaintext. If E1.java is not running, A1 and B1 should do this as advertised. If E1 is running, she will carry on with her MITM attack, outputting both the ciphertext and the plaintext for all encryptions and decryptions she performs. For this assignment, E1 need only read the messages, she does not need to have the capability to change a message A1 send to B1 or to forge messages from either. Note that I will test this both ways, with and without the MITM program running. Obviously, I will restart all programs when changing modes. You may encrypt with DES or RC4 (see handout). The newer versions of Java provide a lot of cryptographic support, if you are not familiar with the most recent versions you should familiarize yourself before re-inventing the wheel. OIT initially promised me that you would have JDK Version 1.4, which makes the 3rd problem trivial. It seems like you have 1.3.1 (thus the option to use RC4, which is easy to code from scratch). I will follow up with them about getting you JDK 1.4, but will not make any promises!!