Skip to main content

Pycryptox

Post-quantum cryptography, plausible deniability, secure software, secure hardware, and more.

Pycryptox is a Python library that takes cryptographic engineering seriously. Every primitive choice, every wire format, every API decision is documented and motivated against a concrete threat model. The goal is not "encrypt this for me" — it is "protect this against the adversary I am actually worried about, today and after a quantum computer arrives."

import pycryptox as crx

keys = crx.blue.genkeys("2")
bundle = crx.blue.encrypt("2", keys["gpubkey"], xmsg="real message", ymsg="credible decoy")

# Same bundle, two recipients, two different plaintexts:
crx.blue.decrypt("2", keys["xprivkey"], bundle, slot="x")  # → "real message"
crx.blue.decrypt("2", keys["yprivkey"], bundle, slot="y")  # → "credible decoy"

# Under coercion, the user reveals only yprivkey. The adversary obtains the
# decoy, has no cryptographic way to prove the real message exists, and the
# real key is physically elsewhere on a separate device. This is BLUE.

What is in the box

Protocol What it does Primary use
PURPLE Password-based encryption with adjustable Argon2id strength Brain-only secrets you can recover from a passphrase alone
BLUE Deniable asymmetric encryption with plausible-deniability dual-channel Sensitive content where coercion is a realistic threat
RED Threshold encryption (t-of-n secret sharing) Distributed trust, recovery shares, multi-party access
YELLOW Steganography (placeholder, coming soon) Concealing the existence of a message itself
Keyx Self-contained key storage with two trust tiers (keys / ckeys) On-device persistence with physical separation of critical keys

All asymmetric work is post-quantum from day one: ML-KEM-512 (FIPS 203) via liboqs handles every key encapsulation, and ChaCha20-Poly1305 handles every symmetric step. No RSA, no ECC, no classical Diffie-Hellman.

Why a serious project

This is not a hobby toy. Pycryptox was designed for cases where getting the threat model wrong has real consequences: journalists protecting sources, activists under surveillance, custody of long-term secrets that must outlive today's cryptanalytic state. The library is honest about what it does and does not protect against — every protocol has a dedicated Me vs Opponent section in its documentation that walks through the attacks a competent adversary will try, the design decision that defeats each one, and the attacks that are explicitly out of scope.

The codebase reflects that posture:

  • Versioning is mandatory: every bundle carries its protocol version, every migration is explicit through update_bundle.
  • Old versions are frozen byte-for-byte after release. Cryptanalysis of a deployed version cannot be silently patched away.
  • Bundle structures are exhaustively documented down to the byte.
  • 264+ tests covering all protocols, Keyx storage, version dispatch, and error paths.

Feedback I am looking for

This library is maintained by a single person under the Cryptox identity, and I want serious feedback to improve it: cryptanalysis attempts on the protocols, threat-model holes, API criticism, documentation clarity, performance issues on real workloads. Send anything substantive to:

📧 z.e.pro@outlook.fr

I read everything. I will not always agree, but I will engage. The library is at its best when it is challenged.

Proposing features

If you have a use case Pycryptox does not yet cover, or a protocol idea that fits the project's posture (post-quantum, deniability-aware, explicit threat model), I am open to discussion. Same address: z.e.pro@outlook.fr. Please describe:

  1. The threat model (what is the adversary, what are their capabilities, what do they want)
  2. The use case (who needs this, in what context)
  3. The deniability / security properties you would expect

I will not implement features without a clear motivation, but a good motivation goes a long way.

Prerequisites

Pycryptox uses liboqs (via liboqs-python) for all ML-KEM-512 post-quantum operations. This dependency is not installed automatically because the current PyPI release of liboqs-python is broken — it must be installed from GitHub:

pip install git+https://github.com/open-quantum-safe/liboqs-python@0.12.0

This requires a C compiler, CMake, and Git. The first import oqs automatically downloads and compiles the liboqs C library (~2-5 min, one-time only). See the installation guide for platform-specific instructions.

Installation

pip install pycryptox

Documentation

📖 English · Français

Each protocol has its own document with cryptographic primitives, wire format, threat model (Me vs Opponent), API reference, complete examples, and version history.

Tests

🧪 Test suite — 269 tests covering all protocols and Keyx.

cd pycryptox/tests
python run_all.py

Acknowledgments

📜 See THANKS.md — Pycryptox builds on the work of Open Quantum Safe, PyCA, the Argon2 team, the EFF, and many others.

Credits

See CREDITS.md

License

MIT — see LICENSE.

Metadata

Release files for pycryptox 3.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pycryptox 3.0.1
File Size Uploaded Provenance Actions
pycryptox-3.0.1.tar.gz 78.0 kB Without provenance Details for pycryptox-3.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pycryptox 3.0.1
File Interpreter ABI Platform Actions
pycryptox-3.0.1-py3-none-any.whl Python 3 none any Details for pycryptox-3.0.1-py3-none-any.whl

Total release size: 163.9 kB

Release files / pycryptox-3.0.1.tar.gz

Download URL pycryptox-3.0.1.tar.gz
Size 78.0 kB
Tags Source
SHA-256 checksum
How to use checksums
08389ce5f099923be7bf1f1eb918e19c7296a976fb8a88ca1c7278dbc7bb1d19
BLAKE2b-256 checksum
How to use checksums
eb03c96e9ba1cd15b167b331e0794eb822389ad3ca8bc825276f2fb1cd55167c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / pycryptox-3.0.1-py3-none-any.whl

Download URL pycryptox-3.0.1-py3-none-any.whl
Size 85.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ecd53ad6cbbe70a0f5a6bb3d05a31eac5530d885c3d9f40335a90044a8d64de9
BLAKE2b-256 checksum
How to use checksums
bad567319c978fb79f9cb0438e1109cb020e333b9231360617ea4dc599538063
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Security for pycryptox 3.0.1

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page