CS 223 In-lab 12
Week of 4/24

For CS 223, in-labs will consist of a mix of exercises and problems and short programming assignments.  These will be due at the end of the lab period.  You may occasionally be assigned homework problems as well.  Homework will always be due at the beginning of the next lab.

Testing out the RSA Cryptosystem

The goal of this in-lab is to experiment with some simple RSA code that I found on the web and modified slightly (Driver.java, RSA.java).  It implements the RSA cryptosystem exactly the way we discussed in class.  First, compile this code and try running it.  It prints out a simple test for sending the message 'hello alice'.  It also prints out the public and private keys.  In this case the public key is the pair (public, modulus) and the private key pair is (private, modulus).  Your task is to make some simple modifications to the code and test it out:

  1. Prompt the user for the number of bits to use for the key sizes (this is necessary if you want to send longer messages); try a few different sizes and see what happens.
  2. Modify the encryption and decryption functions so that the user can supply their own key values rather than the default class variables.  This lets you encode a message with someone else's key.
  3. Send a test message to someone else in the lab using their public key.  Have them respond to you with your public key.  Decrypt their response.

Bonus Question

Implement digital signatures.  Show how you can digitally sign a message using RSA and generate a example showing this.

Course Evaluations

Please complete the online course evaluation form for CS 223 located here.  I hope you enjoyed the course.

What to Turn In

  • Source code and a printout of several runs showing some encrypted and decrypted messages.
  • Verbal acknowledgement that you filled in the course evaluation form.
  • Double check with Will that your lab grades for the semester are correct.