Home

Thursday, July 16, 2015

RSA Key Generation Algorithm

Two large prime numbers are considered.

 Let them be p,q.
  • Calculate n = pq and () phi = (p-1)(q-1).
  • Select e, such that 1 < e < phi and gcd(e, phi) = 1.
  • Calculate d, the private key, such that de =1 mod phi.
  • One key is (n, e) and the other key is (n, d). The values of p, q, and phi should also be kept secret.
  • n is known as the modulus.
  • e is known as the public key.
  • d is known as the secret key.

Encryption

Sender A does the following:- 
  • Get the recipient B's public key (n, e).
  • Identify the plaintext message as a positive integer m.
  • Calculate the ciphertext c = m^e mod n.
  • Transmits the ciphertext c to receiver B.

Decryption

Recipient B does the following:-

  •  Consider his own private key (n, d) to compute the plain text m = c^d mod n.
  •  Convert the integer to plain text form.

No comments: