1. The objective:
The objective of this project is for the students to read the provided AES encryption/decryption source programs, to have a good understanding of AES encryption/decryption functions in crypto++ library, to ger more familiar with the crypto++ library.
2. Submission:
A team can have up to 3 students. All students in the same team will receive the same grade.
a. Each team only submits one report or a copy of reports/answers/files. (See the section of tasks).
b. Each team member needs to submit the list of names of all team members.
3. Project Description
In this project, the AES encryption /decryption programs are provided, and the students will compile and run these programs to encrypt/decrypt files on fry.cs.wright.edu. The DES encryption /decryption programs used an existing crypto library, Crypto++ (C++), which was installed on fry.cs.wright.edu.
4. Project Description
Task 1: ( 60 points for undergraduate students, 30 points for graduate students) The provided source AES encryption/decryption programs are doing AES encryptions in ECB mode. Please change the source code files of the AES encryption/decryption programs, so that the encryption/decryption program is working in CBC mode (You can use the cryptopp library functions directly). Then compile, and execute the AES encryption/decryption programs. Verify the decrypted file is identical to the original plaintext file (You can use “diff” to show the difference of two files (the original file, and the decrypted file) under the linux environment.) Put the screenshots of the verification into the report.
You can find 5 test files on Pilot: MSG1, MSG2, MSG3, text1 (These files are zipped into one file). Please copy all those files to your directory.
Assume the encrypted files are named MSG1.e, MSG2.e, MSG3.e, text1.e, respectively for each file. For both the undergraduate students and graduate students, you need to report how many bytes are different between MSG1.e and MSG2.e, and how many bytes are different between MSG1.e and MSG3.e in your report.
Task 2 (For graduate students only, 30 points): Please change the source code files of the AES encryption/decryption programs, so that the encryption/decryption program is working in Counter mode (You can use the cryptopp library functions directly). Then compile, and execute the AES encryption/decryption programs. Verify the decrypted file is identical to the original plaintext file (You can use “diff” to show the difference of two files (the original file, and the decrypted file) under the linux environment.) Put the screenshots of the verification into the report.
Requirements again:
1. In order to use the cryptopp environment installed under the cs unix server, fry.cs.wright.edu, you need to connect to this unix server remotely using a secure shell client, putty. You can remotely connect to this unix server, fry.cs.wright.edu, on campus from a Wright State computer or use your own laptop connecting to the WSU wifi network named “WSU-Secure”. Note that you cannot remotely connect to this computer using putty off campus without installing VPN or use the campus “WSU_EZ_CONNECT” wifi network. If you want to connect to this server remotely off campus, you need to install VPN on your computer first. If you want to edit your c++ source programs under windows, download notepad++. Then edit your source programs using notepad++. After you finish editing the c++ source programs, using the secure file transfer client (WinSCP, you can download it online, and install it on your personal computer) to transfer your c++ source programs to fry.cs.wright.edu. Then you can compile and execute your programs on fry.cs.wright.edu.
2. You must submit the modified source code files for the tasks that require modified source codes, a report, possibly a README file, through Pilot before the due date. In your report, please include screenshots of the compiling, the execution of DES encryption/decryption programs, and the verification of the execution results. If for some reason Pilot is unavailable, submit your source code, report by email to the instructor Meilin Liu, whose email address is meilin.liu AT wright.edu. The source code files, and the report should also have: Course Number / Course Title, your name, prof.’s name, date, and the project name. If you did not include these required contents in your submitted files, then 5 points will be deducted. If needed, please submit a README file to tell the instructor or the grader how to compile and execute your programs.
How to compile your programs on fry.cs.wright.edu
fry.cs.wright.edu is a unix server and you can use the cryptopp installed on it.
Compiling method 1:
Once you log into fry.cs.wright.edu, use an editor, such as vim, to add the follow lines into the end of your .bashrc.
==========================
if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi
Then you can use the following command, cat /home/containers/.bash_aliases, to see if the output is as follows:
[w901mxl@login01 ~]$ cat /home/containers/.bash_aliases
## container aliases
alias cryptog++='srun singularity exec /home/containers/cryptopp.sif g++'
alias cryptorun='srun singularity exec /home/containers/cryptopp.sif'
If the output contains the commands as shown above, you can compile your c++ program source.cpp using the following command:
cryptog++ <sourcefile.cpp> -lcryptopp -o desenc1
Compiling method 2:
Every time, you log into fry.cs.wright.edu, run the command,
alias cryptog++='srun singularity exec /home/containers/cryptopp.sif g++'
then you can run the command, alias,
If the output contains the commands as shown below
alias cryptog++='srun singularity exec /home/containers/cryptopp.sif g++'
Then, you can compile your c++ program source.cpp using the following command:
cryptog++ <sourcefile.cpp> -lcryptopp -o desenc1
3. Compiling method 3:
Once you log into fry.cs.wright.edu, you can compile your c++ program source.cpp using the following command without modifying the .bashrc.
srun singularity exec /home/containers/cryptopp.sif g++ des_encode_SP2023.cpp -lcryptopp -o desencl
Execution:
You can use the following command to execute your program.
./desenc1
Tutorial to use the AES function in the crypto library Crypto++:
On fry.cs.wright.edu, the crypto++ library is installed, which you can use directly. You can log into fry.cs.wright.edu using you school wid (w123abc) and corresponding password. You can remotely connect to fry.cs.wright.edu on campus from a Wright State computer or use your own laptop connecting to the WSU wifi network named “WSU-Secure”. Note that you cannot connect to fry.cs.wright.edu using computers outside Wright State University without installing VPN or use the campus “WSU_EZ_CONNECT” wifi network, i.e., you need to follow the instructions to install VPN on your computer first.
1. In order to use the crypto library, in your C++ source program (e.g., test1.cpp), you need to include the right library files, and use the right namespace as follows.
#include "cryptopp/cryptlib.h"
#include "cryptopp/hex.h"
#include "cryptopp/filters.h"
#include "cryptopp/des.h"
#include "cryptopp/aes.h"
#include "cryptopp/modes.h"
2. How to compile your source program:
cryptog++ <sourcefile.cpp> -lcryptopp -o test
-lcryptopp : link CryptoPP library.
3. How to execute your program:
cryptoexec ./test
4. Encryption with AES in ECB mode:
A text string can be encoded with AES algorithm using the following tool function:
string aes_encode(string & plain, byte key[])
{
string cipher;
try{
ECB_Mode<AES>::Encryption enc;
enc.SetKey(key, AES::DEFAULT_KEYLENGTH);
StringSource(plain, true, new StreamTransformationFilter(enc, new
StringSink(cipher))); //add padding by StreamTransformationFilter
}
catch(const CryptoPP::Exception & e)
{
}
return cipher;
}
The input parameter "plain" is the plain text that you want to encrypt with AES encryption algorithm. The input parameter "key" is a byte array that stores the key you want to use during the cipher process of AES. The length of the key array is defined by constant AES::DEFAULT_KEYLENGTH (AES::DEFAULT_KEYLENGTH is 16 for now).The string returned by this function is the output cipher text. In this program assignment, for simplicity, we use AES in ECB mode (In ECB mode, each block of 128 bits of plaintext is encrypted independently using the same key). The input plaintext is padded by StreamTransformationFilter tool if the number of bits in the input plain text file is not a multiple of 128 bits (16 bytes).
5. Decryption with AES in ECB mode:
A cipher text can be decrypted with AES algorithm using the following tool function:
string aes_decode(string & cipher,byte key[])
{
string plain;
try{
ECB_Mode< AES >::Decryption dec;
dec.SetKey(key, AES::DEFAULT_KEYLENGTH);
StringSource s(cipher, true, new StreamTransformationFilter(dec, new
StringSink(plain)));
}
catch(const CryptoPP::Exception& e){
}
return plain;
}
The input parameter "cipher" is the ciphertext that you want to decrypt with AES in ECB mode. The input parameter "key" is a byte array that stores the key you want to use during the decryption process of AES. The length of key array is defined by constant AES::DEFAULT_KEYLENGTH.
For Manual Solution with 100% Plagiarism free code please Text at:
Leave a WhatsApp message at : +91-995 3141 035 (For quick response)
Solution Includes: AI writing Detection and Plagiarism report with 100% Accuracy.
コメント