pqbox 1.1.1 → 1.2.1
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 +53 -5
- package/dist/generated/wasm-bytes.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -48,7 +48,8 @@ cargo feature, off by default (`cargo add pqbox --features paranoid`,
|
|
|
48
48
|
`cargo install --locked pqbox-cli --features paranoid`); without it, paranoid objects are refused with
|
|
49
49
|
`SuiteNotEnabled`. The Python wheels and the npm package include it: it adds about 66 KB to a
|
|
50
50
|
wheel (542 KB to 608 KB, macOS arm64) and about 67 KB to the WebAssembly module (801 KB to 868 KB
|
|
51
|
-
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).
|
|
52
53
|
|
|
53
54
|
#### Classic McEliece: not recommended for new keys
|
|
54
55
|
|
|
@@ -153,10 +154,10 @@ XChaCha20-Poly1305 62 µs, AES-256-GCM 14 µs, SHA-256 20 µs, SHA3-256 59 µs,
|
|
|
153
154
|
## Install
|
|
154
155
|
|
|
155
156
|
```sh
|
|
156
|
-
cargo add pqbox # Rust library
|
|
157
|
-
cargo install --locked pqbox-cli # `pqbox` command (
|
|
158
|
-
pip install pqbox # Python ≥ 3.10
|
|
159
|
-
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
|
|
160
161
|
```
|
|
161
162
|
|
|
162
163
|
**Build options.** The CLI binaries, the wheels and the npm package are built with the
|
|
@@ -184,6 +185,52 @@ has a signed build provenance attestation. Check a download with the GitHub CLI
|
|
|
184
185
|
gh attestation verify pqbox-aarch64-apple-darwin -R maxgfr/pqbox
|
|
185
186
|
```
|
|
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
|
+
|
|
187
234
|
## Examples
|
|
188
235
|
|
|
189
236
|
### Rust
|
|
@@ -346,6 +393,7 @@ is refused. The body layouts are documented in [`format.rs`](crates/pqbox-core/s
|
|
|
346
393
|
- Property tests (proptest), cargo-fuzz targets for every parser plus round trips, and criterion benches.
|
|
347
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.
|
|
348
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`.
|
|
349
397
|
|
|
350
398
|
## Security notes
|
|
351
399
|
|