Asymmetric encryption, also called public-key cryptography, uses two mathematically linked keys: a public key anyone can use to encrypt a message or verify a signature, and a private key only its owner holds to decrypt or sign. RSA, elliptic-curve cryptography and Diffie-Hellman are the main algorithms. In practice it is used to exchange a symmetric key securely and to authenticate, while fast symmetric encryption protects the bulk data, as in TLS.
Key takeaways
- A public key encrypts and a private key decrypts; the private key must never be shared.
- RSA and ECC provide encryption and signatures, while Diffie-Hellman provides key agreement.
- Real systems are hybrid: asymmetric cryptography sets up the session, symmetric cryptography encrypts the data.
Every secure website, encrypted email and signed software update relies on the same trick: two keys that are mathematically linked, one public and one private. That trick, asymmetric encryption, solved a problem that had blocked secure communication for centuries.
What is asymmetric encryption?
Asymmetric encryption uses a pair of mathematically linked keys: a public key you can share with anyone, and a private key you keep secret. Data encrypted with the public key can only be decrypted with the matching private key.
Think of the public key as a mail slot. Anyone can drop a letter through it, but only the person with the key to the box can take the letters out. The public key does not need to be secret, which is the whole point: you can publish it on your website and strangers can still send you messages only you can read.
The same pair works in reverse for signatures. Signing uses the private key, and anyone can verify the signature with the public key. That proves the message came from the holder of the private key and was not changed in transit, though it does not hide the message itself.
Asymmetric encryption was introduced publicly by Whitfield Diffie and Martin Hellman in 1976. RSA followed in 1977, described by Ron Rivest, Adi Shamir and Leonard Adleman at MIT. An equivalent system had been invented secretly at Britain's GCHQ in 1973 and was declassified in 1997.
How does asymmetric encryption work?
Each user generates a key pair, publishes the public key, and keeps the private key secret. A sender encrypts with the recipient's public key, and only the recipient's private key can reverse that operation.
The security rests on a mathematical problem that is easy in one direction and extremely hard in the other. For RSA, that problem is factoring the product of two large prime numbers. Multiplying two large primes is fast; working out which primes were multiplied, from the product alone, is not feasible at the sizes used in practice.
For elliptic-curve cryptography, the hard problem is the elliptic-curve discrete logarithm problem: given a point on a curve and a multiple of it, finding the multiplier is hard. That different hard problem is why ECC keys can be much shorter than RSA keys for the same security level.
Key generation must use a good source of randomness. A predictable key pair is no protection at all, which is why operating systems and hardware security modules provide dedicated random-number generation for this step.
Encryption itself is only half the story. In practice, asymmetric encryption is rarely used to encrypt large messages directly, because it is hundreds of times slower than symmetric encryption. Instead it protects a short symmetric key, and that key does the bulk work.
What is the difference between symmetric and asymmetric encryption?
Symmetric encryption uses one shared secret key for both encryption and decryption, while asymmetric encryption uses a key pair. Symmetric is fast; asymmetric solves the problem of sharing the key safely.
The symmetric family includes AES, the standard cipher for most data, and ChaCha20. AES keys are typically 128 or 256 bits. The catch is key distribution: if you and I want to use AES, we first need a shared secret, and sending that secret over an insecure channel defeats the purpose.
Asymmetric encryption solves distribution. I publish my public key, you encrypt the AES key with it, and only I can decrypt it. After that we both hold the same AES key and can encrypt the actual data at full speed.
That hybrid design is used almost everywhere. TLS, VPNs, encrypted messaging and file encryption all use asymmetric cryptography to set up the session and symmetric cryptography to protect the data. Neither family alone would be practical.
| Symmetric encryption | Asymmetric encryption | |
|---|---|---|
| Keys | One shared secret key | Public key plus private key |
| Typical algorithms | AES, ChaCha20 | RSA, ECC, Diffie-Hellman |
| Typical key sizes | 128-256 bits (AES) | 2,048-4,096 bits (RSA); 256 bits (ECC) |
| Speed | Fast, for bulk data | Slow, hundreds of times slower |
| Main jobs | Encrypting data at rest and in transit | Key exchange, signatures, authentication |
| Key sharing problem | Needs a secure channel first | Public key can be shared openly |
| If a key leaks | Anyone with the key reads everything | Private key loss breaks confidentiality and identity |
What is RSA?
RSA is the best-known public-key algorithm, based on the difficulty of factoring large numbers. It is used for encrypting small payloads, usually symmetric keys, and for digital signatures.
RSA was publicly described in 1977. Its security depends on key size: modern guidance treats 2,048 bits as the minimum, with 3,072-bit and 4,096-bit keys used for longer-term security. NIST maps RSA-2048 to about 112 bits of security, RSA-3072 to 128 bits, and RSA-7680 to 192 bits.
Raw RSA must never be used directly on a message. Real implementations use padding schemes such as RSA-OAEP for encryption and RSA-PSS for signatures, which protect against attacks that textbook RSA would allow. If you are choosing a library, use one that applies these by default.
RSA key exchange in TLS has been retired in TLS 1.3. The protocol now uses Diffie-Hellman based key exchange, with RSA used mainly for authentication through certificates and signatures. That change removed a whole class of attacks against static RSA keys.
What is ECC?
Elliptic-curve cryptography achieves the same security as RSA with far smaller keys, by basing its security on the elliptic-curve discrete logarithm problem. A 256-bit ECC key is comparable to a 3,072-bit RSA key.
Smaller keys mean faster operations, less bandwidth and less storage, which is why ECC is the default in modern TLS, mobile devices, smart cards and cryptocurrencies. The curves most often seen are P-256, P-384 and Curve25519, the last used by X25519 key exchange and Ed25519 signatures.
ECC is used for the same two jobs as RSA: key agreement through ECDH and signatures through ECDSA or EdDSA. The details differ, and the choice of curve matters, but the principle is the same: a private number on a curve, and a public point derived from it that cannot be reversed.
One warning applies to both RSA and ECC: implementation matters as much as the mathematics. Weak random numbers, reused signature nonces and side-channel leaks have broken real systems without breaking the underlying algorithm. Use a well-reviewed library and keep it updated.
What is Diffie-Hellman key exchange?
Diffie-Hellman is a protocol that lets two parties agree on a shared secret over a public channel, without ever sending that secret itself. Each side combines its own private value with the other side's public value to reach the same result.
The classic version uses modular arithmetic with large prime numbers; the elliptic-curve version, ECDH, does the same thing with curve points and smaller keys. In both cases, an eavesdropper who sees all the public values still cannot work out the shared secret.
Diffie-Hellman on its own does not authenticate anyone. Without authentication, an attacker can sit in the middle, agree a key with each side, and read everything. That is why TLS combines Diffie-Hellman with certificates and signatures: the key exchange provides secrecy, and the certificate proves who you are exchanging keys with.
Modern TLS uses ephemeral Diffie-Hellman, meaning a fresh key pair is generated for each session and discarded afterwards. That gives forward secrecy: if a server's long-term private key is stolen later, past sessions cannot be decrypted, because their keys no longer exist.
How does asymmetric encryption work in TLS?
In TLS 1.3, the client and server use asymmetric cryptography to authenticate the server and agree on session keys, then switch to symmetric encryption for the rest of the connection. The handshake takes one round trip.
The server presents a certificate containing its public key, signed by a certificate authority your browser trusts. The server proves it holds the matching private key by signing part of the handshake. If that signature verifies, the client knows it is talking to the real server, not an impostor.
At the same time, the two sides perform an (EC)DHE key exchange to agree on shared secrets, from which they derive the symmetric keys for the session. RFC 8446, which defines TLS 1.3, specifies this design and requires forward secrecy for all sessions.
You can see the result in your browser: the padlock means the connection is encrypted and the certificate is valid. You can inspect that certificate and the cipher suite yourself, or run our free SSL checker against any public site to see its certificate, expiry and TLS configuration.
Where is asymmetric encryption used?
It is used wherever strangers need to trust each other: websites, email, messaging, software updates, cryptocurrencies and identity systems. The public key is the anchor of trust in each case.
In email, PGP and S/MIME use public keys to encrypt messages and sign them, so only the intended recipient can read them and anyone can verify the sender. In messaging apps, the same idea protects the initial key exchange before the conversation switches to symmetric encryption.
In software distribution, developers sign updates with a private key and your device verifies them with the public key before installing. That is how your operating system knows an update really came from its vendor.
In identity, certificates bind a public key to a name, an organization or a domain. That binding is what makes TLS, code signing and document signing work. Lose control of the private key, and the binding becomes a liability, which is why certificate revocation and short lifetimes matter.
Can quantum computers break asymmetric encryption?
Yes, in theory. A sufficiently powerful quantum computer running Shor's algorithm could factor the large numbers behind RSA and solve the discrete logarithm problems behind ECC and Diffie-Hellman, breaking the security of both.
That is a future threat, not a present one: no quantum computer today can break a 2,048-bit RSA key. The danger is harvest now, decrypt later. An attacker can record encrypted traffic today and decrypt it years later, once a capable quantum computer exists, which is why long-lived secrets need attention now.
NIST responded by finalizing its first post-quantum standards on 13 August 2024. FIPS 203 specifies ML-KEM, the primary standard for general encryption and key exchange, based on CRYSTALS-Kyber. FIPS 204 specifies ML-DSA for digital signatures, based on CRYSTALS-Dilithium, and FIPS 205 specifies SLH-DSA as a hash-based backup signature scheme.
NIST encourages administrators to start integrating these standards now, because full migration takes time. Many deployments will use hybrid cryptography, combining a classical algorithm with a post-quantum one, so the connection stays secure even if one of them fails. For more on how standards bodies define access and trust, NIST SP 800-162 remains the reference for attribute-based access control, a model that decides access from attributes rather than a fixed list.
Symmetric encryption is less affected: doubling an AES key size, from 128 to 256 bits, is generally considered enough to resist quantum attacks. The urgent work is replacing public-key cryptography, not AES.
What are the common mistakes with asymmetric encryption?
The most common mistakes are not mathematical. They are key management failures: private keys left in code, weak key sizes, expired certificates and missing authentication on key exchange.
Never share or email a private key, and never commit one to a code repository. Store private keys in a hardware security module or a managed key store where possible, and rotate them on a schedule. If a private key may have leaked, revoke and replace it immediately.
Use modern key sizes and algorithms. RSA below 2,048 bits, ECC on weak curves, and unauthenticated Diffie-Hellman are all known to be unsafe. Use a maintained library, keep it patched, and let it choose safe defaults rather than configuring cryptography by hand.
Check certificate expiry. An expired certificate breaks trust just as surely as a forged one, and it is one of the most common causes of outages. Monitor expiry dates with a tool, and automate renewal where you can. Our guide to spear phishing explains the other side of trust: how attackers exploit the human who holds the keys.
The bottom line
Asymmetric encryption lets strangers agree on secrets and prove who they are, without ever meeting or sharing a password first. RSA and ECC provide the keys, Diffie-Hellman provides the agreement, and symmetric encryption does the heavy lifting.
Protect your private keys, use modern sizes and libraries, and start planning for post-quantum standards. The mathematics will change, but the principle will not: the private key is the secret, and everything else follows from keeping it safe. Test your own site's TLS setup with the free SSL checker.
Frequently asked questions
What is asymmetric encryption in simple terms?
It is encryption with two keys instead of one. Anyone can use your public key to lock a message for you, but only your private key can unlock it. That lets strangers send you secrets without first sharing a password.
What is the difference between symmetric and asymmetric encryption?
Symmetric encryption uses one shared secret key for both locking and unlocking, so it is fast but needs a safe way to share the key. Asymmetric encryption uses a key pair, so it solves key sharing but is much slower, which is why systems combine the two.
What are RSA and ECC?
RSA is a public-key algorithm based on how hard it is to factor large numbers, typically used with 2,048-bit or larger keys. ECC is based on elliptic curves and gives similar security with much smaller keys, for example a 256-bit ECC key is comparable to a 3,072-bit RSA key.
Is asymmetric encryption used in HTTPS?
Yes. When you visit an HTTPS site, asymmetric cryptography authenticates the server and helps agree on a session key. The page itself is then encrypted with fast symmetric encryption under that session key.
Can quantum computers break asymmetric encryption?
A sufficiently powerful quantum computer running Shor's algorithm could break RSA and ECC. That is why NIST finalized post-quantum standards in August 2024, including ML-KEM for key exchange and ML-DSA for signatures.
What happens if a private key is stolen?
Anyone with the private key can decrypt messages sent to that key and impersonate its owner in signatures. The key must be revoked, replaced, and any certificates based on it reissued.
Is Diffie-Hellman encryption?
No. Diffie-Hellman is a key-agreement protocol, not a way to encrypt messages directly. Two parties use it to agree on a shared secret over a public channel, then use that secret as a symmetric key.
Sources
- NIST — NIST Releases First 3 Finalized Post-Quantum Encryption Standards
- IETF — RFC 8446: The Transport Layer Security (TLS) Protocol Version 1.3
- G+D — Asymmetric encryption (public key cryptography) explained
- Cloudflare — NIST's first post-quantum standards
- NIST CSRC — Guide to Attribute Based Access Control (ABAC), SP 800-162
The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.
Checked against NIST's post-quantum standards announcement, RFC 8446 (TLS 1.3) and NIST SP 800-162.
How we write and fact-check →