Key generation procedure and code for RSA Algorithm.

# Key generation procedure and code for RSA Algorithm.

1) Using any programming language of your choice implement the Key Generation procedure of the RSA algorithm

2) Specifications: The program should take two inputs, non-negative integers a, b, which will define a range within which two random prime numbers p, q will be generated by your program i.e. a <= p,q <= b). The program should select numbers randomly from the range [a,b] and test them for primality. It should continue to do this until it has found two prime numbers that are not equal.

The program should output three values 1) The public key {n, e} 2) The private key {n,d} 3) The values of p and q generated

Please note that your program MUST use the code you implemented for Ass 1 and Ass 2. It should call the Rabin-Miller algorithm implementation to generate the p and q. And it should call the Extended Euclidean Algorithm implementation to generate the d i.e. the multiplicative inverse of e mod n.

Test

1. Use your code to generate public and private keys for a = 100 and b = 300. List the output of your code, with screenshots.

2. Based on your results what is the maximum value of the integer representation of a string that can be encrypted at once?

3. What is the value of the Euler’s Totient function for your value of n.

4. Assuming A=1, B=2, —-, Z=26, work through an example to show how the word AXES will be encoded using the results above. What is the ciphertext?

5. Work through an example of how the ciphertext above will be decrypted.