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.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response