# RSA Implementation Using OpenSSL Project

INCS 741(Cryptography)

RSA -Assignment

1) Using the Openssl cryptographic library implement the RSA public key encryption

scheme.

2) Specifications

a. The program should first generate prime numbers p, and q. It should then calculate

values of n, e and private key d. The value of e should be chosen randomly.

b. It then prompts the user for an input message m. It should encrypt and decrypt m

using the RSA encryption keys you created in the first step. The program should

display the values of p and q, of the public key {n,e} used for encryption, the

ciphertext, the private key {n,d} used for decryption and the decrypted text.

Test

1) Use your code to derive an RSA encryption key pair using the values of p and q. The

program should choose values of p and q greater than 128 bits and less than 512 bits.

2) Choose random text message m and use your code to encrypt and decrypt the message with

your generated public key and private key and show the result with screenshots.

3) Is the decrypted message same as plaintext m, explain?

4) Modify your code to generate digital signatures. Generate a signature for message m= “I

owe you $1000” and output the message and its digital signature to the screen. How would

the receiving party verify the message and its signature. Explain?

Note

1) Generate the hex value of the message before encryption.

2) Use the following link as a reference for this assignment.

http://www.cis.syr.edu/~wedu/seed/Labs_16.04/Crypto/Crypto_RSA/Crypto_RS

A.pdf

Submission

Submit the following documents separately in Blackboard by the deadline. NO ZIPPED

FILES ALLOWED

1) All your code files.

2) A detailed README file, which should explain how to run the code with sample

input and output. If you are unfamiliar with READMEs you can find an introduction here

https://www.makeareadme.com/ , here https://medium.com/@meakaakka/a-beginnersguide-to-writing-a-kickassreadme-7ac01da88ab3 and here

https://www.youtube.com/watch?v=RZ5vduluea4. Note that the README file you

submit for this project need not be complex, it only needs to at least explain how

to compile the code and run the code with examples.

3) A MAKEFILE that automates the building/compiling of your code. If you are

unfamiliar with Makefiles you can get a quick introduction here

https://www.youtube.com/watch?v=vye0kV5gvkA and here

https://swcarpentry.github.io/make-novice/02-makefiles/. Note that the exact

structure of your makefile will depend on the programming language you are

using, so you may choose to find an example specific to you. The Makefile you

create for this assignment need not be complicated. It only needs to define the

TARGET, its DEPENDENCIES, if any and the COMMAND to create the target

executable.

4) A report (which should include your test results with screen shots and answers for the

test questions).