The objective of this lab is to explore the different modes of operation of block ciphers by implementing 5 of the modes.
Write a program that encrypts a given plaintext file with the given key. The program gets the name of the file that contains the key, name of the file that contains the plaintext, and a prefix for the names of the file containing the ciphertexts from the command line. The program will encrypt the plaintext file in the 5 modes below using 128-bit AES and produce a file for each mode below.
4. CFB (128-bit)
5. CTR (counter starts with 0)
After producing the 5 ciphertext files, the program will decrypt these files and store the decrypted texts in 5 separate files. NoteCBC,OFB, and CFB modes require an initialization vector (IV). Use the SecureRandom class in Java to generate the IVs. Note that you need to keep these IVs for decryptions in modes CBC, CFB, and OFB.
So, if the program is run by
encrypt key.txt plain.txt cipher
then the program will produce 10 files :
Note that at the end of a successful run, the files cipherECBdec.txt, cipherCBCdec.txt, cipherOFBdec.txt, cipherCFBdec.txt, cipherCTRdec.txt will all contain the same data which will be the pliantext that you started with. The plaintext will be given in hexadecimal one block per line. You can assume that each line will have 32 hex digits (hence you will NOT need to do any padding.)
Plain text file:
Recently Asked Questions
- Bambino Ltd would like to assess the country risk of South Africa. Bambino Ltd has identified various political and financial risk factors, as shown below.
- What would eliminating the juvenile justice system entail? How would juvenile offenders be treated? Where would they be housed? What would such a change do to
- Which employer pension plan has an individual account for each employee? Question 3 options: Undefined-contribution plan Defined-contribution plan