A digital signature is a cryptographic technique that proves a document was created by a specific sender and has not been altered since. Unlike a handwritten signature, a digital signature is mathematically bound to the content it signs — change one character and verification fails. They are used in software distribution, email, and legal documents.

What problems do digital signatures solve?

When you receive an email or download a file, two questions arise:

  1. Authentication: Did this really come from the person it claims to be from? (Or is it a forgery?)
  2. Integrity: Has the content been altered in transit? (Or has it been tampered with?)

Encryption protects confidentiality — only the intended recipient can read the message. But encryption alone does not answer authentication or integrity questions: an attacker could intercept and replace an encrypted message with their own.

A digital signature addresses authentication and integrity directly, without necessarily encrypting the content. In many systems (such as email and software updates), the content is publicly readable but must be provably unaltered and genuine.

What are the building blocks of a digital signature?

Digital signatures rely on two technologies you may already know from GCSE:

Hashing

A hash function takes an input of any length and produces a fixed-length output called a hash or digest. Key properties:

  • The same input always produces the same hash.
  • A tiny change in the input produces a completely different hash (the avalanche effect).
  • It is computationally infeasible to reverse — you cannot reconstruct the original document from its hash.

Example hash functions: SHA-256 (produces a 256-bit hash), SHA-3, MD5 (older, now considered weak).

Asymmetric (public key) encryption

In asymmetric encryption, each party has a mathematically linked key pair: a private key (kept secret) and a public key (shared openly). What is encrypted with one key can only be decrypted with the other.

For signatures, the sender uses their private key to encrypt (sign). The receiver uses the sender's public key to decrypt (verify). Only someone with the genuine private key could have produced a signature that the corresponding public key can verify.

How does the signing process work?

Signing (sender's side):

  1. The sender creates the document (e.g. a software update, a contract).
  2. The sender runs the document through a hash function, producing a message digest (a short fixed-length string representing the document's contents).
  3. The sender encrypts the message digest using their private key. This encrypted digest is the digital signature.
  4. The sender transmits the original document plus the digital signature.

Verification (receiver's side):

  1. The receiver receives the document and the digital signature.
  2. The receiver decrypts the digital signature using the sender's public key — recovering the original message digest.
  3. The receiver independently runs the received document through the same hash function — producing their own message digest.
  4. The receiver compares the two digests.
    • If they match: the document is authentic (only the private-key holder could have signed it) and unaltered (the hash of the received document matches the signed hash).
    • If they differ: either the document has been tampered with, or the signature is not from the claimed sender.
Step Who Action
1 Sender Hash the document → digest
2 Sender Encrypt digest with private key → signature
3 Sender Send document + signature
4 Receiver Decrypt signature with sender's public key → original digest
5 Receiver Hash the received document → new digest
6 Receiver Compare digests: match = valid; no match = invalid

What security properties does a digital signature provide?

Property Meaning How the signature provides it
Authentication The document came from the claimed sender Only the holder of the private key can produce a valid signature
Integrity The document has not been altered Any change produces a different hash; the digests would not match
Non-repudiation The sender cannot deny having sent it Only their private key (which only they hold) could produce that signature

Non-repudiation is particularly important in legal and financial contexts: a signatory cannot later claim "I didn't sign that" if their private key was used and their key has not been reported as compromised.

How is a digital signature different from message encryption?

This distinction matters for GCSE:

Feature Encryption Digital signature
Goal Confidentiality (only the recipient can read it) Authentication and integrity (provably from the sender, unaltered)
Key used to protect Recipient's public key (only recipient's private key can decrypt) Sender's private key (anyone with sender's public key can verify)
Is the content hidden? Yes No — the document is readable by anyone; only the signature is "secret"

In practice, systems like email (PGP, S/MIME) and HTTPS use both: the content is encrypted for confidentiality AND signed for authentication and integrity.

Where are digital signatures used?

  • Software distribution: Operating system updates (Windows, macOS, Linux) are digitally signed so your computer can verify they genuinely came from the vendor and have not been tampered with. Installing unsigned software gives a security warning.
  • Email: S/MIME and PGP allow email clients to sign and verify messages, detecting forgeries and tampering.
  • PDF documents: Legal contracts signed with qualified electronic signatures (under eIDAS regulation in the EU, and similar UK law) use digital signatures.
  • Secure boot: When your computer starts, the firmware uses digital signatures to verify that the operating system has not been modified by malware.
  • Code signing certificates: Mobile app stores verify that apps are signed by their registered developer before allowing installation.

Frequently asked questions

Do digital signatures encrypt the whole document?

No. The digital signature only encrypts the hash (digest) of the document — not the document itself. This is efficient: hashes are short (e.g. 256 bits for SHA-256) regardless of document size, so signing is fast even for large files. The document is typically transmitted in plain text or encrypted separately if confidentiality is also needed.

What is a digital certificate and how does it relate to digital signatures?

A digital certificate (such as an SSL/TLS certificate on a website) binds a public key to an identity — it says "this public key really belongs to aitutors.me". Certificates are themselves digitally signed by a trusted third party called a Certificate Authority (CA). When verifying a digital signature, you first use the certificate to confirm that the public key is genuine, then use that public key to verify the signature. Without certificates, an attacker could substitute their own public key and claim to be the legitimate sender.

Can a digital signature be forged?

Not in practice, given current cryptography. Forging a digital signature would require either obtaining the signer's private key (which is why private keys must be kept secret and protected by strong passwords or hardware security modules), or breaking the underlying cryptography (currently computationally infeasible for algorithms like RSA-2048 or ECDSA). If a private key is compromised, the signature scheme breaks — which is why certificates have expiry dates and revocation mechanisms.

Is an electronic signature the same as a digital signature?

No. An electronic signature is a broad legal term for any electronic indication of consent — including a typed name at the bottom of an email or a scanned handwritten signature image. A digital signature is a specific cryptographic implementation of an electronic signature. Electronic signatures are easy to forge; digital signatures are cryptographically secure. The UK and EU have legal frameworks that give digital signatures (qualified electronic signatures) the same legal standing as a handwritten signature.


Work through cryptography problems — hashing, asymmetric encryption, and digital signatures — with Professor Turing at aitutors.me.