Beginner Topic 16 of 51 Security & Cryptography
RSA
Public-key system based on factoring large numbers.
How it works
RSA is a public-key algorithm based on the difficulty of factoring a product of two large primes. A key pair is generated from primes p and q with modulus n equal to p times q, a public exponent e and a private exponent d such that encrypting is m to the e mod n and decrypting is c to the d mod n. Keys are typically 2048 to 4096 bits, and real use needs padding schemes like OAEP for encryption and PSS for signatures.
Step-by-step walkthrough
- Choose two large primes and multiply them to get n.
- Publish n and e, keep d secret.
- Encrypt a message as m to the power e modulo n.
- Decrypt with c to the power d modulo n.
- Security depends on the difficulty of factoring n.
Where it is used
TLS certificates, code and document signing, SSH keys and encrypted key exchange have used RSA for decades, although elliptic curves are increasingly preferred.
Common pitfall
Textbook RSA without padding is insecure and malleable. Small exponents, shared primes from poor randomness and short keys have led to real breaks. RSA is slow and limited in message size, so use it to encrypt symmetric keys. Side-channel leakage during private-key operations is a risk. Prefer vetted libraries and migrate to stronger or post-quantum schemes over time.
Where it fits in the course
RSA is topic 16 of 51 in Security & Cryptography, rated Beginner. It follows Asymmetric Encryption. The next topic is Hash Functions.
Practice and explore
- Open the interactive lesson, with a mini quiz.
- Take the Security & Cryptography quiz.
How to study this topic
- Read the explanation above and restate the definition in your own words.
- Open the interactive lesson and answer its mini quiz.
- Read the common pitfall, then write a short example that avoids it.
- Check your understanding in the Security & Cryptography quiz, and revisit the topic if you miss a question.
Frequently asked questions
What is RSA?
Where do people use RSA?
What is the most common mistake with RSA?
What should I learn before this topic?
How can I practice it?
Is RSA hard to learn?
How long does it take to learn RSA?
Which topics are related to RSA?
What should I study after RSA?
Related topics
- Asymmetric Encryption (Security & Cryptography)
- Hash Functions (Security & Cryptography)
- AES (Security & Cryptography)
- SHA Family (Security & Cryptography)