October 28, 2025
Modern Encryption Works

How Modern Encryption Works & the Shift to Post-Quantum Safety

Cryptography might not be glamorous, but it’s the quiet guard holding together the Internet’s infrastructure. Every time you log in, send a message or pay someone online, cryptography is at work behind the scenes — and we barely ever see it. It’s what keeps communications private and prevents chaos.

This article peels back the curtain on how encryption actually works. We’ll explore the foundations of modern cryptography — first the symmetric world of the AES standard, then the asymmetric realm of RSA public-key systems, and finally gaze at the emerging era of post-quantum cryptography that’s beginning to replace them.


Cryptography 101: The Basic Building Blocks

At its core, cryptography is a toolkit of mathematical and algorithmic building blocks that work together to protect data.

Symmetric encryption uses the same secret key both to encrypt and decrypt data. It’s fast and efficient, making it ideal for bulk data encryption once a secure channel has been established.

Asymmetric encryption, meanwhile, uses a pair of keys: one public, one private. You share the public key freely; you guard the private key. That allows you to do things like verify signatures or safely exchange session keys.

But there’s more:

  • AEAD (Authenticated Encryption with Associated Data) schemes combine encryption and integrity checking in one step (for example, AES-GCM).

  • KDFs (Key Derivation Functions) such as HKDF take a shared secret and derive fresh, session-specific keys so you aren’t re-using the same key forever.

  • MACs (Message Authentication Codes) or HMACs (Hash-based MACs) check that the data hasn’t been tampered with — though if you’re using a proper AEAD cipher you often don’t need a separate MAC.

In real systems like the TLS (Transport Layer Security) protocol, these pieces are chained together: Two computers exchange public keys (for example using X25519 or a post-quantum equivalent), derive a shared secret, run it through a KDF, generate fresh session keys, and then use a symmetric AEAD cipher like AES-GCM to encrypt everything else. You never see those details, but they form the machinery keeping your browsing, banking and messaging secure.


Symmetric Encryption: AES

The Advanced Encryption Standard (AES) is the workhorse of contemporary data secrecy. It splits data into 128-bit blocks, then scrambles those blocks through a series of mathematical transformations (rounds) using a key of length 128, 192 or 256 bits.

If you’re picking an AES mode today:

  • Go with AES-GCM. It’s supported widely, it performs well, and it gives you both confidentiality and integrity in one go.

  • Make sure you manage the nonce (initialization vector) properly. With GCM you need a unique 96-bit nonce for every encryption. If you reuse a nonce with the same key, you risk catastrophic failure.

  • If nonce-management is too error-prone, consider AES-SIV (Synthetic IV) which is safer in some misuse scenarios — albeit slower.

  • For drive encryption or large-scale full-disk cases, there’s AES-XTS, which is designed for that workload.

  • If you want to prepare for whatever the future brings, use a 256-bit key length. While symmetric ciphers like AES are relatively safe even in a quantum era (since doubling key length offsets Grover’s algorithm’s square-root speedup), going 256-bit gives you plenty of margin.


Asymmetric Encryption: RSA

RSA has been the long-trusted veteran of public-key cryptography. It uses the difficulty of factoring large numbers (or more precisely, the integer-factorisation problem) as its security basis. One key is public (for encrypting or signature verification) and the other is private (for decrypting or signing). Because it is relatively slow, RSA is generally used to protect small pieces of data — for example session keys or digital signatures — rather than bulk files.

Here are a few implementation tips:

  • Use modern padding schemes: OAEP for encryption and PSS for signatures. Using outdated padding is a common vulnerability.

  • Use sufficiently large key sizes. Keys of 3072 bits or more are recommended for current safety.

  • Protect your private keys carefully — reuse, mis-protection or key leakage are the real problems, not the maths.

  • Understand that RSA is being phased out for very long-term secrecy because quantum computers (running Shor’s algorithm) could someday break factoring-based systems efficiently, rendering older RSA systems unsafe in that scenario.


Key Exchange & Padding Oracles

One crucial part of secure communication is agreeing on a shared secret without sending that secret in the clear. That’s what “key exchange” protocols do.

  • The classic version is the Diffie‑Hellman key exchange. The modern, efficient elliptic-curve variant is X25519. Each party has a private key, they exchange a public key and both compute the same shared secret.

  • Another method is RSA key transport: you encrypt a randomly generated session key with the recipient’s public key; once the recipient decrypts, both sides share that session key.

What about “padding oracle” attacks? These occur when an encryption scheme responds differently depending on padding validity. For example, in older block-cipher modes like PKCS#7, if the padding is wrong the system might respond “padding failed” versus “MAC failed”, giving attackers a side channel they can exploit to gradually recover plaintext. Modern AEAD ciphers (AES-GCM, AES-SIV) and authenticated key exchanges simply reject the message without revealing which part failed — preventing those oracles.


Post-Quantum Cryptography (PQC)

We are now entering a new era: cryptography must be ready for the possibility of quantum computers that can break many of our current public-key algorithms. That’s where post-quantum cryptography (PQC) comes in.

What is PQC?

PQC refers to encryption schemes designed to be secure against both classical and quantum adversaries. The problem: Many public-key schemes (RSA, ECC) rely on mathematical problems that a large enough quantum computer could solve using Shor’s algorithm. Meanwhile, symmetric ciphers like AES are less vulnerable: Grover’s algorithm gives only a square-root speed-up, so doubling key size largely offsets the risk.

Why does it matter now?

Because some of today’s encrypted data will still need to be safe many years from now. If an adversary “harvests” encrypted data now with the expectation of decrypting it in the future with a quantum computer, that’s a real threat. Standardization efforts are already underway: the National Institute of Standards and Technology (NIST) has been running a multi-round competition to select PQC algorithms.

What kinds of PQC algorithms exist?

  • Lattice-based cryptography (e.g., module-lattice problems) — considered one of the most promising.

  • Code-based cryptography (error-correcting code problems).

  • Multivariate polynomial cryptography (multivariate equations).

  • Hash-based signatures.

What are the recommendations for today?

  • Symmetric encryption: Continue using strong key lengths (e.g., AES-256) and robust modes.

  • Asymmetric/public-key encryption: Recognize that algorithms like RSA or elliptic-curve cryptography (ECC) may be vulnerable in the long term.

  • Begin inventorying where your systems use public-key crypto. Plan for migration to quantum-resistant alternatives.

  • Adopt “crypto-agility” — the ability to swap cryptographic primitives when standards or threats change.

  • Use trusted libraries and implementations, manage nonces and keys carefully, and avoid cutting corners.


The Bottom Line

To sum up:

  • AES (symmetric encryption) is your data protector.

  • RSA or Diffie-Hellman (and their modern counterparts) are the secret-sharers and identity-verifiers.

  • Post-quantum cryptography is the future guardrail, ensuring that those secrets and identities remain safe even when quantum computers arrive.

The mathematics behind these systems is strong — the hard part is in the implementation. Mistakes in nonce handling, library misuse, reuse of keys, bad padding, weak random number generators, and too-long key lifetimes are the real security holes. Use trusted libraries, rotate keys regularly, never reuse nonces, avoid detailed error messages that leak internal state, keep your system up to date — and build your cryptographic design to be flexible so you can swap algorithms as the world moves on.


FAQs

Q: What’s the difference between symmetric and asymmetric encryption in practice?
A: Symmetric encryption uses the same key for both encryption and decryption — it’s fast, good for large data. Asymmetric encryption uses a public key to encrypt (or verify) and a private key to decrypt (or sign) — it’s slower but works for secure key exchange and verifying identity.

Q: Why are quantum computers a threat to RSA and ECC encryption?
A: Because quantum computers can run Shor’s algorithm, which can efficiently solve problems like integer factorisation or discrete logarithms — the mathematical foundation of RSA and ECC. That means an adversary could potentially derive private keys from public keys.

Q: How can developers start experimenting with post-quantum algorithms?
A: Begin by exploring libraries that support PQC initiatives (e.g., PQClean) and architectures that allow hybrid encryption (classical + quantum-resistant). Planning and testing early is wise given the long lead time for cryptographic migration.