Public-Key Encryption and Signature Lab Liberty
University
RSA Public-Key Encryption and Signature Lab
Yones Azzab
CSIS 463_B01
, RSA Public-Key Encryption and Signature Lab | 2
Introduction
The pre-built Ubuntu image and instructions from SEED Labs are used in this experiment. The
"RSA Public-Key Encryption and Signature Lab" is the specific assignment. Rivest, Shamir, and
Adleman, or RSA, invented public-key cryptosystems and is still in use today. The RSA asymmetric
algorithm produces a key value pair consisting of the public and private keys in addition to two huge,
random prime numbers. I have a better knowledge of the operation of the RSA algorithm and the public-
private key paradigm in cryptosystems as a result of doing this lab. Digital signatures and
encryption/decryption were introduced at the lab.
The SEED Labs Ubuntu 24.04 image and Oracle VirtualBox were the system requirements for
this lab. The lab was finished using a combination of Python and C programming languages. Additionally,
the lab makes use of the BIGNUMs API and OpenSSL for the various programs that must be developed.
Unlike many cryptography labs that rely on a GUI or CLI tool to carry out tasks, this lab largely relies on
programming in C utilizing the OpenSSL and BIGNUMs API.
Method
There were six tasks in this lab to be completed. I described in detail how I go about finishing
each assignment. The creation of a C program and the use of a private or public key or certificate were
prerequisites for each task.
Task 1
I started by creating a directory using mkdir and then I used vi to build a C file from the code
that was given in the first task. Then I used gcc and the crypto library to compile the code using the
following code:
Gcc -o task1 task1.c -lcrypto
, RSA Public-Key Encryption and Signature Lab | 3
I was able to become acquainted with BIGNUMs and OpenSSL as a result. I then ran the following code
to obtain the private key:
./task1
Task 2
Encrypting the message "A top secret!" was necessary for the second job. To convert ASCII to
hex, the lab provides a Python tool. I used this command to convert the hex to a BIGNUM in my C
program. I used Python to produce the hex first:
Python3 -c ‘print(b“A top secret!”.hex())’
Since I was using Python3, I had to do some searching to figure out how to use the hex. I used a guide I
found on stackoverflow (Python 3 String to Hex, n.d.) to assist me with this part. Then I used gcc and
the crypto library to compile the code and ran the output once again. This resulted in an encrypted and
decrypted message.
Task 3
The only difference between the third task and the second one was that in this one the program
created for the second task required encryption. This was done using the vi function to edit the code
from the last task. I compiled and ran the code to get the decrypted message. I then used Python to
translate the decrypted message back to ASCII using the following command:
Python3 -c ‘print(b”A top secret!”.hex())’
Task 4
Beyond the encryption and decryption of the previous processes, there was more to the fourth
task. The message has to be signed in order to complete this task. First, I used Python to produce hex
from the provided value: