Skip to content
uencoder

RSA

RSA is the asymmetric encryption algorithm published by Rivest, Shamir, and Adleman in 1977, based on the hardness of factoring large integers, used for encryption and digital signatures.

Purpose

It realizes asymmetric encryption and digital signatures, letting two parties communicate securely and authenticate without pre-shared keys.

Mechanism

Key generation: pick primes p and q, set n = pq and φ = (p-1)(q-1), choose e coprime to φ, and set d = e^{-1} mod φ. Encryption: c = m^e mod n; decryption: m = c^d mod n. Security rests on the difficulty of factoring n.

Use cases

  • TLS certificate key exchange and signatures
  • SSH public-key authentication
  • PGP/GPG keys
  • Code-signing certificates

Examples

  • Input
    n=3233, e=17, m=65
    Output
    c=2790

    Encrypting 65 → 2790

Common errors

Using keys that are too short (<2048 bits)
Use at least 2048 bits; 3072 or 4096 recommended

Related terms

Related tools

References