Threat model
The goal
Section titled “The goal”Whoever records encrypted traffic today may be able to decrypt it in some years (harvest now, decrypt later). pq-seal puts a second layer around individual, especially valuable values, based on a post-quantum scheme, with keys that live only briefly. Everything else in the connection stays as protected as before, including session cookies and tokens.
What it protects against
Section titled “What it protects against”- Passive recording of sealed values, even if TLS is broken later.
- A proxy that only reads or logs and does not change traffic. It does not see sealed values in plain text.
- Replay of a recorded message.
- Swapping messages between purposes, through the context.
- The exact length of short values. Messages are padded to 256 bytes, only the order of magnitude shows.
What it does not protect against
Section titled “What it does not protect against”- An attacker who can change traffic. That includes a TLS-terminating proxy. It delivers the code and the public keys and can replace both without anyone noticing. Authenticity still comes from TLS alone.
- XSS. Malicious code on the page reads the input before it is encrypted.
- A compromised server. It sees the data after opening.
- Intercepted credentials. Whoever reads a session cookie or token can request, for their own key, the data that session may see.
- Missing access control. The server seals for any key it receives.
- False senders. Anyone can make messages with the public key.
Opensays nothing about who sent a message.
Further limits
Section titled “Further limits”- Go does not overwrite freed memory. A key or plaintext can stay in memory until it is reused, also in the memory of the WebAssembly module, and reach swap, dumps or snapshots from there. Deletion is therefore best effort.
- JavaScript holds passwords as strings, which cannot be erased.
- The identifier of the hybrid KEM comes from a draft. That is why every format carries a version.
- The hashes in the file names serve the cache and are not verified.
- pq-seal has not had an external security audit yet.
Scheme
Section titled “Scheme”HPKE (RFC 9180) from the Go standard library with MLKEM768X25519, HKDF-SHA256 and ChaCha20-Poly1305. An attacker has to break both X25519 and ML-KEM-768. AES-GCM is ruled out because it runs without hardware support in WebAssembly and is not constant time there.
Signatures
Section titled “Signatures”Package pqsign is a part of its own with its own goal: whoever can change what the server stores shall not be able to make valid data. The private key lies encrypted on the server and is only open inside a browser’s worker.
- Protects against writing to the database, even with every key the server has, and against strangers trying passphrases: the server hands out the wrapped key only for the proof
auth. - Does not protect against whoever controls the delivered code. They can read the passphrase. Nor against a weak passphrase once someone holds the wrapped key: Argon2id (64 MiB, 3 passes) makes each guess expensive, not impossible.
- A wrapped key that asks for less work than the default is refused before the passphrase is touched.
- Scheme: ML-DSA-65 (FIPS 204) from the Go standard library, Argon2id and XChaCha20-Poly1305 from
golang.org/x/crypto.
More under Signatures.