RSA

RSA (Rivest-Shamir-Alderman) Cryptography

Faisal Mateen
1 min readMay 1, 2021

RSA is a public-key cryptographic system first published in 1977. RSA security relies on the difficulty of factoring the product of two large prime numbers.

RSA use cases

  • TLS Authentication: Server and Client can use RSA to perform server authentication and optional client authentication.
  • An entity can sign a message with its RSA private key. Anyone with entity’s public key can run a signature verification algorithm to confirm that the message came from the entity.
  • RSA can be used to communicate symmetric keys (used for data encryption-decryption) between two parties.

RSA key generation overview

  • For a key length of k bits, Find two distinct random prime numbers p, q of roughly the same magnitude (both numbers k/2 in bit length). These two prime numbers (p,q) are kept secret.
  • Compute modulus n = p* q for both public and private keys. The modulus length (in bits) is the RSA key length. Typical RSA key lengths are 1024, 2028, and 3072 bits.
  • Compute phi(n) = (p-1)*(q-1).
  • Choose a public exponent (e) < phi(n) that is coprime to phi(n).
  • Compute private exponent (d) as the modular multiplicative inverse of e mod phi (n)

The pair (e,n) is the public key, and the pair (d, n) is the private key. See an RSA example with small prime numbers as an illustration.

--

--