Metadata-Version: 2.4
Name: pqbox
Version: 1.0.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Programming Language :: Rust
Classifier: Topic :: Security :: Cryptography
Classifier: Typing :: Typed
Summary: Post-quantum crypto toolkit: hybrid KEMs, sealed boxes, composite signatures, AEAD, KDF, hashing and Argon2id (Rust core)
Keywords: post-quantum,cryptography,ml-kem,ml-dsa,x-wing,sealed-box
Author: maxgfr
License-Expression: MIT
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://github.com/maxgfr/pqbox
Project-URL: Issues, https://github.com/maxgfr/pqbox/issues
Project-URL: Repository, https://github.com/maxgfr/pqbox

# pqbox (Python)

Python bindings of [pqbox](https://github.com/maxgfr/pqbox), a post-quantum crypto toolkit with a
Rust core that wraps RustCrypto crates. One `abi3` wheel per platform supports CPython 3.10 and later.

```sh
pip install pqbox
```

```python
import pqbox

# Sealed box to a hybrid ML-KEM-1024 + P-384 key (default suite "pqbox-max").
pk, sk = pqbox.kem_keygen()
box = pqbox.seal(pk, b"attack at dawn")
assert pqbox.open(sk, box) == b"attack at dawn"

# Composite ML-DSA-87 + ECDSA P-384 signature: both must verify.
spk, ssk = pqbox.sign_keygen()
sig = pqbox.sign(ssk, b"release v1.0")
assert pqbox.verify(spk, b"release v1.0", sig)

# Symmetric encryption, hashing, passwords.
key = pqbox.generate_key()
ct = pqbox.encrypt(key, b"data", aad=b"header")
assert pqbox.decrypt(key, ct, aad=b"header") == b"data"
digest = pqbox.blake3(b"data")
phc = pqbox.password_hash("correct horse battery staple")
assert pqbox.password_verify("correct horse battery staple", phc)
```

Suites: `"xwing"` (compat only), `"pqbox-max"` (default), `"pqbox-paranoid"` (adds Classic McEliece
and SLH-DSA; large keys; experimental, because `slh-dsa` is a release candidate). Errors raise
`pqbox.PqboxError` (a `ValueError`) with a `code` attribute.

The functions that read keys, ciphertexts, signatures or sealed boxes accept `"pqbox-max"` objects
only. Other suites must be allowed explicitly, or they raise `PqboxError` with code
`"SuiteNotAllowed"`:

```python
pk, sk = pqbox.kem_keygen("xwing")
box = pqbox.seal(pk, b"hi", allow_suites=["xwing"])
assert pqbox.open(sk, box, allow_suites=["xwing"]) == b"hi"
```

`encrypt` defaults to XChaCha20-Poly1305 (192-bit random nonce). With `algorithm="aes256gcm"` the
random nonce is 96 bits: encrypt at most about 2**32 messages under one key, then rotate it.

See the [main README](https://github.com/maxgfr/pqbox#readme) for the algorithms, the wire format
and the security notes.

