Question: 1 . ( 2 5 points ) In this problem, you will use AES to encrypt and decrypt PGM image files. Since these files will
points In this problem, you will use AES to encrypt and decrypt PGM image files. Since these files will have large sizes, you will implement the ECB mode of operation. For this problem, you need to implement the following methods in ImageCipher.java: bitsToHexString stateToBits readBlock writeBlock processHeader encryptECB and decryptECB To encrypt a file, you will first copy the header from the input file to the output file during the encryptiondecryption process. Then you will encrypt the integer pixel values each one of which occupies a single byte sixteen at a time, since AES processes blocks of size bits. The test files for this assignment will always contain a total number of pixels that is a multiple of Therefore, you will never have to worry about padding the last block. Once you have encrypted or decrypted a block, you will have to break it up again into bytes, convert each one to a decimal number between and ; no negative values! and write to the output file this integer in its ASCII representation. Make sure that each printed integer occupies EXACTLY characters with white space padding in front if needed and is followed by a single newline character. This is to guarantee that the output file will always have exactly the same size as the input file. In the end, the output encrypted or decrypted file will be a valid pgm file but with different pixel values resulting from the blockbyblock encryptiondecryption dictated by AES and the mode of operation you are implementing.
Once you have implemented all of the incomplete methods listed above whose specification is given within the source file you can test your program with a sequence of commands like these:
ls l checkerpgm
java ImageCipher e ECB checker AABBCCDDEEFF
ls l checkerpgm
display checkerECB.pgm
java ImageCipher d ECB checkerECB AABBCCDDEEFF
ls l checkerpgm
diff checker.pgm checkerECBdec.pgm
points In this problem, you will use AES to encrypt and decrypt PGM image files. Since these files will have large sizes, you will implement the CBC mode of operation. For this problem, you need to implement the following methods in ImageCipher.java: hexStringToBits xor encryptCBC and decryptCBC The rest of this problem's description is identical to the one given above.
Once you have implemented all of the incomplete methods listed above whose specification is given within the source file you can test your program with a sequence of commands like these:
ls l checkerpgm
java ImageCipher e CBC checker AABBCCDDEEFF ABCDEFFEDCBA
ls l checkerpgm
display checkerCBCpgm
java ImageCipher d CBC checkerCBC AABBCCDDEEFF ABCDEFFEDCBA
ls l checkerpgm
diff checker.pgm checkerCBCdec.pgm
points In this problem, you will use AES to encrypt and decrypt PGM image files. Since these files will have large sizes, you will implement the CTR mode of operation. For this problem, you need to implement the following methods in ImageCipher.java: encryptCTR and decryptCTR For this problem, you may want to use the BigInteger class in the Java library in order to handle the bit integer values used for the counter. The rest of this problem's description is identical to the one given above.
Once you have implemented all of the incomplete methods listed above whose specification is given within the source file you can test your program with a sequence of commands like these:
ls l checkerpgm
java ImageCipher e CTR checker AABBCCDDEEFF ABCDEFFEDCBA
ls l checkerpgm
display checkerCTRpgm
java ImageCipher d CTR checkerCTR AABBCCDDEEFF ABCDEFFEDCBA
ls l checkerpgm
points In this problem, you will use AES to encrypt and decrypt PGM image files. Since these files will have large sizes, you will implement the ECB mode of operation. For this problem, you need to implement the following methods in ImageCipher.java: bitsToHexString stateToBits readBlock writeBlock processHeader encryptECB and decryptECB To encrypt a file, you will first copy the header from the input file to the output file during the encryptiondecryption process. Then you will encrypt the integer pixel values each one of which occupies a single byte sixteen at a time, since AES processes blocks of size bits. The test files for this assignment will always contain a total number of pixels that is a multiple of Therefore, you will never have to worry about padding the last block. Once you have encrypted or decrypted a block, you will have to break it up again into bytes, convert each one to a decimal number between and ; no negative values! and write to the output file this integer in its ASCII representation. Make sure that each printed integer occupies EXACTLY characters with w
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
