Heads up: posts on this site are drafted by Claude and fact-checked by Codex. Both can still get things wrong — read with care and verify anything load-bearing before relying on it.
why how

Why public-key signatures are not just 'encryption in reverse'

They look symmetric — encrypt with one key, decrypt with the other — but signatures and encryption answer different questions, and conflating them is how real cryptosystems get broken.

Security intermediate Apr 29, 2026

Why it exists

A lot of engineers carry around a tidy mental model of public-key crypto: you have two keys, one public and one private, and they “undo” each other. Encrypt with the public key, decrypt with the private key. Flip it around — encrypt with the private key, decrypt with the public key — and you get a signature. Same operation, different direction.

This story is appealing, easy to teach, and — for any modern system you should actually use — wrong. It happens to roughly match how textbook RSA worked, and that’s where the confusion comes from. RSA’s particular math does let you reuse the same primitive in both directions, which is exactly why early RSA implementations had cross-protocol attacks where a signing oracle could be tricked into decrypting messages.

Modern signature schemes (Ed25519, ECDSA, RSA-PSS) and modern encryption schemes (RSA-OAEP, ECIES, hybrid AEAD constructions) are not the same operation reversed. They’re built from different primitives, with different security goals. Treating them as interchangeable is one of the classic ways to introduce a real vulnerability into otherwise sane code.

Why it matters now

If you ship software in 2026 you are, transitively, relying on signatures constantly:

For AI-era infrastructure specifically: the supply chain for models is now just as much of a target as the supply chain for code. “Did this 70 GB checkpoint actually come from the lab whose name is on it, unmodified” is a signature question, not an encryption question. Knowing which one you need — and not asking the wrong primitive to do the other one’s job — is the difference between provenance you can trust and a vibes-based promise.

The short answer

signature ≈ "I, holder of the private key, vouch for this exact message" — anyone with the public key can verify

encryption ≈ "only the holder of the private key can read this message" — anyone with the public key can produce it

They share the same key pair shape but answer opposite questions. A signature is about authenticity and integrity — proving who said it and that it hasn’t changed. Encryption is about confidentiality — keeping the contents secret from everyone but the intended recipient.

How it works

It’s easiest to see by lining up who has what.

Encryption (public-key):

Signatures:

Notice the asymmetry of who-knows-what:

That alone is enough to see they aren’t really the same operation. The actor holding the private key plays opposite roles in the two protocols.

What modern signatures actually do

A real signature scheme is not “encrypt the message with the private key.” It’s something more like:

  1. Hash the message with a cryptographic hash (SHA-256, SHA-512, etc.) to get a fixed-size digest. You sign the digest, not the message — partly for efficiency, partly because signing arbitrary structured data directly opens up algebraic attacks.
  2. Apply a signing primitive that’s specifically designed to be a signature: Ed25519 uses elliptic-curve scalar multiplication with a carefully chosen nonce derivation; ECDSA does something similar but with a randomized nonce that has to be unique (reusing a nonce across two signatures is how Sony’s PS3 keys got extracted, famously); RSA-PSS adds randomized padding around the hash before exponentiation.
  3. Verify by re-hashing the message and running the verification half of the primitive against the signature and the public key.

The primitive is chosen so that:

What modern encryption actually does

Public-key encryption almost always uses a hybrid construction. You don’t encrypt your 4 MB JSON payload directly with RSA — that’s both slow and dangerous. Instead:

  1. Generate a fresh random symmetric key (e.g. for AES-GCM).
  2. Encrypt the payload with that symmetric key, using an AEAD so tampering is detected.
  3. Encrypt the symmetric key with the recipient’s public key (RSA-OAEP, or an ECDH key-agreement step).
  4. Send both pieces.

Padding, key derivation, nonces, and AEAD tags are doing real security work in this construction. None of that machinery exists in a signature scheme, because it’s solving a different problem.

Show the seams

If a curious engineer takes one thing away: ask which question you’re answering. “Who said this, and is it intact?” is signatures. “Can only the intended reader see this?” is encryption. The keys look the same on the outside; the protocols underneath are not.

Going deeper