top of page
Writer's pictureR K Gaur

CEG 4750/6750 Information Security Programming Project 1 Solution in cpp

Updated: Aug 16, 2023

1. The objective:


The objective of this project is for the students to read the provided DES encryption/decryption source programs, to have a good understanding of DES encryption/decryption functions in crypto++ library, to learn about the crypto++ library, and to get familiar with the server environment, fry.cs.wright.edu, and to compile/run the DES encryption/decryption programs on fry.cs.wright.edu. The graduate students need to make minor modifications of the source programs for the third task.


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 DES 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.


Task 1: Compile, and execute the provided source DES encryption/decryption programs, and verify the decrypted file is identical to the original plaintext file.


The students can compile the provided DES encryption/decryption programs on fry.cs.wright.edu, and then execute the corresponding DES encryption/decryption program to encrypt a file and decrypt it to verify if these DES encryption/decryption systems work correctly or not by comparing the decrypted file with the original plaintext file to see if they are identical. Suppose your original plaintext file name is ‘testfile1’, then your encrypted file can be named ‘testfile1.e’, and your decrypted file can be named ‘testfile1.d’. You can use “diff” command to show the difference of two files (the original plaintext file, and the decrypted file) under the linux environment on fry.cs.wright.edu.


You can find 5 test files on Pilot: MSG1, MSG2, MSG3, text1, and hw2.pdf.gz (These files are zipped into one file). Please copy all those files to your directory.

Assume the created encrypted files are named MSG1.e, MSG2.e, MSG3.e, text1.e, and hw2.pdf.gz.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.


Print your encrypted file using “ od –b filename. ” to check how many bytes are different between MSG1.e and MSG2.e, between MSG1.e and MSG3.e.


You can use “diff” to show the difference of two files (the original file, and the decrypted file) under the linux environment. The command format is as follows:


diff testfile1 testfile1.d

The output should be empty when the two files are identical.


Task 2: The key is hardcoded in the provide source DES encryption/decryption programs. Please change the source code files of the DES encryption/decryption programs, so that the key is changed in the source DES encryption/decryption programs. Then recompile, and execute the DES encryption/decryption programs again. Verify again the decrypted file is identical to the original plaintext file. Put the screenshots of the verification into the report.


Task 3: The provided source DES encryption/decryption programs are doing DES encryptions in ECB mode. Please change the source code files of the DES encryption/decryption programs, so that the encryption/decryption program is working in CBC mode (You can use the cryptopp library functions directly). Then recompile, and execute the DES encryption/decryption programs again. Verify again the decrypted file is identical to the original plaintext file. Put the screenshots of the verification into the report.


Task 4 (For graduate students only): The key is hardcoded in the provide source DES encryption/decryption programs. Please change the source code files of the DES encryption/decryption programs, so that the key would be entered through the command line as the 4th input argument.


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.


  1. 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 is the same as shown above, you can compile your c++ program source.cpp using the following command:

cryptog++ <sourcefile.cpp> -lcryptopp -o desenc1


  1. Compiling method 2:


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


  1. Execution:


You can use the following command to execute your program.


./desenc1


Tutorial to use the DES function in the crypto library Crypto++:



  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"



For Manual Solution with 100% Plagiarism free code please Text at: +91 - 995 314 1035

Solution Includes: Plagiarism and AI report with 100% Accuracy.








24 views0 comments

Comments


bottom of page