pqbox 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -14,6 +14,10 @@ wire format.
14
14
  - **Python:** package `pqbox` on PyPI, built with PyO3 (abi3, Python ≥ 3.10).
15
15
  - **JavaScript / TypeScript:** package `pqbox` on npm, built with WebAssembly (Node ≥ 20 and browsers, ESM, synchronous API).
16
16
 
17
+ Website: <https://maxgfr.github.io/pqbox/>. Applications that use pqbox follow one integration
18
+ guide, [`docs/INTEGRATION.md`](docs/INTEGRATION.md): which function for which job, labels and
19
+ format versions, key storage, and an audit checklist.
20
+
17
21
  ## Suites
18
22
 
19
23
  Every key, ciphertext, sealed box and signature records its suite in its header, so objects from
@@ -22,7 +26,7 @@ different suites can never be mixed.
22
26
  | Id | Name | KEM | Signature | Use it for |
23
27
  |---|---|---|---|---|
24
28
  | `0x02` | **`pqbox-max`** (default) | ML-KEM-1024 + ECDH P-384 | ML-DSA-87 + ECDSA P-384 (SHA-384) | Everything, unless you have a reason below |
25
- | `0x03` | `pqbox-paranoid` (experimental) | ML-KEM-1024 + Classic McEliece 8192128 + ECDH P-384 | ML-DSA-87 + SLH-DSA-SHAKE-256s + ECDSA P-384 | Long-term archives and secrets meant to last decades, where size and speed do not matter |
29
+ | `0x03` | `pqbox-paranoid` (experimental, not recommended for new keys) | ML-KEM-1024 + Classic McEliece 8192128 + ECDH P-384 | ML-DSA-87 + SLH-DSA-SHAKE-256s + ECDSA P-384 | Reading and using existing paranoid keys and archives. Not for new keys: see [Classic McEliece](#classic-mceliece-not-recommended-for-new-keys) |
26
30
  | `0x01` | `xwing` (compat only) | X-Wing (ML-KEM-768 + X25519) | ML-DSA-65 + Ed25519 | Interop with X-Wing tooling such as hush. Never the default |
27
31
 
28
32
  **Suite policy.** The functions that read keys, ciphertexts, signatures and sealed boxes accept
@@ -41,10 +45,28 @@ Key generation takes the suite by name and needs no policy.
41
45
  **The `paranoid` feature.** `pqbox-paranoid` is **experimental**: its SLH-DSA half comes from
42
46
  `slh-dsa` 0.2.0-rc.5, a release candidate. The Rust crates compile it only with the `paranoid`
43
47
  cargo feature, off by default (`cargo add pqbox --features paranoid`,
44
- `cargo install pqbox-cli --features paranoid`); without it, paranoid objects are refused with
48
+ `cargo install --locked pqbox-cli --features paranoid`); without it, paranoid objects are refused with
45
49
  `SuiteNotEnabled`. The Python wheels and the npm package include it: it adds about 66 KB to a
46
50
  wheel (542 KB to 608 KB, macOS arm64) and about 67 KB to the WebAssembly module (801 KB to 868 KB
47
- before wasm-bindgen).
51
+ before wasm-bindgen). The other suites and Argon2id have cargo features too, on by default: see
52
+ [Choosing features](#choosing-features).
53
+
54
+ #### Classic McEliece: not recommended for new keys
55
+
56
+ BSI's [Notes on recent developments concerning Classic McEliece](https://www.bsi.bund.de/SharedDocs/Downloads/EN/BSI/Crypto/Notes_Classic_McEliece.html)
57
+ (1 October 2026) say Classic McEliece should no longer be used in new developments. Structural
58
+ attacks have improved fast in 2026, among them a quasipolynomial distinguisher with a heuristic key
59
+ recovery ([ePrint 2026/1630](https://eprint.iacr.org/2026/1630)) and an improved heuristic key
60
+ recovery ([ePrint 2026/1984](https://eprint.iacr.org/2026/1984)). None is practical against the
61
+ recommended parameter sets, and BSI expects further progress. For pqbox:
62
+
63
+ - `pqbox-paranoid` objects stay readable and usable, and the format does not change.
64
+ - Do not create new `pqbox-paranoid` KEM keys: use `pqbox-max`.
65
+ - The paranoid KEM is still a hybrid: its shared secret holds as long as ML-KEM-1024 or P-384
66
+ holds. What Classic McEliece no longer reliably adds is protection against a break of lattices.
67
+ The paranoid signatures (SLH-DSA) are not affected.
68
+ - Replacing Classic McEliece with HQC or FrodoKEM, which BSI recommends instead, would change the
69
+ bytes, so it would need a new suite id. The `0x03` suite stays as it is.
48
70
 
49
71
  **Hybrid rationale.** A hybrid stays secure as long as one of its components holds. KEM shared
50
72
  secrets go through a combiner, so recovering the session key means breaking every component.
@@ -57,8 +79,10 @@ A composite signature verifies only if every component signature verifies.
57
79
  keeps as an interim choice. That advisory lists elliptic curves other than P-384/P-521, and
58
80
  EdDSA, among the algorithms to inventory and replace. Some cryptographers read it as a sign that
59
81
  256-bit curves may be weaker than believed. The advisory itself does not say they are broken.
60
- - `pqbox-paranoid` also survives a break of lattice cryptography. Classic McEliece (code-based) and
61
- SLH-DSA (hash-based) do not rely on lattices.
82
+ - `pqbox-paranoid` was meant to also survive a break of lattice cryptography: Classic McEliece
83
+ (code-based) and SLH-DSA (hash-based) do not rely on lattices. Recent attacks on Classic McEliece
84
+ weaken that for its KEM (see [above](#classic-mceliece-not-recommended-for-new-keys)); its
85
+ signatures are not affected.
62
86
  - `xwing` exists only for compatibility. Its classical half is a 256-bit curve, so treat its
63
87
  security as resting entirely on ML-KEM-768 and ML-DSA-65.
64
88
 
@@ -88,14 +112,14 @@ order (signing normalizes it; the malleable `n - s` twin is refused).
88
112
 
89
113
  | Purpose | Algorithm | Crate |
90
114
  |---|---|---|
91
- | KEM | ML-KEM-1024 (FIPS 203), in `pqbox-max` and `pqbox-paranoid` | `libcrux-ml-kem` 0.0.12 (portable build) |
115
+ | KEM | ML-KEM-1024 (FIPS 203), in `pqbox-max` and `pqbox-paranoid` | `libcrux-ml-kem` 0.0.12 (portable build, SIMD code not compiled) |
92
116
  | KEM | ML-KEM-768 (FIPS 203), inside X-Wing | `ml-kem` 0.3.4 |
93
117
  | KEM | X-Wing (draft-connolly-cfrg-xwing-kem) | `x-wing` 0.1.1 |
94
118
  | KEM | Classic McEliece 8192128 | `classic-mceliece-rust` 3.1.0 |
95
- | KEM (classical half) | ECDH P-384, X25519 | `p384` 0.14.0, `x25519-dalek` 3.0.0 |
119
+ | KEM (classical half) | ECDH P-384, X25519 | `p384` 0.14.0, `x25519-dalek` 3.0.0 (both with fiat-crypto field arithmetic) |
96
120
  | Signature | ML-DSA-65 / ML-DSA-87 (FIPS 204) | `ml-dsa` 0.1.2 |
97
121
  | Signature | SLH-DSA-SHAKE-256s (FIPS 205), `paranoid` feature only, experimental | `slh-dsa` 0.2.0-rc.5 (release candidate) |
98
- | Signature (classical half) | ECDSA P-384 with SHA-384, Ed25519 | `p384` 0.14.0, `ed25519-dalek` 3.0.0 |
122
+ | Signature (classical half) | ECDSA P-384 with SHA-384, Ed25519 | `p384` 0.14.0, `ed25519-dalek` 3.0.0 (both with fiat-crypto field arithmetic) |
99
123
  | Sealed box | suite KEM + HKDF-SHA-256 + XChaCha20-Poly1305 | |
100
124
  | AEAD | XChaCha20-Poly1305 (default), AES-256-GCM | `chacha20poly1305` 0.11.0, `aes-gcm` 0.11.1 |
101
125
  | KDF / MAC | HKDF-SHA-256, HMAC-SHA-256 | `hkdf` 0.13.0, `hmac` 0.13.0 |
@@ -130,16 +154,83 @@ XChaCha20-Poly1305 62 µs, AES-256-GCM 14 µs, SHA-256 20 µs, SHA3-256 59 µs,
130
154
  ## Install
131
155
 
132
156
  ```sh
133
- cargo add pqbox # Rust library (add `--features paranoid` for pqbox-paranoid)
134
- cargo install pqbox-cli # `pqbox` command (same feature)
135
- pip install pqbox # Python ≥ 3.10
136
- npm install pqbox # Node ≥ 20, browsers
157
+ cargo add pqbox # Rust library: every suite but pqbox-paranoid (see Choosing features)
158
+ cargo install --locked pqbox-cli # `pqbox` command (add `--features paranoid` for pqbox-paranoid)
159
+ pip install pqbox # Python ≥ 3.10, every suite
160
+ npm install pqbox # Node ≥ 20, browsers, every suite
161
+ ```
162
+
163
+ **Build options.** The CLI binaries, the wheels and the npm package are built with the
164
+ repository's [`.cargo/config.toml`](.cargo/config.toml): P-384 and Curve25519 use the formally
165
+ verified field arithmetic synthesized by [fiat-crypto](https://github.com/mit-plv/fiat-crypto)
166
+ (the same bytes as the default backends, checked by the frozen KATs), and only the portable code
167
+ of libcrux is compiled (see [docs/BACKENDS.md](docs/BACKENDS.md)). `cargo install`, `cargo add`
168
+ and a build from the Python sdist do not read that file; to build the same way, set:
169
+
170
+ ```sh
171
+ RUSTFLAGS='--cfg p384_backend="fiat" --cfg curve25519_dalek_backend="fiat"' \
172
+ LIBCRUX_DISABLE_SIMD128=1 LIBCRUX_DISABLE_SIMD256=1 \
173
+ cargo install --locked pqbox-cli
137
174
  ```
138
175
 
139
176
  Each GitHub release also carries prebuilt `pqbox` binaries, `pqbox-<target>` for macOS (arm64,
140
177
  x86_64) and Linux (arm64, x86_64), with a `SHA256SUMS` file. `pqbox --version` reports the release,
141
178
  and `pqbox selftest` checks the installed binary offline.
142
179
 
180
+ Every release asset made after v1.1.0 (binaries, wheels, sdist, npm tarball and `SHA256SUMS`) also
181
+ has a signed build provenance attestation. Check a download with the GitHub CLI (see
182
+ [RELEASING.md](RELEASING.md#verify-a-release)):
183
+
184
+ ```sh
185
+ gh attestation verify pqbox-aarch64-apple-darwin -R maxgfr/pqbox
186
+ ```
187
+
188
+ ### Choosing features
189
+
190
+ The `pqbox` crate compiles each suite, and Argon2id, behind a cargo feature, so an application
191
+ builds and audits only the crates it uses. The default is everything except `pqbox-paranoid`,
192
+ which is what every release before 1.2 compiled: `pqbox = "1.2"` behaves as before.
193
+
194
+ | Feature | Default | Adds | Crates it brings in |
195
+ |---|---|---|---|
196
+ | `suite-max` | yes | `pqbox-max` sealed boxes, KEM and signatures | `libcrux-ml-kem`, `ml-dsa`, `p384` |
197
+ | `suite-xwing` | yes | `xwing` (compat) sealed boxes, KEM and signatures | `x-wing` (`ml-kem`), `ml-dsa`, `x25519-dalek`, `ed25519-dalek` |
198
+ | `password` | yes | `password`: Argon2id hashing and key derivation | `argon2` |
199
+ | `paranoid` | no | `pqbox-paranoid`; implies `suite-max` | `classic-mceliece-rust`, `slh-dsa` |
200
+
201
+ Always compiled, whatever the features: `aead` (XChaCha20-Poly1305, AES-256-GCM), `kdf`
202
+ (HKDF-SHA-256, HMAC-SHA-256), `hash` (SHA-256, SHA3-256, BLAKE3), `format`, `ct_eq` and `Error`.
203
+ The suite modules (`kem`, `seal`, `sign`, `suite`, `hazmat`) need `suite-max` or `suite-xwing`.
204
+
205
+ Turn the default off and list what the application uses:
206
+
207
+ ```toml
208
+ [dependencies]
209
+ # Password-protected files: Argon2id + XChaCha20-Poly1305 + SHA-256, no post-quantum crate.
210
+ pqbox = { version = "1.2", default-features = false, features = ["password"] }
211
+
212
+ # Sealed boxes and signatures in pqbox-max, plus Argon2id, without the xwing suite.
213
+ pqbox = { version = "1.2", default-features = false, features = ["suite-max", "password"] }
214
+ ```
215
+
216
+ Measured with `cargo tree -e normal` (pqbox itself included): 44 crates with no feature, 49 with
217
+ `password`, 71 with `suite-max`, 57 with `suite-xwing`, 83 with the default and 99 with
218
+ `paranoid` on top. CI checks that the `password`-only tree has no post-quantum crate, no curve and
219
+ no libcrux (so none of its build tooling, such as `proc-macro-error2`). It also runs clippy on
220
+ every combination of features, natively and for `wasm32-unknown-unknown`, and the tests with no
221
+ feature, each feature alone, the default and all features.
222
+
223
+ Features change what is compiled, never the bytes: a build reads and writes exactly the objects
224
+ of a full build for the suites it has. An object of a suite that is compiled out keeps its suite
225
+ id and is refused with `SuiteNotEnabled` (``suite xwing is not enabled in this build (cargo
226
+ feature `suite-xwing`)``), whatever the `SuitePolicy`; it is never read as another suite. Without
227
+ `suite-max`, `SuitePolicy::DEFAULT` accepts no suite at all (`xwing` still has to be allowed
228
+ explicitly), and `Suite` has no `Default`.
229
+
230
+ The CLI, the Python wheels and the npm package are full distributions and keep every default
231
+ feature. The wheels and the npm package also include `pqbox-paranoid`; the CLI includes it when
232
+ built with `--features paranoid`.
233
+
143
234
  ## Examples
144
235
 
145
236
  ### Rust
@@ -302,6 +393,7 @@ is refused. The body layouts are documented in [`format.rs`](crates/pqbox-core/s
302
393
  - Property tests (proptest), cargo-fuzz targets for every parser plus round trips, and criterion benches.
303
394
  - Instruction-count benchmarks ([gungraun](https://github.com/gungraun/gungraun), under Callgrind) of `pqbox-max` and the AEADs: every pull request is measured against its base branch, and CI fails if any benchmark runs more than 10% more instructions.
304
395
  - A cross-language interop matrix ([`scripts/interop.sh`](scripts/interop.sh)): keys from Rust, Python and JavaScript seal and sign for each other, in every suite.
396
+ - A cargo feature matrix ([cargo-hack](https://github.com/taiki-e/cargo-hack)): clippy on every combination of the crate's features, natively and for WebAssembly, and the tests with each feature alone; objects of a suite that is compiled out must be refused with `SuiteNotEnabled`.
305
397
 
306
398
  ## Security notes
307
399
 
@@ -344,7 +436,7 @@ is refused. The body layouts are documented in [`format.rs`](crates/pqbox-core/s
344
436
  ## Upstream
345
437
 
346
438
  pqbox stands on these projects. The versions are pinned in the `Cargo.toml` files (exactly, with
347
- `=`, for every cryptographic crate); Dependabot proposes updates, and a weekly
439
+ `=`, for every cryptographic crate); Dependabot proposes updates, and a daily
348
440
  [upstream watch](.github/workflows/upstream-watch.yml) reports advisories, new releases and
349
441
  alternatives ([`scripts/watch/`](scripts/watch)). [`docs/BACKENDS.md`](docs/BACKENDS.md) compares
350
442
  the backends with the alternatives (RustCrypto, libcrux and AWS-LC), and explains the move of