Question: c++ code to encrypt and decrpyt message using technique given below: The RSA Cryptosystem Beforehand The receiver creates a public key and a secret key
c++ code to encrypt and decrpyt message using technique given below:
The RSA Cryptosystem Beforehand The receiver creates a public key and a secret key as follows.
1. Generate two distinct primes, p and q . Since they can be used to generate the secret key, they must be kept hidden.
2. Let n = pq
3. Select an integer e such that gcd(e,( p -1)(q -1)) =1 . The public key is the pair (e,n) . This should be distributed widely.
4. Compute d such that de congrence()=1(mod (p -1)(q -1)) . This can be done using the Pulverizer. The secret key is the pair (d,n) . This should be kept hidden! Encoding: Given a message m , the sender first checks that gcd(m,n) =1 . The sender then encrypts message m to produce m'using the public key: m'=rem(me ,n) Decoding: The receiver decrypts message m back to message m using the secret key: m rem(m' )d ,n)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
