01 / 20

Symmetric vs.
Asymmetric Encryption

Understand the two fundamental approaches to encrypting data: one key shared, or a key pair split between public and private.

Cyber Security

What Is Encryption?

Encryption is the process of converting plaintext (readable data) into ciphertext (scrambled data) using a mathematical algorithm and a key. Only someone with the correct key can reverse the process and recover the original message.

Core Terminology

Plaintext
The original, readable data before encryption is applied.
Ciphertext
The scrambled, unreadable output after encryption transforms the plaintext.
Key
A secret value used by the algorithm to encrypt and/or decrypt data.

Why Does It Matter?

1
Confidentiality: prevents unauthorized parties from reading sensitive data like passwords, financial records, and personal messages.
2
Integrity: ensures data has not been tampered with during transmission.
3
Authentication: verifies the identity of the sender, proving the message genuinely came from them.
4
Non-repudiation: prevents the sender from denying they sent the message (especially with asymmetric encryption).

Symmetric Encryption

Alice ENCRYPT Plaintext → Ciphertext Key K Ciphertext DECRYPT Ciphertext → Plaintext Key K Same Key Bob Sender Receiver Key Distribution Problem: How do Alice and Bob securely share Key K?

Symmetric Algorithms

AES
Advanced Encryption Standard. The modern gold standard: 128, 192, or 256-bit keys. Used everywhere from HTTPS to disk encryption.
3DES
Triple DES. Applies the older DES algorithm three times. Slower than AES and being phased out, but still found in legacy systems.
ChaCha20
A modern stream cipher. Extremely fast in software, favored on mobile devices and in TLS 1.3 connections.

Asymmetric Encryption

Alice Sender ENCRYPT Plaintext → Ciphertext Bob's Public Key Ciphertext DECRYPT Ciphertext → Plaintext Bob's Private Key Bob Receiver Different Keys Public key encrypts. Only the matching private key decrypts. No need to share any secret over the network.

Asymmetric Algorithms

RSA
Based on the difficulty of factoring the product of two large primes: \( n = p \times q \). Key sizes of 2048+ bits. Widely used in TLS and digital signatures.
ECC
Elliptic Curve Cryptography. Achieves equivalent security to RSA with much smaller keys (256-bit ECC ≈ 3072-bit RSA). Ideal for mobile devices.
Diffie-Hellman
A key exchange protocol. Two parties can agree on a shared secret over an insecure channel without ever transmitting it directly.

The Key Distinction

Symmetric
One shared secret key for both encryption and decryption. Fast, but you must solve the key distribution problem: how do you safely share the key?
Asymmetric
A key pair: public + private. No need to share secrets. Slower, but solves key distribution. Also enables digital signatures and identity verification.

Hybrid Encryption

Step 1: Key Exchange Alice encrypts a random session key with Bob's public key (asymmetric) Slow, but only once Step 2: Data Transfer Both parties now share the session key. All data encrypted symmetrically Fast, for all remaining data Best of Both Worlds Asymmetric solves key distribution Symmetric provides fast bulk encryption This is how HTTPS works.

How to Choose

1
Identify the goal. Are you encrypting bulk data (files, disk, database) or exchanging keys / verifying identity?
2
Consider the parties. Can both sides share a secret key in advance (e.g., same organization)? If not, asymmetric is needed first.
3
Evaluate performance. Symmetric is orders of magnitude faster. For large data, always prefer symmetric after key exchange.
4
Check for signatures. Need to prove who sent a message? Only asymmetric (private key signing) provides non-repudiation.
5
Use hybrid when possible. Most real-world systems (TLS, PGP, Signal) combine both for security and speed.

Example: File Encryption

You want to encrypt a 2 GB video file stored on your laptop. No one else needs to decrypt it: only you.

video.mp4 2 GB plaintext AES-256 Symmetric Encryption Your password → Key video.enc 2 GB ciphertext

Example: Secure Email

Alice needs to send a confidential email to Bob. They have never met and cannot exchange a secret key in person.

Alice 1. Gets Bob's public key Bob's Pub Key 2. Encrypts email Encrypted Email using Bob's public key 3. Send over internet Bob receives ciphertext decrypts w/ private key 4. Decrypts with private key Plaintext

Example: HTTPS in Action

When you visit a website over HTTPS, your browser and the server perform a TLS handshake that combines both types of encryption:

1
Browser contacts server. The server sends its public key (inside a certificate signed by a trusted authority).
2
Key exchange. Browser and server use asymmetric encryption (or Diffie-Hellman) to agree on a shared session key.
3
Data transfer. All subsequent traffic is encrypted with the session key using fast symmetric encryption (AES or ChaCha20).
4
Session ends. The session key is discarded. A new key is generated for the next session (forward secrecy).

Common Mistakes

✕ Confusing Public and Private
The public key is shared openly. The private key is never shared. Leaking a private key compromises all security.
✕ "Asymmetric Is Always Better"
Asymmetric is much slower. For encrypting large files, symmetric is the correct choice. Real systems use both together.
✕ Reusing Keys Indefinitely
Session keys should be temporary. Reusing the same key for months increases the damage if it is compromised (no forward secrecy).

Side-by-Side Comparison

Symmetric Asymmetric
Keys 1 shared secret key 2 keys (public + private)
Speed Very fast 100-1000x slower
Key Size 128 - 256 bits 2048 - 4096 bits (RSA)
Key Distribution Problem: must share securely Solved: public key is open
Use Cases Bulk data encryption, disk encryption, VPN tunnels Key exchange, digital signatures, email encryption
Algorithms AES, ChaCha20, 3DES RSA, ECC, Diffie-Hellman
Non-repudiation No Yes (via digital signatures)

Question 1 of 5

In symmetric encryption, how many keys are used to both encrypt and decrypt data?

Question 2 of 5

Which of the following is the primary advantage of asymmetric encryption over symmetric encryption?

Question 3 of 5

In a TLS/HTTPS handshake, which combination of encryption types is used?

Question 4 of 5

Alice wants to send Bob an encrypted message. She uses Bob's public key to encrypt. Who can decrypt it?

Question 5 of 5

You need to encrypt a 50 GB database backup stored locally. No one else will access it. Which approach is most appropriate?