System design concepts · Security

Symmetric vs Asymmetric Encryption

Short answer

Symmetric encryption uses one secret key for both encryption and decryption, so both sides must already share that key; AES is the standard example, and it is fast enough to protect bulk data. Asymmetric encryption uses a key pair: a public key that anyone may have and a private key that only its owner keeps, as in RSA and elliptic-curve schemes. Asymmetric cryptography solves the problem of agreeing on a key with someone you have never met, and it makes digital signatures possible, but it is far slower and works on small inputs. Real systems combine the two. TLS uses asymmetric cryptography to authenticate the server and agree on a fresh session key, then encrypts all the traffic with fast symmetric encryption under that key.

Read the video transcript

Every HTTPS request you make uses two kinds of encryption. Here is why it needs both. Symmetric encryption uses one secret key. The same key locks the data and unlocks it. Ciphers like AES are fast enough to encrypt everything you send. The catch is getting that key to the other side. Send it across the network, and anyone listening has it too.

Asymmetric cryptography uses a key pair. The public key can go to anyone. Data locked with it only opens with the private key, which never leaves its owner. That solves key distribution. But it is far slower, and it only works on small inputs. Much too slow for the actual traffic.

So TLS uses both. In the handshake, the client and the server swap public key shares, and each one derives the same fresh session key. The server also signs the exchange, to prove who it is. From then on, every byte is encrypted with that symmetric key. Asymmetric to agree on a key and prove identity. Symmetric for the data.

Symmetric vs Asymmetric Encryption: comparison table

AspectSymmetric encryptionAsymmetric encryption
KeysOne shared secretA public key and a private key
SpeedFast, with hardware support on modern CPUsMuch slower per operation
Key distributionHard: the secret must reach both sides safely firstEasy: the public key can be published
Common algorithmsAES-GCM, ChaCha20-Poly1305RSA, elliptic-curve Diffie-Hellman (X25519), ECDSA and Ed25519 for signatures
What it providesConfidentiality, plus integrity with authenticated modesKey agreement, encryption of small payloads, digital signatures
Key size for similar strength128 or 256 bitsThousands of bits for RSA; around 256 bits for elliptic curves
Typical usesBulk TLS traffic, disk and database encryption, backupsTLS handshakes, SSH keys, code signing, JWTs signed with RS256 or ES256
One shared key encrypts on one side and decrypts on the other, so AES can protect every byte as long as both sides already hold it.

When to use each

Use symmetric encryption for

  • Encrypting data itself: files, database fields, backups, network traffic after a handshake.
  • Anything high volume where speed matters.
  • Cases where one party, or a key service, controls both ends.

Use asymmetric cryptography for

  • Agreeing on a symmetric key with a party you have no shared secret with.
  • Proving who signed something: certificates, software releases, tokens.
  • Letting many parties verify without being able to forge, such as services checking a token signed by the identity provider.
The verdict

Use symmetric encryption for

Encrypting data itself: files, database fields, backups, network traffic after a handshake.

Otherwise

Use asymmetric cryptography for

Agreeing on a symmetric key with a party you have no shared secret with.

Envelope encryption

Encrypting large data directly with a master key held in a key management service would be slow and would send all the data to that service. Envelope encryption avoids both. Each object is encrypted locally with its own random data key using symmetric encryption, and only the small data key is encrypted by the master key in the KMS. The encrypted data key is stored next to the ciphertext.

A random data key encrypts the object locally, and the KMS master key wraps only that small data key, which is stored next to the ciphertext.

Rotating the master key then means re-wrapping small data keys, not re-encrypting every object, and access to the master key can be audited and revoked centrally.

Signing tokens: shared secret or key pair

A JWT signed with HS256 uses a shared secret, so every service that verifies tokens could also mint them. With RS256 or ES256 the identity provider signs with a private key and services verify with the public key, so a compromised service cannot forge tokens. That is the same symmetric versus asymmetric trade-off applied to authentication instead of secrecy.

The identity provider signs tokens with its private key, services verify them with the public key, and an edited token fails because a public key cannot sign.

Hashing is a separate tool. A hash such as SHA-256 is one way and has no key to decrypt with. Passwords are stored with slow, salted password hashing functions such as bcrypt, scrypt or Argon2, not with encryption.

Interview angle

How it comes up in a system design interview

System design rounds rarely ask for the definitions directly. The topic appears when you cover security for payments, identity, file storage or messaging, and the interviewer wants to see that you know where each kind of key lives and who can read what.

Where you will meet it

  • How is card data protected at rest, and who holds the keys?
  • Services need to verify login tokens. Should they share a secret with the identity provider or use its public key?
  • How would end-to-end encrypted messaging work, so the server cannot read message content?
  • How do you rotate an encryption key without re-encrypting petabytes of stored files?
How a strong answer sounds
“Traffic is TLS everywhere, including between services. At rest, each file is encrypted with its own data key using AES-GCM, and the data keys are wrapped by a master key in the KMS, so rotating the master key only re-wraps small keys. Login tokens are signed with the identity provider's private key, so services verify them with the public key and cannot mint their own.”

Common mistakes

  • Saying asymmetric encryption is more secure. Each is secure for its job at the right key size; they solve different problems.
  • Calling hashing encryption. A hash has no key and cannot be decrypted.
  • Proposing RSA to encrypt large files directly instead of a hybrid scheme.

Frequently asked questions

Does HTTPS use symmetric or asymmetric encryption?

Both. The TLS handshake uses asymmetric cryptography to authenticate the server with its certificate and to agree on session keys. The data that follows is encrypted with symmetric ciphers such as AES-GCM or ChaCha20-Poly1305.

Is RSA symmetric or asymmetric?

Asymmetric. RSA uses a public key and a private key and is used for signatures and, in older protocols, for encrypting a session key.

Why not use asymmetric encryption for everything?

It is much slower and can only process inputs smaller than its key, so encrypting bulk data with it would be impractical. Systems use it to set up or protect a symmetric key and let symmetric encryption do the heavy work.

Which is more secure?

Neither is more secure in general. Security depends on the algorithm, key size, how keys are stored and whether the mode of operation is used correctly.

Learn and practise

Lessons

Problems where this choice matters

Knowing the trade-off is half of it

Practise saying it under follow-up questions: a timed system design interview with an AI interviewer that probes your choices and grades against a rubric.

Start a mock interview