Docs / Security
Threat model
What pqlock protects, against whom, and what it deliberately leaves to the application.
01Adversaries and promises
| Adversary | Promise | Mechanism |
|---|---|---|
| Harvest now, decrypt later | Sealed data stays confidential | ML-KEM in every suite; hybrid suites hold if either half holds |
| Network or storage attacker who flips, truncates, splices or replays bytes | No plaintext from a modified envelope, no oracle | Header as AAD and in the KDF, commitment checked in constant time before decryption, one error type |
| Multi-key attacker | A ciphertext cannot open under two keys | 32-byte key commitment |
| Forger, classical or quantum | No valid signature, token or audit entry without the key | Composite signatures, both halves always verified |
| Downgrade attacker | Cannot select a weaker suite or algorithm | No negotiation: the suite comes from the bytes and must match the key; tokens accept only ML-DSA-65 |
| Malformed input | No crash, hang or undocumented exception | Strict parsers, fuzzed on every build |
| Local timing observer | pqlock's own compare and parse paths do not leak secrets | Constant-time commitment compare, branch-free base64url check, measured every build |
02Out of scope
- Engine bugs. pqlock inherits the security of OpenSSL, pyca
cryptographyand the Go standard library. NIST ACVP vectors run through each engine every build, but they are known-answer tests, not a proof. - A compromised host. Whoever reads process memory or the secret store has the keys.
- Side channels inside the engines such as cache, power and electromagnetic leaks.
- Trust in public keysets. Who to trust is the application's PKI decision.
- Metadata. Length, key id and suite are visible.
- Replay. Tokens and webhooks have replay protection; plain envelopes and signatures do not.
- Forward secrecy for stored data. A later key compromise opens everything sealed to that key, so rotate.
03Known residual risks
- ML-DSA and ECDSA signing and ML-KEM encapsulation use engine randomness; a broken random number generator weakens them.
- PQL-CNSA has no classical fallback if ML-KEM or ML-DSA is broken.
- Go's base64 decoder shows a small timing residual on decoded content, below the leak threshold.
04How it is tested
| Check | Scope |
|---|---|
| Spec vectors | 148 vectors, byte for byte, in all three SDKs |
| Cross-language matrix | 54 of 54 pairs: seal or sign in one SDK, open or verify in each other |
| NIST ACVP | Known-answer tests through each engine |
| Fuzzing | Every parser, every build |
| Timing | dudect-style tests on pqlock's compare and parse paths |
| End to end | 8 real applications deployed and run on every change |
pqlock v0.1.0 · unaudited preview · source of truth: spec/