All articles
Document integrityJuly 9, 2026 8 min read

Document cryptography — hash, digital signature and timestamp (what each one proves)

Also available in:中文РусскийBahasa Indonesiaहिन्दीFrançaisEspañolPortuguêsবাংলাالعربية

"Is this document legally valid?" — the question comes up every week in any office that works with PDFs. And the right answer depends on understanding three different cryptographic mechanisms that people mix up all the time: the hash, the digital signature and the trusted timestamp.

Each one proves a different thing. Using the wrong one — or assuming one replaces another — is the kind of oversight that only surfaces when the document is contested. This guide explains all three without tech-speak, shows what each proves (and does not prove), and lists the practical mistakes that invalidate a digital signature without anyone noticing.

The three questions a digital document must answer

When a document becomes evidence — in a negotiation, an audit, a dispute — the doubts about it are always variations of three questions:

  1. Integrity — is this file exactly the same, with no alteration whatsoever?
  2. Authorship — who produced or agreed to this content?
  3. Priority in time — did this content already exist on a given date?

Modern cryptography has one instrument for each question. Let's go through them.

Instrument 1 — Hash: the proof of integrity

The SHA-256 hash is a mathematical "fingerprint" of the file: a 64-character sequence calculated from the content. Any change to the document — a single comma — produces a completely different hash. We have published a complete guide to SHA-256 hashes and integrity verification; the essentials:

  • Proves: that the content is identical, bit for bit, to what existed when the hash was recorded;
  • Does not prove: who created the file, or when;
  • Cost: zero — you can calculate the hash of any file in your browser, in seconds, without sending the document anywhere.

The hash is the foundation of the other two mechanisms: both the digital signature and the timestamp work, under the hood, by signing or dating the hash of the document.

Instrument 2 — Digital signature: the proof of authorship

Here enters asymmetric cryptography (public-key cryptography), and the idea is worth understanding because it is elegant:

Each person holds a pair of mathematically linked keys: a private key, which only they possess, and a public key, which anyone may know. What one key encrypts, only the other can decrypt.

The digital signature uses this ingeniously:

  1. The software calculates the hash of the document;
  2. That hash is encrypted with the signer's private key — that is the signature;
  3. Whoever receives the document decrypts the signature with the signer's public key and compares it with the freshly recalculated hash of the file.

If they match, two things are proven at once: the document was not altered since signing (integrity), and the signature can only have been made by whoever holds the private key (authorship).

One link is missing: how do you know that public key really belongs to that person? That is the role of the digital certificate — an electronic document, issued by a Certificate Authority, binding the public key to the holder's identity. The legal framework varies by country: in the European Union, eIDAS defines qualified electronic signatures; in the United States, the ESIGN Act and UETA give electronic signatures legal effect; many countries run national PKI schemes (Brazil's ICP-Brasil, for example). The cryptography underneath is the same everywhere.

  • Proves: authorship/consent + integrity from the moment of signing;
  • Does not prove: that the content existed before the signature, nor the date with independent force (the signer's computer clock is weak evidence);
  • Cost: qualified certificates are usually paid; many jurisdictions also offer free or low-cost government-backed signing schemes.

Instrument 3 — Trusted timestamp: the proof of priority in time

The trusted timestamp answers the question the other two cannot: "did this document already exist on this date?"

It works like this: the document's hash is sent to a Time Stamping Authority (TSA) — a service with an audited, trusted clock, following the RFC 3161 standard — which returns the hash signed together with the official date and time. Note the detail that matters for privacy: only the hash travels, never the document. The authority stamps the fingerprint without ever seeing the content.

  • Proves: that this exact content existed at that date and time, at the latest;
  • Does not prove: authorship;
  • Cost: usually a paid service, offered by TSAs around the world.

Practical summary: which instrument for which need

  • "I want to prove the file did not change" → SHA-256 hash. Record it early, somewhere hard to dispute (an e-mail to the other party, a shared report), and check it later in the integrity checker.
  • "I want to prove someone agreed to this content" → digital signature (qualified or legally recognized in your jurisdiction).
  • "I want to prove this content existed before a certain date" → trusted timestamp.
  • "I want all of it" → the three combine: a digitally signed contract with a timestamp carries authorship, integrity and date.

The mistake that invalidates digital signatures (and almost nobody notices)

Here is the most valuable warning in this article for day-to-day office work:

Any manipulation of a digitally signed PDF breaks the signature. Remember how it works: the signature is the document's hash, encrypted. If the document changes, the hash changes, and the signature no longer verifies. That means, on an already-signed PDF:

The golden rule: all manipulation comes before signing. Assemble the final document — merge attachments, convert images to PDF, compress, arrange the pages — and only then collect the digital signatures. If something must change afterwards, it must be signed again.

And the corollary: if you received a signed PDF and need a smaller or partial version to work with, keep the original untouched (record its hash in the checker) and manipulate only working copies.

Confidentiality encryption: the PDF password

Beyond integrity, authorship and date, there is a fourth need — confidentiality — served by symmetric encryption: ciphering the PDF with a password (the AES-256 standard), so that only someone with the password can open the content.

Two practical observations:

  1. A password protects secrecy, not integrity or authorship — a password-protected file can still be replaced by another file with the same password;
  2. The protection is only as strong as the password. "1234" in AES-256 is still "1234".

For documents containing personal data, secrecy carries legal weight: the GDPR in Europe, the CCPA in California, Brazil's LGPD and similar laws worldwide treat data protection as an obligation, not a courtesy. The strongest confidentiality mechanism of all is architectural: the document never leaving your machine in the first place.

How RoseLab applies these concepts

RoseLab is built on two cryptographic principles discussed here:

In practice, a robust review flow looks like this: receive the two versions of the document → record the hashes → compare them with automatic difference highlighting → generate the report with the hashes printed → archive report + originals. Anyone who disputes the review can redo it entirely, alone — the full method is in the complete document comparison workflow.

Frequently asked questions

Is an unsigned digital document valid? In most jurisdictions, legal validity does not depend on a specific form for the majority of private acts — e-mails, PDFs and even messages serve as evidence, weighed together. Digital signatures and timestamps strengthen the evidence; their absence does not automatically void it. For specific acts (deeds, certain corporate filings), local law may require qualified signatures — check the rules that apply to you.

Is a scanned handwritten signature a digital signature? No. An image of a signature pasted into a PDF is just a picture, with no cryptographic property — it can be copied from one document to another. A digital signature is the mathematical mechanism described above, backed by a certificate.

Does a hash recorded in an e-mail count as evidence? It counts as strong evidence of integrity: the e-mail has a date, a recipient, and is logged on third-party servers (the e-mail providers). If the hash of the file presented later matches the hash sent at the time, an allegation of tampering becomes very hard to sustain. The check takes seconds in the checker.

Does compressing a PDF change its hash? Yes — compression rewrites the file, so the hash changes (and digital signatures break). That is why you should record the hash of the final file, after all manipulation, or keep both the original and the compressed version with both hashes noted.

What is the difference between symmetric and asymmetric encryption? Symmetric: the same password encrypts and decrypts (the PDF password, AES-256). Asymmetric: a key pair, one public and one private — the basis of digital signatures and certificates. The hash is neither: it is a one-way digest function, used as a building block by both.

Ready to put it into practice?

Free, no sign-up — and your files never leave your computer.

Check a document's integrity now — free