INCS741 New York Institute RSA Implementation Using OpenSSL Project

User Generated

fevavinfwrfgnav

Programming

INCS741

New York Institute of Technology

Description

I am given an assignment on RSA Implementation using OpenSSL. Need to submit a detailed report with appropriate solutions as asked in the file attached.

Unformatted Attachment Preview

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).
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

Hello, here's the complete fileSorry for delay though

Openssl cryptographic library implement the RSA public key encryption
Scheme
Program to generate prime numbers p, and q, calculating the
values of n, e and private key d. The value of e should be chosen randomly.
import pyasn1.codec.der.encoder
import pyasn1.type.univ
def pempriv(n, e, d, p, q, dP, dQ, qInv):
template = '-----BEGIN RSA PRIVATE KEY-----\n{}-----END RSA PRIVATE KEY----\n'
seq = pyasn1.type.univ.Sequence()
for x in [0, n, e, d, p, q, dP, dQ, qInv]:
seq.setComponentByPosition(len(seq), pyasn1.type.univ.Integer(x))
der = pyasn1.codec.der.encoder.encode(seq)
return template.format(base64.encodestring(der).decode('ascii'))=
n = p * q
phi = (p -1)*(q-1)
d = modinv(e, phi)
dp = modinv(e,(p-1))
dq = modinv(e,(q-1))
qi = modinv(q,p)
key = pempriv(n, e, d, p, q, dp, dq, qi)
f = open(output_file,"w")
f.write(key)
f.close()

Program
#include
#ifdef OPENSSL_NO_RSA
NON_EMPTY_TRANSLATION_UNIT
#else
# include
# include
# include
# include
# include "apps.h"
# include "progs.h"
# include
# include
# include

Your Last Name 2
# include
# include
# include
# include
typedef enum OPTION_choice {
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
OPT_INFORM, OPT_OUTFORM, OPT_ENGINE, OPT_IN, OPT_OUT,
OPT_PUBIN, OPT_PUBOUT, OPT_PASSOUT, OPT_PASSIN,
OPT_RSAPUBKEY_IN, OPT_RSAPUBKEY_OUT,
/* Do not change the order here; see case statements below */
OPT_PVK_NONE, OPT_PVK_WEAK, OPT_PVK_STRONG,
OPT_NOOUT, OPT_TEXT, OPT_MODULUS, OPT_CHECK, OPT_CIPHER
} OPTION_CHOICE;
const OPTIONS rsa_o...


Anonymous
Excellent resource! Really helped me get the gist of things.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4
Similar Content
Related Tags