PQFWpost-quantum forensic watermarking
KEM ML-KEM-768 SIG ML-DSA-65 AEAD AES-256-GCM HASH SHA3-256 liboqs 0.16.0

Encrypt once. Fingerprint everyone.

Why this is not a watermark

Ordinary forensic watermarking asks the recipient's software to add a mark. A recipient who patches the viewer gets a clean copy, and there is nothing in the cryptography to stop them.

PQFW splits the document into a base body plus m mark slots. Each slot is rendered two ways that a reader cannot tell apart, and the two renderings are encrypted under different keys. Both ship to everybody. A recipient's key bundle holds exactly one variant key per slot, chosen by their Tardos codeword bit — so the other rendering is an AES-GCM tag failure for them.

slot i    variant 0  ──encrypted under VK[i][0]──┐
          variant 1  ──encrypted under VK[i][1]──┤── both, in the shared ciphertext
                                                  │
recipient j's bundle:   VK[i][ X[j][i] ]   ← one of the two, never both

The central security claim, executed

There is no code path around a tag check. Patching the client does not help; reverse engineering it does not help. There is no unmarked copy anywhere in the system — not in the package, not in transit, not on the distributor's disk after the package is built.

r03 holds one variant key for each of 301 slots.
Tried the other rendering at 301 slots: refused at every one.

  variant they hold      decrypts    (301/301)
  the other rendering    InvalidTag  (301/301)

The shared ciphertext is byte-identical for all 8 recipients:
  public part      42,799 bytes
  per recipient    14,028 bytes

1 · enrol — post-quantum key pairs for 20 recipients and 3 witnesses

-- enroll ------------------------------------------------------
  state                  state
  recipients             20  (r00 .. r19)
  witnesses              3, 2-of-3 required

  key encapsulation      ML-KEM-768   (FIPS 203)
  signatures             ML-DSA-65   (FIPS 204)
  content encryption     AES-256-GCM
  hash / KDF             SHA3-256 / HKDF-SHA3-256
  liboqs                 0.16.0

  recipient devices  state\recipients
  witness keys       state\witnesses
  sealed store       state\distributor.sealed

2 · protect — one encryption, 20 fingerprints waiting

-- protect -----------------------------------------------------
  document               report.txt  (2158 bytes)
  doc id                 report
  carrier                text-zwsp
  recipients             20
  decryption credentials 60  (3 per recipient, each with its own codeword)
  mark slots             301
  code length            capped by the carrier: 12434 slots wanted for c=3, eps=1e-06, 301 available
                         a shorter code gives weaker evidence, not false
                         evidence: the p-value is computed from the score
                         actually observed
  best achievable eps    9.09e-29 against a single leaker

  public ciphertext      42,801 bytes  (identical for everyone)
  per recipient          14,028 bytes  (ML-KEM ct + wrapped bundle)
  total                  884,481 bytes

  package  state\packages\report.json
  every recipient receives the same ciphertext; only the wrapped key bundle
  differs, and it decides which rendering of each slot they can decrypt

The honest cap, reported before anything is distributed

The Tardos bound asks for 12,434 slots at this coalition size and confidence; the memo holds 301. The code is shortened rather than the requirement quietly dropped — which costs confidence, not correctness, because the probability reported at trace time is computed from the score actually observed. Here that still comes to 3e-29.

3 · open — the recipient decrypts and signs a receipt

-- open --------------------------------------------------------
  recipient              r07
  session                r07#0   (2 credentials left)
  doc id                 report
  written to             leaked.txt  (2,575 bytes)
  copy hash              8d2fd64c9df5ea011de48f60fd346df8...

  receipt signed         ML-DSA-65 by r07
  ledger entry           seq 0   af286805c0d55fd1d7762d88...

  this copy carries a fingerprint that its holder could not decline: they
  hold one variant key per slot and cannot decrypt the other rendering.
  Opening again spends the next credential and yields a different mark, so a
  leak resolves to this decryption rather than merely to this person.

4 · trace — who leaked it, and how sure can we be

-- trace -------------------------------------------------------
  leaked file            leaked.txt  (2,575 bytes)
  doc id                 report
  readable slots         301 of 301
  alpha                  1e-06

  best match             r07
  decryption session     r07#0
  z-score                10.85 sigma
  false-accusation       1.823e-47   provable bound
                         5.674e-26   Gaussian approximation, for reference
  raw score              188.3

  runners-up
    r12      z=   2.24   bound=1.000000
    r19      z=   1.85   bound=1.000000
    r03      z=   1.66   bound=1.000000
    r01      z=   1.61   bound=1.000000

  corroboration
    OK statistical significance (p < alpha)
    OK recipient's ML-DSA-65 receipt verifies
    OK ledger hash chain intact
    OK checkpoint witnesses 3/2 required
    OK Merkle inclusion proof to the signed root
      ledger entry seq 0

  IDENTIFIED  ->  r07   false-accusation probability at most 1.823e-47

Statistics alone is a suspect, not a case

A trace is called conclusive only when all five hold: the provable bound clears α; the accused's own ML-DSA-65 receipt verifies; the ledger hash chain is intact; a k-of-n witness checkpoint covers that entry; and a Merkle inclusion proof ties it to the witness-signed root. Anything less reports UNCORROBORATED — a lead. That is how an innocent person avoids being named.

Corrupt one field and watch it break

-- audit -------------------------------------------------------
  deliberately corrupted ledger entry 0 field 'doc_hash'
    was  8d2fd64c9df5ea011de48f60fd346df8d6c77d5f25b0c00987c2aabf80a7d631
    now  c9460c7625cf7a52b2728afd9f0a1ce03e0cf80c15fb90981975e166c0d28c30

  distributed ledger
  validators             3 independent replicas, 2-of-3 to commit, height 1
    OK validator 0  in agreement               1965780cd980cd57...
    OK validator 1  in agreement               1965780cd980cd57...
    OK validator 2  in agreement               1965780cd980cd57...
    OK an honest quorum still stands: one compromised validator changes nothing

  entries                1
  local hash chain       X BROKEN
  first bad entry        seq 0
      seq 0: contents do not match entry_hash (record was altered)
      seq 0: recipient signature does not verify

  checkpoints (2-of-3 witnesses)
    OK #0  seq 0-0  3/2 witnesses  root aeb1341583881e15...
      X the signed root still covers exactly these 1 entries
        the ledger no longer reproduces this witnessed root: the entries are all present but their contents have changed

  primitives             ML-KEM-768 / ML-DSA-65 / AES-256-GCM / SHA3-256

The same leaked file, traced again against the corrupted ledger. The marks have not changed, so the statistics are exactly as strong as before — and the verdict is no longer an identification:

-- trace -------------------------------------------------------
  leaked file            leaked.txt  (2,575 bytes)
  doc id                 report
  readable slots         301 of 301
  alpha                  1e-06

  best match             r07
  decryption session     r07#0
  z-score                10.85 sigma
  false-accusation       1.823e-47   provable bound
                         5.674e-26   Gaussian approximation, for reference
  raw score              188.3

  runners-up
    r12      z=   2.24   bound=1.000000
    r19      z=   1.85   bound=1.000000
    r03      z=   1.66   bound=1.000000
    r01      z=   1.61   bound=1.000000

  corroboration
    OK statistical significance (p < alpha)
    X recipient's ML-DSA-65 receipt verifies
    X ledger hash chain intact
    OK checkpoint witnesses 3/2 required
    OK Merkle inclusion proof to the signed root
      ledger entry seq 0

  UNCORROBORATED
  the marks match, but the ledger evidence does not stand up. This is a
  lead, not an identification.

Editing a record and then recomputing every downstream hash still fails, because the administrator cannot reproduce the recipient's signature. Truncating the tail leaves a valid chain — the known limit of a hash chain, and exactly why checkpoints exist: the witnessed Merkle root no longer reproduces.

The ledger contains no codewords

A receipt carries SHA3-256(codeword ‖ salt) and nothing else about the fingerprint, so it could be published in full — handed to every recipient, printed, pinned to a wall — without giving anybody the means to forge, strip or transplant a mark. The root is exported as a QR code: print it and the paper is a witness. No chain, no orderer, no network.

The number the system stands behind

A trace never reports a bare identification. It reports a false-accusation probability — and the one it gates on is a provable Chernoff bound, not a Gaussian p-value. That distinction came out of the evaluation harness rather than out of theory.

The Tardos score is a sum of m independent terms each with mean 0 and variance 1 — but not each small. A slot whose bias sits near the truncation limit contributes up to 27, while the whole sum's standard deviation at m=800 is 28. A handful of slots dominate, the central limit theorem has not taken hold in the tail, and the normal approximation understates the false-accusation rate:

nominal αempirical — Gaussian p-valueempirical — provable bound
1e-032.4e-03 ↑ above nominal1.6e-03
1e-045.0e-04 ↑ above nominal1.0e-04
1e-050 / 10,0000 / 10,000
1e-060 / 10,0000 / 10,000
1e-070 / 10,0000 / 10,000
1e-080 / 10,0000 / 10,000
1e-090 / 10,0000 / 10,000
Empirical false-accusation rate against nominal alpha
10,000 innocent trials. Anything above the dashed line produces more false accusations than advertised. Hollow markers are zero events in 10,000 trials — the true rate is below the resolution floor, not measured at it.
P(Z ≥ t)  ≤  min over λ>0 of   exp(−λt) · Π E[exp(λ·w)]

Valid because an innocent recipient's codeword is independent of the extracted bits — they hold no key that could have influenced them. And because the score is bounded, the bound is not merely valid but tighter than the Gaussian tail in the regime an accusation actually lives in: at m=301 a real leaker's bound comes out near 1e-47 where the Gaussian says 1e-25. Using the rigorous number costs nothing.

Collusion

Coalitions can only act where their members disagree; where they agree they are stuck, because none of them holds the key for the other rendering. That constraint is enforced by the package, not assumed of the attacker.

coalitiondetection at m=1200detection at the prescribed mmean rank of first colluder
1100%100%1.00–1.00
2100%100%1.00–1.00
3100%100%1.00–1.00
546%–57%100%1.00–1.00
80%–8%100%1.00–1.01
Detection rate and colluder rank against coalition size
200 trials per cell, five collusion strategies, n=100. Solid lines are the code length the Tardos bound prescribes; dashed are what a real document holds.

A short code costs confidence, not correctness

At a length a real document can hold, detection against a coalition of eight collapses — while the mean rank of the first true colluder stays at 1.0 and innocent accusations stay at 0.0%. The ordering barely degrades; what degrades is confidence. The system declines to name anybody rather than guessing.

Attacks that defeat the carrier

Measured, with the losses reported next to the wins. Text carrier, m=728.

attackwhat it doesbit error ratezoutcome
nonebaseline: the file as issued0.0%19.0traced
nfcUnicode NFC normalisation0.0%19.0traced
nfkcUnicode NFKC normalisation (compatibility)0.0%19.0traced
utf16_roundtripre-encode via UTF-16 and back0.0%19.0traced
truncate_75keep the first 75% of the file0.0%16.5traced
truncate_50keep the first half0.0%13.8traced
truncate_25keep the first quarter0.0%10.1traced
whitespace_collapsecollapse runs of spaces/tabs0.0%19.0traced
strip_format_charsremove every Unicode format character51.0%2.4DEFEATS THE CARRIER
retyperead it and type it out again50.9%2.4DEFEATS THE CARRIER
insert_word_startprepend one word (shifts every slot)50.7%1.9DEFEATS THE CARRIER
insert_word_midwayinsert one word halfway through25.4%10.1traced
delete_word_startdelete the first word50.8%0.6DEFEATS THE CARRIER
Bit error rate per attack on the zero-width-space carrier
Bit error rate, not readability: an attack that strips the zero-width spaces leaves every slot perfectly readable and reading zero. Plotting readability would show a full green bar for an attack that completely defeats the carrier.

Truncation is survivable

Cutting a document only removes slots, and a removed slot is carried as an erasure rather than guessed as a zero — so the evidence weakens and never inverts. Across a 0–95% erasure sweep, misidentification stays at 0.0% at every level.

Ordinal locators do not resynchronise

A slot's address is "the k-th space in the document", so inserting or deleting a word shifts every later address. This is the sharpest limitation of the design and the first thing anyone asks about. A content-anchored locator would fix it, and is the natural next iteration.

Detection rate against fraction of slots unreadable
Detection degrades smoothly as slots are lost. When an attack wins, the result is a failure to identify — never a misidentification.

Cost, and what is deliberately out of scope

One shared ciphertext plus a small per-recipient envelope. The envelope is independent of both N and the document's size.

Package build time and per-recipient envelope size
Build cost is linear in recipients (one ML-KEM encapsulation each) and the per-recipient envelope is linear in slots and flat in N.

Traceability, not unframeability

The distributor knows every codeword, so a malicious distributor could in principle fabricate a copy carrying someone's marks. True non-repudiation needs asymmetric fingerprinting — classically Paillier plus zero-knowledge proofs — and there is no drop-in post-quantum Paillier. A BFV-based construction is the documented next step. It is not built here and it is not claimed.

Also out of scope by construction: retyping and OCR (no text carrier survives a human reading the document and typing it out), and a recipient who leaks their own private key, which leaks their own accountability.

Running it

Everything runs offline — no cloud KMS, no timestamping service, no public chain, no network calls at runtime. That is asserted by a test that replaces the socket layer with one refusing every operation and then runs the whole pipeline anyway.

pqfw enroll  --recipients 20 --out ./state
pqfw protect --doc report.txt --state ./state --coalition 3 --eps 1e-6
pqfw open    --doc-id report --recipient r07 --state ./state --out leaked.txt
pqfw trace   --doc-id report --leaked leaked.txt --state ./state
pqfw audit   --state ./state --tamper 0

The interactive browser demo is a container: docker build -f deploy/Dockerfile ., or deploy the included Render blueprint. It needs a server because the point is that liboqs does the work — reimplementing ML-KEM and the Tardos scorer in JavaScript to fit a static host would replace the thing being demonstrated with an untested copy of it.

Every number, table and transcript on this page was produced by executing the real library at build time — commit 5f38d69, built 2026-09-10 00:48 UTC. This is a recorded run, not a live one. The interactive version needs a server and ships as a container.

Smart India Hackathon 2026 · problem statement SIH26237 — Cryptographic Attribution and Immutable Decryption Provenance for Multi-Recipient Encrypted Document Distribution, Ministry of Defence. Built by Team NOX, IIIT Bhubaneswar.

144 tests, including the safety-critical ones: that a recipient cannot decrypt the other variant, that a coalition cannot forge a slot they agree on, that erasures are never read as zeros, that the provable bound never sits below the measured rate, and that no accusation is reported without its error probability. All sample content is synthetic. There is no real data of any kind in this project.