How do digital signatures work? A plain-language guide
A digital signature proves who signed a file and that it has not changed. How signing and verification work, how they differ from encryption and where you rely…
A digital signature proves two things about a message, file or software update: who created it, and that nobody has changed it since. Your browser checks digital signatures every time it opens an HTTPS site, your phone checks one before installing an app update, and banks and governments use them to sign documents with legal force. This guide explains how digital signatures work, how they differ from encryption, and where you rely on them every day.
What a digital signature proves
A handwritten signature can be copied onto another document. A digital signature cannot, because it is calculated from the exact contents of the document it signs. A valid signature tells the receiver:
- Authenticity – the signature was made with a particular private key, so it came from whoever controls that key.
- Integrity – the content is exactly as it was when signed. Changing a single character makes the signature invalid.
- Non-repudiation – the signer cannot plausibly claim later that someone else produced it, provided the private key was kept secret.
A signature does not hide the content. A signed document can be read by anyone; signing and encryption are separate tools that are often used together.
How signing and verifying work
Digital signatures use a key pair, explained in what is a public key. The process has two halves.
Signing, done by the author:
- The software calculates a hash of the document: a short fixed-length fingerprint, such as a SHA-256 value. Any change to the document produces a completely different hash.
- It combines the hash with the author’s private key using a signature algorithm such as Ed25519, ECDSA or RSA. The result is the signature.
- The signature is attached to the document or sent alongside it.
Verifying, done by anyone:
- The receiver calculates the hash of the document they received.
- They run the verification algorithm with the signature, that hash and the author’s public key.
- The algorithm answers yes or no. “Yes” means the document is unchanged and was signed by the matching private key.
Hashing first keeps signatures small and fast: a 10 GB disk image and a one-line message produce signatures of the same size.
Signatures vs encryption
| Digital signature | Encryption | |
|---|---|---|
| Goal | Prove origin and integrity | Keep content secret |
| Uses the private key to | Create the signature | Decrypt |
| Uses the public key to | Verify | Encrypt |
| Content after the step | Still readable by anyone | Readable only by the key holder |
Our guide to public-key encryption covers the encryption side. In practice systems combine both: a secure message is signed by the sender and encrypted for the receiver.
Whose key is it? Certificates and trust
A signature proves that the matching private key was used, not who owns it. If an attacker can make you believe their public key belongs to your bank, their signatures will verify perfectly. The missing link is supplied by certificates.
A certificate is a small document that says “this public key belongs to this name”, signed in turn by a certificate authority (CA) that your device already trusts. HTTPS works this way: the site’s certificate is signed by a CA, the CA’s certificate is signed by a root that ships with your operating system, and your browser checks the whole chain. See how HTTPS certificates work for the details.
Other systems use different trust models. Software publishers register signing certificates with operating-system vendors, app stores sign apps themselves, and SSH and some messaging apps ask you to confirm a key fingerprint once and then warn you if it changes.
Where you rely on signatures every day
- Websites. The HTTPS handshake includes a signature from the server that proves it holds the private key for its certificate.
- Software and updates. Windows, macOS, Android and iOS refuse or warn about unsigned or tampered installers. Signed updates are why a compromised download mirror cannot easily push malware; see how software updates work.
- Email. DKIM signatures let receiving servers check that a message really came from the sender’s domain, an important part of email delivery.
- Documents. Qualified electronic signatures, such as those used with government ID apps in many countries, are digital signatures backed by certificates and have legal standing.
- Passkeys and security keys. Logging in with a passkey means your device signs a challenge from the website; no password is sent at all.
What signatures cannot do
- They do not judge content. Malware signed with a stolen or fraudulently obtained certificate still verifies, which is why certificates can be revoked.
- They are only as safe as the private key. A key copied from an unprotected laptop lets an attacker sign anything as you.
- They depend on correct verification. Software that skips or mis-implements the check gains nothing from the signature.
Frequently asked questions
Is a digital signature the same as an electronic signature?
Not necessarily. “Electronic signature” can mean a typed name or a drawn scribble in a PDF. A digital signature is the cryptographic kind described here, and it is what gives stronger forms of electronic signature their security.
Can a digital signature be forged?
Not with modern algorithms and properly protected keys. Forgery in practice happens by stealing the private key or by tricking someone into trusting the wrong public key.
What happens when a signing certificate expires?
Signatures made while it was valid can still be checked if they were timestamped by a trusted time-stamping service. New signatures need a new certificate.
How can I check a file’s signature?
On Windows, right-click the file, open Properties > Digital Signatures. On macOS, codesign -dv --verbose=4 /Applications/App.app shows the signer. Linux packages are verified automatically by the package manager.
In short: a digital signature is a hash of the content sealed with a private key. Anyone with the matching public key can confirm who signed it and that it has not changed. Certificates link keys to real identities, and that combination quietly secures websites, updates, email and passkeys.