CEG 4750/6750 Information Security
Programming Project 2
Spring 2022
In this program assignment, you will write a program to implement the RSA public-key cryptosystem. The RSA public-key cryptosystem has three parts: (1) Key generation (2) Encryption (3) Decryption.
In this project, the undergraduate students will use the Crypto++ library to build your RSA encryption/decryption system, i.e., to implement the RSA encryption/decryption. To do this, you will be required to learn and use the Crypto++ library.
The graduate students will have an additional task, i.e., implement the key generation of the RSA algorithm additionally, i.e., to generate a pair of 1024 bits keys: (e,n), (d,n) for the RSA algorithms.
The RSA encryption/decryption algorithms you implemented using the Crypto++ functions need to correctly encrypt and decrypt a file. You are required to encrypt/decrypt 3 test files on Pilot: MSG1, MSG2, MSG3. Assume the created encrypted files are named MSG1.e, MSG.e, MSG3.e respectively for each file, and the decrypted files are named MSG1.d, MSG.d, MSG3.d respectively for each file. If the decrypted file MSG1.d is the same as the input plain text file MSG1, then your RSA encryption/decryption algorithm works correctly. It is recommended that you encrypt one character at a time.
You can use “diff” to show the difference of the input plain text files and the decrypted file under the linux environment. Also, you can print your encrypted file using “ od –b filename” for debugging purpose.
If your encryption program, decryption program also works for the binary files (i.e., a pdf file, or an executable file), you get 15 bonus points.
For all the students: Implement the RSA encryption/decryption algorithm: The RSA key is given as follows.
Modulus: 2bf2978bc6d37fbfccdb013f2c33cac70bf704103aa8e8c39872e53df3812096228af96585d7cd4c036e36112a5f7c52b0b18c984e595894edb507c74cc1f0e1242016858be4f31c094d7904cf24c784d1976ec8cb95fd7adf3f331cda949fe1c903224ffd7dcc538467296996abad0d63338652ca08650e1d1490ab5fc482277af187ab83e9ebcf8108e0216a2cc4aff41b0458545868d5c9d210a0a1337e6f221ed5dfbfab2547dc6a80f35f78969c07208325cc106d583c6869555ada27026d5fa118ab8c3ef34209906d6de2af61b955f3baf41059b5e0daf9d6b38dcaff5aeb6baddca656208435b9e78385305645ce2b440fd5eb3b9e70b890dd32f8d
Public exponent: 132f6ca389a263b32cf4354714c61878840bb20b4951fe9b5e24900633be5f60139d738b9a55ef20ff4c4380f7e37e5fc323c0fe78fb22ebcb8c055fe747b29df041a324796fe2850a927460220ab6917d2080e8cf20f1616df41edeebee8089e2346d5be902f957e618e18b0a4904fa0eaf839485605dda9e05a80d000bc3278f557eb65a465961e2469436b5d7166a6f155fa7104626c309f297369af482735463e36d7e4715a874f8fa6d3aba95dbeabc5773546957e9797247c35533bca3cec62934b875cc8ac11b294dbe6a147602e18ff39a01bcfe1187c0095d49a3cfa52d500381eda217595b8c70cc8b2a46a477f2bec557703dc7441301a748e3
Private exponent: 1f7bcdec632aeb6c4aa0d6a34dbd622743376f8eb80a71b5c137729aa4a0c45f482acb2066e93079bf15bb399cf7968f1e9ce9cf079ba43a8d9a8a38665075ce762e0bd3ec55d37aeb5ece0b0ebdcde5b9f971471e76f2facd074dde8b7036a277195da2d6bb9d1e3c75d404c08d7bf90db6585f76688160c7efe9cd94c059771bbb7a1e548001370bd474bacd11aa97c92936e9b2f9875131ebdaa7c17868ffb50bfe745058f015b4ea15fc0285a04e3fb473468f4d1dab790737aa26e00a76a1f4df4f07c7fdf13d7f031082d9bf7688423a6f83502a8c076cab00002efe9d9ae252703cbed2bff3e7ad557e0743792cbea6be7ded30aef8e40d3c275422b
Additional task for graduate students: Use the cryptopp library to generate a pair of 1024 bits keys: (e,n), (d,n) for RSA algorithms.
Requirements again:
1. In order to use the cryptopp environment installed under the cs unix server, bender.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, bender.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 ssh using computers outside Wright State University 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 bender.cs.wright.edu. Then you can compile and execute your programs on bender.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.
3. 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.
How to compile your programs on bender.cs.wright.edu
bender.cs.wright.edu is a unix server and cryptopp is installed on it.
You can compile your c++ program source.cpp using the following command:
cryptog++ <sourcefile.cpp> -lcryptopp -o desenc1
You can use the following command to execute your program.
cryptoexec ./desenc1
Tutorial to use the RSA functions in the crypto library Crypto++:
1. In order to use the k 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/rsa.h”
#include “cryptopp/sha.h”
#include “cryptopp/filters.h”
#include “cryptopp/osrng.h”
using namespace CryptoPP;
2. How to compile your source program:
g++ -o test1 -L. test1.cpp -lcryptopp
-L. : search library file in current directory and the specified directories.
-lcryptopp : link CryptoPP library.