What Is RSA Encryption?

Run a Speed Test

For decades, RSA was the algorithm that made secure communication on an open network possible. It solved a problem that had seemed almost paradoxical: how can two people who have never met agree to keep a secret, while everything they say to each other is public? RSA's answer — a pair of keys where one can lock what only the other can unlock — reshaped cryptography, and it still underpins a great deal of how the internet establishes trust today.

Two Keys Instead of One

RSA is an asymmetric algorithm, the kind explained in symmetric vs asymmetric encryption. Unlike AES, which uses one shared key, RSA uses a matched pair: a public key and a private key, mathematically linked so that what one does, only the other can undo.

  • The public key is meant to be shared freely. Anyone can use it.
  • The private key is kept secret by its owner and never shared.

This split is what makes the paradox dissolve. You can publish your public key to the entire world; a stranger can use it to encrypt a message that only your private key can decrypt. No secret ever had to be exchanged in advance. That single property is the foundation of public key infrastructure and most online trust.

The Trapdoor: Easy One Way, Hard the Other

RSA's security rests on a piece of mathematics called a trapdoor function — something easy to compute in one direction but effectively impossible to reverse without a secret. For RSA, that trapdoor is the multiplication of large prime numbers:

  • Multiplying two enormous prime numbers together is fast and easy.
  • Taking the result and factoring it back into the two primes is, for large enough numbers, computationally hopeless — even for the fastest computers.

When an RSA key is generated, two very large primes are chosen and multiplied. That product becomes part of the public key; the private key is derived from the original primes. Anyone can encrypt using the public product, but reversing the operation requires knowing the primes — and the only way to find them from the public key is to factor that gigantic number, which is precisely the thing nobody can do in any reasonable time. The "trapdoor" is knowing the primes; with them the reverse trip is easy, without them it is impassable.

Encrypting vs Signing: Same Keys, Opposite Directions

One of the most useful things about an RSA key pair is that it works in both directions, and the direction you use it determines what you get. This is the crux that confuses many people, so it is worth a table:

GoalSender usesRecipient/verifier usesProvides
EncryptionRecipient's public keyTheir own private key to decryptConfidentiality — only the recipient can read it
SigningTheir own private keySender's public key to verifyAuthenticity & integrity — proof of who sent it

For secrecy, you encrypt with the recipient's public key so that only their private key can open it. For proof of origin, you do the reverse: you "sign" with your own private key, and anyone can verify with your public key that it really came from you and was not altered. Signing does not hide the message — it vouches for it. This second use is the basis of digital signatures and is how the certificates in a certificate chain are validated.

Why RSA Is Slow — and What That Means in Practice

RSA does arithmetic on numbers thousands of bits long, which is vastly more expensive than the byte-shuffling of a symmetric cipher. Encrypting a large file directly with RSA would be painfully slow. So in the real world RSA is almost never used to encrypt bulk data. Instead it does one small, high-value job: it protects a symmetric key. The classic pattern — historically used in TLS — was for the client to generate an AES key, encrypt that small key with the server's RSA public key, and send it over; from then on, fast AES handled the actual data. This hybrid approach gives you the convenience of public-key cryptography with the speed of symmetric encryption, and it is the model nearly all secure protocols follow.

Key Sizes, and RSA's Gradual Handover

RSA is secure only with large keys. A 2048-bit key is the common minimum today, with 3072 or 4096 bits used where a longer safety margin is wanted; older 1024-bit keys are now considered too weak. But key size is also RSA's growing burden — to stay ahead of improving factoring techniques, RSA keys must keep getting bigger, and bigger keys are slower still.

This is why much of the industry has shifted toward elliptic curve cryptography, which delivers equivalent security with dramatically smaller keys and better performance — and why TLS 1.3 moved away from RSA key exchange in favour of ephemeral elliptic-curve Diffie-Hellman. RSA is still widely used, especially for certificate signatures, and it is far from broken. But it is increasingly the older, heavier option, and a further cloud sits on the horizon: a sufficiently powerful quantum computer could factor large numbers efficiently, which would break RSA outright and is spurring the development of post-quantum replacements. For now, RSA remains a workhorse — just one that is slowly, deliberately being handed the lighter loads.

Frequently Asked Questions

What is RSA encryption?

An asymmetric, public-key algorithm using a pair of linked keys: a public key anyone can use to encrypt or verify, and a secret private key that decrypts or signs. Its security rests on the fact that multiplying two large primes is easy but factoring the result back is practically impossible.

How does RSA work?

It generates a key pair from two very large primes. The primes are multiplied to form part of the public key, and the private key derives from the primes. Anyone can encrypt with the public key, but only the private-key holder can reverse it, since that requires the original primes — unrecoverable without factoring an enormous number.

What is the difference between RSA encryption and RSA signing?

For encryption, the sender uses the recipient's public key so only their private key can decrypt — confidentiality. For signing, the sender uses their own private key and anyone verifies with the sender's public key — authenticity and integrity, not secrecy. Same key pair, opposite directions.

Why is RSA slow?

It performs arithmetic on very large numbers, far costlier than a symmetric cipher's bit operations. So RSA rarely encrypts bulk data; instead it encrypts or establishes a small symmetric key, and a fast cipher like AES encrypts the data — the hybrid model used in TLS.

Is RSA still secure?

Yes, with large enough keys (2048 bits or more) and proper padding. But elliptic curve cryptography offers the same security with smaller, faster keys, so newer systems prefer it. RSA is also vulnerable to future quantum computers, driving interest in post-quantum algorithms.

Related Guides

More From This Section