Question: 5 Task Five. RSA Encryption implementation (2 marks) In this task, you are going to implement the RSA encryption using C++ or Java. Below are

5 Task Five. RSA Encryption implementation (2 marks) In this task, you are going to implement the RSA encryption using C++ or Java. Below are compo- nents that need to be implemented. 1. KeyGen: The RSA key generations function. (1 mark) 2. Encrypt: The RSA encryption function. (0.5 mark) 3. Decrypt: The RSA decryption function. (0.5 mark) The key generation function (KeyGen) should take the bit-length (up to 32) of p and q as input, and output the public key (N, e) and the corresponding private key (N, P,9, d) into two separate files pk.txt and sk.txt respectively, where p,q are distinct primer numbers, N =p*q (i.e., N is up to 64 bits), d*e = 1mod((p-1)*(q-1)). 3 The Encryption function (Encrypt) should take the public key from pk.txt and a message M (a positive integer smaller than N) from a file mssg.txt as input, and output the corresponding ciphertext c= Md (mod N) into another file cipher.txt. The Decryption function (Decrypt) should take the private key from sk.txt and the ciphertext from cipher.txt and output the message M on the screen (terminal). When your program is executed, a menu with these three functions should be displayed and a user can choose to invoke any of these functions for multiple times. Important: the key generation function should be probabilistic. That is, the output of the key generation function should be different even if the same bit-length for p and q is chosen
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
