quantum-safe-py
Post-quantum cryptography for Python: hybrid key exchange, hybrid signatures, encrypted envelopes, a migration toolkit and a CI-ready audit scanner in one library.
What you get
- Hybrid by default:
X25519+ML-KEM-768key exchange andEd25519+ML-DSA-65signatures, with pure ML-KEM, ML-DSA, SLH-DSA (all 12 sets) and X-Wing available. - Envelopes: KEM + AES-256-GCM in one self-describing, CBOR-encoded message, plus a streaming format for large files.
- Standards formats: RFC 9964 JOSE/JWT and COSE_Sign1 for ML-DSA, FIPS 204 native-context signatures.
- Migration: scan code for classical crypto, upgrade existing keys to hybrid, track progress per key.
- Audit: SARIF and JSON reports, a CycloneDX Cryptographic Bill of Materials, CNSA 2.0 parameter reporting and enforcement.
- Same bytes as TypeScript: keys, ciphertexts and signatures are byte-compatible with quantum-safe-ts.
- Tested against NIST vectors: 638 of 638 runnable ACVP known-answer cases pass.
Install
pip install quantum-safe-py # classical primitives, formats, scanner, audit
pip install 'quantum-safe-py[liboqs]' # ML-KEM, ML-DSA, SLH-DSA through liboqs
pip install 'quantum-safe-py[pyca]' # ML-KEM and ML-DSA through cryptography>=48 (no compiler)
Python 3.10 or later. Prebuilt wheels carry liboqs; the other extras (lms, rustcrypto) are in Installation.
Quick start
from quantum_safe import HybridKEM, HybridSign
from quantum_safe.protocols import Envelope
# Key exchange: hybrid X25519 + ML-KEM-768
kem = HybridKEM()
kp = kem.generate_keypair()
ct, shared_secret = kem.encapsulate(kp.public)
assert shared_secret == kem.decapsulate(kp.secret, ct)
# Encrypt to a public key: KEM + AES-256-GCM, and state the AAD you expect on open
sealed = Envelope.seal(b"plaintext", kp.public, aad=b"record-42")
plain = Envelope.open(sealed, kp.secret, expected_aad=b"record-42")
# Sign: hybrid Ed25519 + ML-DSA-65, and state the context you expect on verify
signer = HybridSign()
sk = signer.generate_keypair()
sm = signer.sign(b"important document", sk.secret, context=b"myapp-v1")
signer.verify(sm, sk.public, context=b"myapp-v1") # raises VerificationError if invalid
Scan, then migrate
qs-audit scan ./src # find classical crypto, with fix hints
qs-audit scan ./src --format sarif --output audit.sarif # GitHub Code Scanning
qs-audit cbom ./src --output cbom.json # CycloneDX Cryptographic Bill of Materials
qs-audit cnsa2 # CNSA 2.0 parameter-set report
qs-migrate status # migration progress per key
Documentation
Everything else is on the documentation site: quantum-safe-py.readthedocs.io.
| If you want to... | Read |
|---|---|
| Try it in five minutes | Quick start |
| Pick the right algorithm, format and token | Choosing what to use |
| Copy a working recipe (encrypt a file, sign a release, ...) | Cookbook |
| Understand keys, contexts, hedging and formats | Concepts |
| Encrypt, sign, issue tokens | KEM, Signatures, Protocols |
| Migrate keys and track progress | Migration |
| Audit a codebase, produce a CBOM, check CNSA 2.0 | Audit, CNSA 2.0 and standards |
| Exchange data with Node.js and browsers | Interoperability |
| Upgrade from an earlier release | Upgrading to 1.0 |
| Threat model, design notes, report a vulnerability | Security |
| Benchmarks and methodology | Benchmarks |
| Check the benchmark figures yourself | Raw samples, checksums and steps: attached to the 1.0.0 release |
| What changed in each release / what is planned | CHANGELOG, Roadmap |
Cite this work
@article{shaw2026quantumsafe,
title = {quantum-safe: Bridging the Post-Quantum Production Gap with a
Hybrid-by-Default Python Cryptography Library},
author = {Shaw, Animesh},
journal = {arXiv preprint arXiv:2605.17061},
year = {2026},
note = {v2},
url = {https://arxiv.org/abs/2605.17061}
}
To cite the software itself, use the Zenodo concept DOI 10.5281/zenodo.23008259, which resolves to the latest release. A machine-readable CITATION.cff is included for GitHub's "Cite this repository" button.
Contributing and license
See CONTRIBUTING.md. Apache 2.0, see LICENSE.
Built on Open Quantum Safe / liboqs, PyCA cryptography and the NIST PQC standards (FIPS 203, 204, 205).
Metadata
Release files for quantum-safe-py 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| quantum_safe_py-1.0.0.tar.gz | 1.4 MB | Without provenance | Details |
Built distributions (wheels)
Total release size: 237.7 MB
Release files / quantum_safe_py-1.0.0.tar.gz
| Download URL | quantum_safe_py-1.0.0.tar.gz |
|---|---|
| Size | 1.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
495ed448f5bf6efb6669fe52f7ae1bf04ce03789eafc3f631f82a93309ffb6bd
|
|
BLAKE2b-256 checksum How to use checksums |
0893e0814db4c974536eed6860da7e89110511e5fef58ee4b540c71c6b6b2d28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / quantum_safe_py-1.0.0-cp312-cp312-win_amd64.whl
| Download URL | quantum_safe_py-1.0.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 4.1 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
db347af0cbc07a34afbdcd06b6be7677b6b766f7f6233fcc13e7dc7a57647ace
|
|
BLAKE2b-256 checksum How to use checksums |
1344531878aa8d85c2ee585e9a076a35bde22c38f6f59b5fda35230a9af7888e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / quantum_safe_py-1.0.0-cp312-cp312-manylinux_2_28_x86_64.whl
| Download URL | quantum_safe_py-1.0.0-cp312-cp312-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 59.7 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
0eee74874d2de541cb7533e109f5513350f32b88a98e9e76db0bc001670155a4
|
|
BLAKE2b-256 checksum How to use checksums |
3e6c514f85afe5b31341e838943784220db97a9956923fdfc5e932db61dee079
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / quantum_safe_py-1.0.0-cp312-cp312-macosx_14_0_arm64.whl
| Download URL | quantum_safe_py-1.0.0-cp312-cp312-macosx_14_0_arm64.whl |
|---|---|
| Size | 15.0 MB |
| Tags | CPython 3.12 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
1e9eebfad7f9e8ca86dad02118ab30803488eaea553f2f668273d1ee8b70386c
|
|
BLAKE2b-256 checksum How to use checksums |
4764c7bc18103c61eb0a97fd4d02680f3001c1196b0719ab5fd5fc419edb7b6b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / quantum_safe_py-1.0.0-cp311-cp311-win_amd64.whl
| Download URL | quantum_safe_py-1.0.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 4.1 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
f0e8c0df7deb43f0b59cfcce97233cf1db7d702a884f192d3719f0a4c536eede
|
|
BLAKE2b-256 checksum How to use checksums |
1256d9acebc63816b98b2b20fe52dccebe6abb0e0bf01469e9e0af572626679f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / quantum_safe_py-1.0.0-cp311-cp311-manylinux_2_28_x86_64.whl
| Download URL | quantum_safe_py-1.0.0-cp311-cp311-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 59.7 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
5a9e4846ccf0465570943c1e21bbffb8dc36e7aa69fefbc9e6b5e1d1307d5340
|
|
BLAKE2b-256 checksum How to use checksums |
acc2d2f8d617a7a64df6f1c802a528bb45526e1d2355911be9d5535d55e44410
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / quantum_safe_py-1.0.0-cp311-cp311-macosx_14_0_arm64.whl
| Download URL | quantum_safe_py-1.0.0-cp311-cp311-macosx_14_0_arm64.whl |
|---|---|
| Size | 15.0 MB |
| Tags | CPython 3.11 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
1d78ef715c3b922c47518934669d1fc827c483e3e1f40de330a73f5cec17569c
|
|
BLAKE2b-256 checksum How to use checksums |
29d9ac2e078c327ca035f9af49c4d1b09f29534478f9a851926506e1817a9751
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / quantum_safe_py-1.0.0-cp310-cp310-win_amd64.whl
| Download URL | quantum_safe_py-1.0.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 4.1 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
a6c29410ef1132593bee68e82a5d2ba2a817de58469a31e31467be08f75cb631
|
|
BLAKE2b-256 checksum How to use checksums |
f867f6ec95900ef5e0dd95309090898002a51235d59a9add97a7c7444ad6e0ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / quantum_safe_py-1.0.0-cp310-cp310-manylinux_2_28_x86_64.whl
| Download URL | quantum_safe_py-1.0.0-cp310-cp310-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 59.7 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
043913ee9e953396c24127b002827e82f49cc4bdbbc1ee42840d708804b83ebe
|
|
BLAKE2b-256 checksum How to use checksums |
2f3ddc79f4e4aca203999620c6bdaf545c674ec0d5d89f62d522973e693fa28e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / quantum_safe_py-1.0.0-cp310-cp310-macosx_14_0_arm64.whl
| Download URL | quantum_safe_py-1.0.0-cp310-cp310-macosx_14_0_arm64.whl |
|---|---|
| Size | 15.0 MB |
| Tags | CPython 3.10 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
28c3542685bddea79a9ff6469186056d29b6b11124f79f4b80c0d32218cd22ca
|
|
BLAKE2b-256 checksum How to use checksums |
41bc155055ebb48c7be8cfd5355ab4b72a67f826b58788a2e57623c7a89b5f1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for quantum-safe-py 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.