In: Computer Science
Given two prime numbers 17 and 19. Compute the encryption and the decryption keys using RSA algorithm.
In RSA we have Two prime Number i.e. p and q
Steps to get Keys
1. Compute n=pq and ϕ=(p−1)(q−1)
2.Choose an integer e, 1<e<ϕ such that gcd(e,ϕ)=1
3. Compute the secret exponent d, 1<d<ϕ, such that e*d ≡ 1 mod ϕ
Now We have Two keys in RSA
1. Encryption Key i.e. e that we find in Step 2
2. Decryption Key i,e. d that we find in Step 3
Process followed by RSA
Sender send set of ( n ,e ) which the the Public key along with the encrypted data and when receiver gets the data then it used n and e to get the private key d and use that key to decrypt the message .
Now lets calculate keys using given prime number
p = 17 , q=19
n=pq = 17 * 19 = 323
ϕ=(p−1)(q−1) = 16 * 18 = 288
Now We get e as
gcd(e, 288 )=1
They are many possible so but we have to take any less than 288 .
So lets we have 215
Encryption Key = 215
Now Lets find the decryption key
e*d ≡ 1 mod ϕ
Now e = 151
215 * d mod 288 = 1
We have to find modular inverse to get d
Hence we get d = 71
Hence we get Two keys as 215 and 71
Note : Answer may be differ and we have many options to choose the encryption key i.e. e but for every e , d is fixed and unique,
So if u choose any other encryption key then follow the same process to get d by using modular inverse
Thank You
If u like the answer do Upvote it and have any doubt ask in comment