What Is Symmetric vs Asymmetric Encryption? Examples Using OpenSSL, age, and Other Security Tools

Symmetric encryption uses one secret key; asymmetric encryption uses a public key and a private key. That is the whole split. AES, one of the most used symmetric ciphers, supports 128, 192, and 256 bit keys in the federal standard [source: NIST].

TLDR: Use symmetric encryption for files, backups, disks, and large data because it is fast. Use asymmetric encryption to share secrets safely, sign data, or prove identity. A common real use case is hybrid encryption: a 10 GB backup is encrypted with AES, while a tiny AES key is protected with RSA, X25519, or another public key method. That gives you speed and safer key sharing without trying to force slow public key crypto to do the whole job.

Here is the simple version. With symmetric encryption, the same key locks and unlocks the data. If Alice encrypts a file with a password or key, Bob needs that exact same secret to decrypt it. If anyone else gets the key, game over.

With asymmetric encryption, there are two linked keys. The public key can be shared with anyone. The private key must stay secret. If someone encrypts a message to your public key, only your private key can open it.

Symmetric encryption: fast and practical

Symmetric encryption is what you usually want for raw data. Think file archives, database dumps, disk encryption, VPN traffic, and backups. It is built for speed.

Popular symmetric algorithms include:

  • AES, especially AES 256 GCM or AES 256 CBC in older setups
  • ChaCha20 Poly1305, common in modern tools and mobile friendly systems
  • Twofish, less common now, but still seen in some older security stacks

Example with OpenSSL, using AES 256 CBC:

openssl enc -aes-256-cbc -salt -pbkdf2 -in report.pdf -out report.pdf.enc

To decrypt it:

openssl enc -d -aes-256-cbc -pbkdf2 -in report.pdf.enc -out report.pdf

The password you enter is used to derive an encryption key. The -pbkdf2 option matters because it slows down password guessing attacks. Honestly, it feels like OpenSSL still assumes you already know half of its history. Miss one flag, and you may end up with weaker defaults than you expected.

Asymmetric encryption: safer sharing

Asymmetric encryption solves the annoying key sharing problem. You do not need to send a secret password over chat, email, or a ticketing system. You share a public key instead. The private key stays with its owner.

Common asymmetric systems include:

  • RSA, old but still widely used
  • Ed25519, often used for signatures
  • X25519, often used for key exchange
  • ECC, elliptic curve cryptography, used in TLS, SSH, and many modern systems

Generate an RSA private key with OpenSSL:

openssl genpkey -algorithm RSA -out private.pem -pkeyopt rsa_keygen_bits:3072

Extract the public key:

openssl pkey -in private.pem -pubout -out public.pem

You can encrypt small data with the public key:

openssl pkeyutl -encrypt -pubin -inkey public.pem -in secret.txt -out secret.bin

And decrypt it with the private key:

openssl pkeyutl -decrypt -inkey private.pem -in secret.bin -out secret.txt

The catch is that RSA is not meant for big files. Try encrypting a large video directly and you will hit limits or painful performance. In real systems, asymmetric encryption usually protects a small random key. That key then encrypts the actual data with AES or ChaCha20.

Hybrid encryption: what most tools really use

Most secure tools use both types. This is called hybrid encryption. It is not fancy. It is just sensible.

  1. Create a random symmetric key.
  2. Encrypt the file with that symmetric key.
  3. Encrypt the symmetric key with the recipient’s public key.
  4. Store both pieces together.

This pattern powers many secure systems, including TLS, encrypted messaging, backup tools, and file sharing apps.

Using age: clean file encryption without ceremony

age is a modern file encryption tool that feels refreshingly direct. It uses small public keys, simple commands, and sane defaults. Expect to waste time with OpenSSL syntax; expect less of that with age.

Generate a key pair:

age-keygen -o key.txt

The file contains your private key and prints a public recipient key that starts with age1. Encrypt a file:

age -r age1examplepublickeyhere -o backup.tar.gz.age backup.tar.gz

Decrypt it:

age -d -i key.txt -o backup.tar.gz backup.tar.gz.age

You can also encrypt with a passphrase:

age -p -o notes.txt.age notes.txt

That makes age useful for personal files, scripts, and backups. It is not a full key management platform, but for many jobs, that is exactly the point.

Other tools you will see

  • GPG: powerful for email, signing, and file encryption, but its interface can feel like a museum exhibit with sharp edges.
  • SSH keys: mostly used for login and signatures, not bulk data encryption.
  • VeraCrypt: good for encrypted containers and full disk style workflows.
  • BitLocker and FileVault: built into Windows and macOS for disk encryption.
  • sops: popular for encrypting secrets in Git, often with age, cloud KMS, or PGP.

Which one should you use?

Use symmetric encryption when one person or one system controls the secret. Good examples are local backups, encrypted drives, and private archives.

Use asymmetric encryption when people or systems must exchange secrets without already sharing a password. Good examples are sending files to a teammate, securing a session key, verifying software signatures, and logging in with SSH.

Use hybrid encryption for almost everything serious. It gives you the speed of symmetric crypto and the safer sharing model of public key crypto. That is why tools like age feel so good for daily work. They hide the messy parts, but still use the right ideas underneath.

The main rule is simple: do not invent your own crypto scheme. Pick trusted tools. Use current algorithms. Protect private keys. Back them up safely. A strong cipher cannot save you if the key sits in a shared folder named final passwords really final.