Notes and Requirements for AES CTR/CBC Implementations

  1. You are assumed to use Java. Before submitting your programs, upload to your unity account and test. Make sure they can make and run. 
  2. Submit 3 files
  3. Your program should take three arguments: mode, IV, and key. Mode could be either "enc", which stands for encryption, or "dec", which stands for decryption. IV and key are strings to be converted into the initialization vector and the key.

    Use "UTF8" encoding for the IV and the key. This means that you can use, for example, IVString.getBytes ("UTF-8") to get the byte value for the IV.

    Assume the plaintext is stored in a file named "plain-in" for encryption, and store the ciphertext in a file named "cipher-out". Similarly, for decryption, assume the cipher text is in a file named "cipher-in", and store the plaintext in a file named "plain-out".

    For example, you may use the following command to encrypt the plaintext in a file named "plain-in" and store the ciphertext in a file named "cipher-out", using IV 1234567887654321 and key 8765432112345678.

java AESCTR enc 1234567887654321 8765432112345678

or

java AESCBC enc 1234567887654321 8765432112345678

  1. Padding: Simply pad 0's to fill in the last block. That is, if the last block is already full, do nothing. If the last block doesn't have 16 bytes, repeatedly put byte 0 until you have 16 bytes. Assume you don't have byte 0 in the plain text. During decryption, simply remove bytes with value 0 from the end.
  2. Use AES/ECB/NOPadding as the transformation. Use doFinal or update method to encrypt/decrypt each block.
  3. You should test your program before submission. At least make sure you can get the plaintext back. Also check with TA's test vectors.
  4. In the CTR mode, the IV can be represented as a 16 byte array IV[16]. Assume IV[0] as the most significant byte and IV[15] the least significant byte. In other words, each time you increment IV, add one to IV[15] and process the other bytes appropriately.
  5. Grading. If your program can run, you get 6 basic points. You get 7 points for correct execution of AESCTR, and another 7 points for that of AESCBC.
  6. Submission: You need to submit your 3 files online through the "Submit Assignments".

Test Vectors:

Download test vectors.

Please direct all questions about the text vectors to the TA.