Suppose your RSA Public-key factors are p =6323 and q = 2833, and the public exponent e is 31. Suppose you were sent the Ciphertext 6627708. Write a program that takes the above parameters as input and implements the RSA decryption function to recover the plaintext.
IN PYTHON
Answer : Given data
* For enormous estimations of P and Q , the program can be moderate.
from decimal import Decimal
p = int(input('Enter the estimation of p : '))
q = int(input('Enter the estimation of q : '))
e = int(input('Enter public example e : '))
ct = int(input('Enter the estimation of ciphertext : '))
n = p*q
t = (p-1)*(q-1)
I = 1
while(1):
x = 1 + i*t
if x % e == 0:
d = int(x/e)
break
I += 1
def decrypt(ct, d, n):
dtt = Decimal(0)
dtt = pow(ct,d)
dt = dtt % n
return dt
print('Decrypted plaintext : ', decrypt(ct, d, n))
__________THE END______________
Get Answers For Free
Most questions answered within 1 hours.