PA #2: Cryptography engineering

Due: Saturday, Oct 22 11:59PM

Open in Colab

age, pronounced like the Italian word “aghe”, is a file encryption tool and format. In this assignment, you will implement a basic reader for the age file format in Python.

Running the assignment

This assignment is primarily intended to be run using Google Colaboratory. If you’re already familiar with Colab, you can go ahead and click the “open in Colab” badge at the top of the assignment and start following the instructions there. Alternatively, you can download the notebook locally and run it using Jupyter Notebook.

If this is your first time using Colaboratory or Jupyter, I suggest checking out their tutorial so that you can get used to writing code in the Colab environment.

After you’ve started the notebook, make sure to create a copy of it. This will ensure that any changes that you make to the notebook are saved.


Homework submissions

When your assignment is complete, you may upload it to UVA Collab as either a .ipynb file, or you may simply share the notebook and give us the sharing link (make sure that we have permission to see your notebook).


There are seven functions that you need to implement in total for this assignment:

  • generate_wrap_key
  • decrypt_file_key
  • generate_hmac_key
  • is_valid_header
  • generate_payload_key
  • decrypt_payload
  • read_age_file

Each of these functions is worth 1.5 points (with the except of generate_hmac_key, which is worth 0 points). To evaluate your assignment, we will run your implementations of these functions against the test cases in the notebook to ensure the validity of your code.