Cipher Utility

Digital Signatures Explained: How They Prove Authenticity

How a key pair proves who sent a file and that nobody changed it.

What a digital signature is

A digital signature is a value computed from a document and the signer's private key. Anyone with the signer's public key can check it, and the check tells them two things: the document was signed by whoever holds that private key, and not a single bit of it has changed since. A handwritten signature can be copied onto a different page; a digital signature is tied to the exact content it signs.

You rely on them constantly. Operating system updates, app installs, HTTPS certificates, signed PDFs and cryptocurrency transactions are all checked with digital signatures.

What they guarantee

  • Authentication: the document comes from the holder of the private key.
  • Integrity: changing even one character makes the signature invalid.
  • Non-repudiation: since only the signer has the private key, the signer can't plausibly deny having signed. Many legal systems treat qualifying digital signatures as binding.

Digital and electronic signatures

The two terms are often mixed up. An electronic signature is any electronic sign of agreement: a typed name, a scanned signature image, an "I agree" checkbox, or a signature drawn in an e-signing service. Many of these involve no cryptography at all. A digital signature is a specific cryptographic method based on a key pair and a hash function. Every digital signature is an electronic signature, but most electronic signatures are not digital signatures. E-signing services often add a digital signature to the finished PDF to make it tamper-evident.

How signing and verifying work

Digital signatures combine a hash function with public key cryptography. When Alice signs a document for Bob:

  1. Alice's software computes a hash of the document, for example with SHA-256. However large the document is, the result is a 256-bit fingerprint, shown as 64 hex characters.
  2. It applies Alice's private key to the hash. The result is the signature.
  3. Alice sends the document and the signature. The document itself isn't encrypted; anyone can read it.
Sign:    document → SHA-256 → hash → [Alice's private key] → signature
Send:    document + signature

To verify, Bob:

  1. computes the SHA-256 hash of the document he received
  2. uses Alice's public key to check the signature against that hash
  3. accepts the document only if the check succeeds

If it succeeds, the document is exactly what Alice signed. If it fails, either the document was changed or the signature was not made with Alice's key, and the document shouldn't be trusted.

For RSA, signing is often described as "encrypting the hash with the private key", and verifying as decrypting the signature with the public key and comparing hashes. That is a fair picture of textbook RSA. ECDSA and Ed25519 work differently inside, but the result is the same: only the private key can make a signature, and the public key can check it. Public key cryptography explained shows the RSA mathematics with small numbers.

Why they can't be forged

  • Collision resistance: nobody can find a second document with the same hash, so a signature can't be moved to a different document. This is why MD5 and SHA-1 are no longer used for signatures.
  • The public key doesn't reveal the private key, so having it doesn't let you create signatures.
  • A one-bit change to the document changes about half the bits of its hash, so any edit is caught.

Whose key is it? Certificates

A signature only proves that whoever holds a particular private key signed the document. If an attacker can convince you that their public key belongs to your bank, their signatures will check out perfectly. Something has to tie public keys to real identities.

Certificate authorities

  1. The bank generates a key pair and sends the public key, with proof of identity, to a certificate authority (CA) such as DigiCert or Let's Encrypt.
  2. The CA checks the identity, at minimum that the applicant controls the domain.
  3. The CA issues a certificate: a document containing the bank's public key and name, signed with the CA's own private key.
  4. Your browser and operating system ship with the CAs' root certificates, so they can check the CA's signature, and through it, the bank's key.
Certificate typeWhat is checkedTypical use
Domain validated (DV)Control of the domain only; issued in minutes, often freeMost HTTPS sites
Organization validated (OV)Domain plus the organization's registrationBusiness sites
Extended validation (EV)Stricter legal and operational checksBanks and large companies; browsers no longer show it differently
Code signingThe software publisher's identityPrograms, drivers, apps

How HTTPS works follows the chain of certificates in a real connection.

Where digital signatures are used

Software

Windows updates, macOS updates and Linux packages are signed, and the system checks the signature before installing anything. iOS and Android require every app to be signed, and the app stores check developer identities. Browser extensions in Chrome, Firefox and Edge are signed too. A changed or unsigned program fails the check or triggers a warning.

Documents

PDF readers can show who signed a document, when, and whether it has been changed since. A document can carry several signatures, each with a timestamp. Governments use digital signatures for tax returns, court filings and official records.

Email

S/MIME, common in companies, and PGP let a person sign individual emails, and the recipient's mail program shows whether the signature is valid. Separately, most email today carries a DKIM signature added by the sending mail server, which lets the receiving server check that the message really came from that domain and wasn't changed on the way. Mail providers use it, together with other checks, to filter spoofed and phishing mail.

Cryptocurrency

A Bitcoin transaction is a signed message saying which coins go where. The network checks the signature against the public key behind the sending address. Without the private key, nobody can spend the coins, and once a signed transaction is recorded it can't be changed.

HTTPS

The server sends its certificate, which carries the CA's signature. The browser checks that signature with the CA keys it already trusts, and the server then signs part of the handshake with its own private key to prove it holds the key in the certificate.

What can go wrong

Stolen private keys

Anyone with your private key can sign anything as you. Protect signing keys with hardware: a hardware security module for organizations, or a smart card or security token for individuals, where the key never leaves the device. At minimum, encrypt key files with a strong passphrase, limit which programs can use them, and keep encrypted backups.

Compromised certificate authorities

A CA that is hacked or careless can issue certificates for domains it shouldn't. In 2011 attackers broke into the Dutch CA DigiNotar and issued certificates for Google and other sites, which were used to intercept connections in Iran; browsers removed DigiNotar and the company went bankrupt. The same year a reseller of Comodo was compromised and certificates for major sites were issued. After a series of mis-issuance problems, browsers gradually stopped trusting Symantec's certificates from 2017 onward, which forced many sites to replace theirs. Certificate Transparency now logs every public certificate, so domain owners can spot ones they didn't request.

Weak algorithms

MD5 is broken and SHA-1 has practical collision attacks, so neither should be used for signatures. SHA-256 and SHA-3 have no known practical attacks. Why MD5 isn't secure explains why collisions break signatures.

AlgorithmMinimumRecommended
RSA2048-bit key3072 to 4096-bit key
ECDSAP-256P-256 or P-384
EdDSAEd25519Ed25519

Signatures that must last

A contract signed today with a 2048-bit RSA key may need to be checked in twenty years, when that key size might be breakable or the signer's certificate has long expired. A trusted timestamp from a time-stamping authority proves the signature existed at a given moment, while the algorithm and certificate were still sound. Long-term signature formats, such as those in the ISO/IEC 14533 standards and the PAdES profile for PDFs, add timestamps and re-sign archives periodically.

  • United States: the ESIGN Act (2000) says a signature can't be denied legal effect just because it is electronic, and most states have adopted the Uniform Electronic Transactions Act.
  • European Union: the eIDAS Regulation, in force since 2016, defines simple, advanced and qualified electronic signatures. A qualified electronic signature, made with a qualified certificate on a certified signing device, has the same legal effect as a handwritten one in every member state.
  • Elsewhere: Australia's Electronic Transactions Act (1999), India's Information Technology Act (2000), Japan's electronic signature act (2001) and China's Electronic Signature Law (2005) all recognize electronic signatures, and the UNCITRAL Model Law on Electronic Signatures has guided many other countries.

Laws usually require that the signer intended to sign, that the parties agreed to deal electronically, that the signature can be linked to the signer and the document, and that the signed record is kept. Some documents are excluded. In the United States, ESIGN does not cover wills, adoption and other family law matters, court orders, notices of utility shut-off, foreclosure or eviction, or product recall notices. Rules differ between countries, so check the local law for important documents.

Using digital signatures well

Developers and organizations

  • Use SHA-256 or stronger with RSA (3072 bits or more), ECDSA (P-256 or P-384) or Ed25519, through an established library.
  • Sign every piece of software you distribute, and verify signatures before installing or loading anything.
  • Keep signing keys in hardware, give them expiry dates, and have a plan to revoke and replace a key that leaks.
  • Timestamp signatures on documents that must stay valid for years.
  • Check sector rules where they apply, such as FIPS 140 validated modules for US government work or 21 CFR Part 11 for electronic records in US pharmaceutical work.

Everyone else

  • Install software only from official stores or the publisher's site, and pay attention to "unknown publisher" warnings.
  • When a signed PDF says it has been modified since signing, believe it.
  • Treat certificate warnings in the browser as real problems.

Quantum computers and new signature algorithms

A large quantum computer running Shor's algorithm would break RSA, ECDSA and EdDSA, and could forge signatures. Unlike encrypted data, past signatures can't be decrypted, but forged ones could be created for any key that is still trusted. In 2024 NIST published post-quantum signature standards: ML-DSA, based on CRYSTALS-Dilithium, for general use, and SLH-DSA, based on SPHINCS+, which relies only on hash functions. A third, based on FALCON, has smaller signatures and is still being standardized. Their keys and signatures are larger than today's. The usual migration plan is to sign with a classical and a post-quantum algorithm side by side while software catches up, starting with keys that must stay trusted for a long time, such as root certificates and firmware signing keys.

Try it on Cipher Utility

Further reading