What is RSA?
One of the first public-key cryptosystems, RSA is based on the mathematical difficulty of factoring large prime numbers. Named after its inventors Rivest, Shamir, and Adleman, it's still widely used for key exchange and digital signatures.
Also known as: Rivest-Shamir-Adleman
RSA was invented in 1977 and revolutionized cryptography by solving the key distribution problem. Instead of sharing a secret key, you share a public key that anyone can use to encrypt messages only you can read.
The Math Behind RSA
RSA's security relies on one simple fact: multiplying two large prime numbers is easy, but factoring their product back into primes is extremely hard.
Easy: 61 × 53 = 3233
Hard: 3233 = ? × ? (without knowing 61 and 53)
Scale this to 2048-bit numbers and factoring becomes computationally infeasible.
Key Generation
- Choose two large random primes (p and q)
- Compute n = p × q (the modulus)
- Compute φ(n) = (p-1)(q-1)
- Choose public exponent e (commonly 65537)
- Compute private exponent d (modular inverse of e)
- Public key: (n, e)
- Private key: (n, d)
Key Sizes
| Key Size | Security | Status |
|---|---|---|
| 1024-bit | ~80 bits | Deprecated |
| 2048-bit | ~112 bits | Current minimum |
| 3072-bit | ~128 bits | Recommended |
| 4096-bit | ~140 bits | High security |
Use Cases
Key Exchange
- Encrypt a symmetric key with RSA
- Use symmetric key for bulk data (hybrid encryption)
Digital Signatures
- Sign hash of document with private key
- Anyone can verify with public key
SSL/TLS Certificates
- Website identity verification
- Though ECC is increasingly preferred
RSA vs Elliptic Curve
| Aspect | RSA-3072 | ECC-256 |
|---|---|---|
| Security | 128 bits | 128 bits |
| Key Size | 3072 bits | 256 bits |
| Speed | Slower | Faster |
| Bandwidth | Higher | Lower |
ECC provides equivalent security with much smaller keys.
Quantum Threat
RSA is vulnerable to quantum computers:
- Shor's algorithm can factor large numbers efficiently
- Post-quantum cryptography research is ongoing
- Timeline uncertain but RSA may need replacement
Related Terms
Asymmetric Encryption
An encryption method using a pair of mathematically related keys: a public key for encryption and a private key for decryption. This solves the key distribution problem of symmetric encryption.
Encryption
The process of converting information into a code to prevent unauthorized access. Encryption transforms readable data (plaintext) into an unreadable format (ciphertext) using a cryptographic algorithm and key. Only those with the correct key can decrypt and read the original data.
Public Key Cryptography
A cryptographic system that uses pairs of keys: public keys (which may be disseminated widely) and private keys (which are known only to the owner). This enables secure communication between parties who have never met and forms the basis for digital signatures, key exchange, and encrypted communication.