ALPQ

Sealed Documents

DRAFT 0.12026-10-27ALPQ Lab spec · draft for comment

Written for GOVW's own use and published openly: take what's useful, and tell us what's wrong.

A sealed document is an ordinary file anyone can hold and nobody can read. Its key stays on the server and is released for one open at a time, to a signed-in device, and every open is logged. The reader draws each page as a picture with the viewer's name on it, so there is no text to copy, and a copy that leaks points back to whoever opened it.

Status: a draft for review, not a standard, not in production yet. Test site: hackthis.alpq.us (test accounts only). Builds on: JSON Web Encryption (RFC 7516) with the algorithms of RFC 7518, DEFLATE (RFC 1951), SVG, and the sign-in and device-bound sessions of Cross-Device QR Login. Honest scope: once a page is on a screen it can be photographed. This design makes sharing slow, visible and traceable; it can't make it impossible.

1Terms

TermMeaning
Sealed fileA JWE in compact form holding the document. Safe to store, email or publish.
Document keyA random 256-bit key, one per document, kept only by the server.
IssuerThe site that sealed the document and releases its key, named in the file's iss header.
ReaderThe issuer's own page that checks a sealed file, gets the key and draws the pages.
OpenOne release of the key to one signed-in device, logged with an open ID.

2The sealed file

A JWE (RFC 7516) in compact serialization: five base64url parts separated by dots.

BASE64URL(header) . "" . BASE64URL(iv) . BASE64URL(ciphertext) . BASE64URL(tag)

header: {"alg":"dir", "enc":"A256GCM", "zip":"DEF", "kid":"sample-packet",
         "typ":"alpq-sealed-doc", "cty":"application/alpq-pages+json",
         "iss":"https://hackthis.alpq.us"}

The issuer MUST generate a fresh key and a fresh 96-bit IV for every document, MUST NOT put the key in the file, and SHOULD keep it in storage that only the key-release service can read.

3Pages as drawings

The payload is JSON: {"v":"0.1", "title":"…", "pages":[{"w":612, "h":792, "svg":"…"}]}. Each page is an SVG in which every letter has been converted to its outline, so the file contains shapes and no text.

4Opening a document

  1. The reader reads the header and checks it (section 5). Nothing is sent anywhere before this check passes.
  2. If the person isn't signed in, the reader holds the file, asks them to sign in, and continues after sign-in.
  3. The reader calls POST /api/doc/open with {"id": kid}, signed by the device key and carrying the session, as every request in the QR login spec.
  4. The server checks the session belongs to that device key, records the open (user, device, time, rough location, open ID, running count) and returns the key with the details for the watermark.
  5. The reader decrypts in memory, decompresses, draws each page onto a canvas, and stamps the watermark into the picture.

Opens are rate-limited per device key (20 a minute in the test site). Revoking a person's access, or deleting a document's key, makes every copy they hold unreadable from then on.

5Reader rules

A reader MUST:

  1. Accept only files with exactly five parts, typ: alpq-sealed-doc and a valid kid.
  2. Open only files whose iss is its own site address, or that have no iss. It MUST NOT follow an address a file names. A file can be crafted by anyone; trusting its address would let a fake site collect sign-ins.
  3. Refuse to show anything when decryption fails, and say the file was changed or damaged.
  4. Draw pages as pictures only, with no text layer, and stamp each page with the viewer, the time and the open ID: a light diagonal pattern and a footer line.
  5. Show a notice naming who opened the document, on which device and when, and asking them not to share it.

A reader SHOULD turn off printing, the context menu and dragging on the pages, and SHOULD clear the drawings when the document is closed or the person signs out. These are speed bumps, and the spec says so.

6Security considerations

ThreatDefense hereWhat remains
A copy is found, forwarded or publishedUnreadable without a key release; every release loggedNone for the file itself
A copied session tokenKey release needs the device key that owns the sessionA fully compromised device
Editing the file (header or body)The header is authenticated data; GCM refuses any change
A file pointing at a look-alike siteReader opens only its own iss; passkeys work only on the real site
Copying textNo text exists: letters are drawn shapesText recognition (OCR) on a screenshot
Screenshots and photosPer-viewer watermark points back to the sourceCropping or retyping
Reading the browser's memoryKey used once and dropped; drawings cleared on closeA person with developer tools during an open
Theft of the key storeKeys separate from files; storage readable only by the release serviceKeys at rest are not yet wrapped by a separate master key

7Privacy

8Known gaps and questions

  1. Server-side drawing. In 0.1 the browser receives the page drawings. Rendering on the server and streaming only what's on screen would keep even the shapes off the device.
  2. Shuffled shapes. Each letter is the same shape every time, so someone could build a "this shape is A" table once. Shuffling and slightly varying the shapes per open would make every open a fresh puzzle.
  3. Invisible fingerprint. A per-open variation in spacing or pixels, so a photo of a cropped page still identifies the source.
  4. Accessibility. Pictures are invisible to screen readers. An accessible copy on request, logged like any open, is needed, and is required by law in some cases.
  5. Per-document access lists. In 0.1 any signed-in test account can open the sample. Real use needs a list of who may open each document, and expiry dates.
  6. Key wrapping. Keys at rest should be wrapped by a master key in a key-management service.
  7. Opening from the desktop. As an installed web app, the reader could register .jwe files to open on double-click.

Questions for reviewers:

9Changes

VersionDateChange
0.12026-10-27First draft; demo on the test site, with drop-a-file reading.

10References