What a Signature Proves
A handwritten signature is a weak analogy — it can be copied and says nothing about whether a document was altered after signing. A digital signature is far stronger. Attached to a piece of data, it provides three guarantees at once:
- Authenticity — the data genuinely came from the holder of a specific private key.
- Integrity — not a single bit has changed since it was signed.
- Non-repudiation — the signer cannot later credibly deny signing it, because only they hold the key that could produce the signature.
Crucially, a digital signature does not hide the data — signed content is usually perfectly readable. Signing is about proof, not secrecy. That is the first thing that distinguishes it from encryption.
Signing Is Encryption's Mirror Image
Both build on an asymmetric key pair — a public key anyone can have and a private key kept secret — but they use it in opposite directions:
| Encrypting for secrecy | Signing for proof | |
|---|---|---|
| Who acts with which key | Sender uses the recipient's public key | Sender uses their own private key |
| Who reverses it | Recipient's private key decrypts | Anyone's copy of the signer's public key verifies |
| Goal | Confidentiality | Authenticity + integrity |
| Who can perform it | Anyone (public key is public) | Only the private-key holder |
The asymmetry is the whole trick. Because only one person holds the private key, only they can create a signature that checks out against the public key — yet because the public key is freely available, everyone can verify it. Encryption restricts who can read; signing restricts who can create.
Hash First, Then Sign
Signatures do not operate on the whole message directly — that would be slow and impractical for large files. Instead they lean on hashing. The signing process is:
- Hash the message. The signer runs the entire message through a cryptographic hash function to get a small, fixed-size digest.
- Sign the hash. The signer transforms that digest with their private key. The result is the digital signature, attached to the message.
Hashing first solves two problems at once: it shrinks any message — a one-line note or a gigabyte installer — to a tiny digest that is fast to sign, and because a hash changes completely if even one bit of the message changes, signing the digest still protects the integrity of the whole thing.
How Verification Works
The recipient checks the signature without ever needing a shared secret:
- Hash the received message independently, using the same hash function, to get their own digest.
- Check the signature using the signer's public key, recovering the hash the signer committed to.
- Compare. If the recipient's freshly computed hash matches the one carried in the signature, the signature is valid: the data is authentic and unaltered. If even one byte was changed in transit, the hashes differ and verification fails.
This is why a tampered download or a forged message is caught immediately — any modification breaks the hash match, and a signature cannot be forged without the private key.
Where Digital Signatures Are Everywhere
Once you recognise the pattern, you see it constantly:
- HTTPS certificates. A certificate authority digitally signs a website's certificate. Your browser verifies that signature to trust the site's identity — the foundation of the lock icon and a core step in the TLS handshake.
- Software updates. Operating systems and app stores sign their packages so your device can confirm an update really came from the vendor and was not swapped out by an attacker.
- Documents and email. Signed PDFs and signed email (S/MIME, PGP) prove authorship and detect tampering.
- Code and supply chains. Signed commits and signed container images let systems verify that code is from a trusted source before running it.
In each case the value is the same trio — you know who produced it, you know it is unchanged, and they cannot deny it. Combined with the secrecy that encryption provides, digital signatures complete the toolkit that makes trust possible between parties who have never met.
Frequently Asked Questions
What is a digital signature?
A cryptographic proof attached to data showing it came from a specific private-key holder and has not been altered. The signer hashes the data and transforms the hash with their private key; anyone verifies it with the matching public key.
How does a digital signature work?
The signer hashes the message, then signs that hash with their private key. The recipient hashes the received message, checks the signature with the signer's public key, and accepts the data only if the hashes match. Any change breaks the match.
What is the difference between signing and encrypting?
Encrypting uses the recipient's public key for secrecy; signing uses the sender's private key for proof of origin. They use the key pair in opposite directions and solve opposite problems — confidentiality versus authenticity.
What is non-repudiation?
The signer cannot credibly deny signing, because only their private key could produce a signature that verifies against their public key. A valid signature is strong evidence of authorship.
Why is the message hashed before signing?
Public-key operations are slow and work on small inputs, while messages can be large. Hashing reduces any message to a small fixed digest that is fast to sign, and since the hash changes completely with any edit, signing it still protects the whole message.