This release is a pre-release and may not be stable for production use.
Cryptography Suite
Policy-driven envelope encryption for Python. One small API seals data under a fresh key, wraps that key for every recipient you configure (a cloud key service, an offline escrow key, a quorum of custodians), binds the result to its context, and opens it only when every byte and every binding verifies.
Status: 4.0.0b2 is a beta pre-release. It is not independently audited, and the envelope format may change before the first release candidate. Do not protect production data with it yet. Install it with
pip install --pre cryptography-suite; without--pre, pip selects 3.0.0, the retired v3 educational toolkit, which is unrelated to this API.
Why
- No cryptographic decisions for the caller. No algorithms, key sizes, nonces, or KDFs to choose: AES-256-GCM under a fresh 256-bit key per envelope, with key commitment and a STREAM record construction.
- Your key service, your control. AWS KMS, Google Cloud KMS, Azure Key Vault and Managed HSM, and HashiCorp Vault Transit, through clients you build. Keys never leave the service, and every wrap is bound to its envelope.
- Recoverable by design. Every envelope can carry several recipients: a second region, an offline escrow key, or a k-of-n quorum of custodians. Rotation rewraps in place and never drops one.
- Post-quantum ready. Hybrid ML-KEM recipients and an ML-DSA-signed audit trail, alongside classical keys, in the same format.
- Safe at any size. Streams in bounded memory, publishes output only after the last record verifies, and reads authenticated byte ranges of large objects without reading the rest.
- Built to be checked. A byte-level specification with test vectors, a 248-case conformance suite, an independent JavaScript implementation, 100% line and branch coverage, fuzzing, mutation testing, and a published threat model.
Install
git clone https://github.com/Psychevus/cryptography-suite.git
python -m pip install ./cryptography-suite
Python 3.11 or later. The core depends only on pyca/cryptography; each key-service integration is a separate distribution (installation).
Quick start
This runs as is, with a key held in the process:
from cryptography_suite import EncryptionContext, Policy, Protector
from cryptography_suite.providers.hpke import HpkeRecipientProvider, generate_private_key
identity = generate_private_key() # in production: a key-service key
provider = HpkeRecipientProvider()
key = provider.add_identity("invoices", identity)
protector = Protector(provider=provider, policy=Policy(), primary_key=key)
context = EncryptionContext({"tenant": "acme"}, purpose="invoice-archive")
envelope = protector.seal(b"invoice 2026-0042: 1,200 EUR", context=context)
assert protector.open(envelope, context=context) == b"invoice 2026-0042: 1,200 EUR"
The context is authenticated but never stored: an envelope sealed for one tenant cannot be opened as another's. Any change to the envelope's bytes, or a different context, raises a typed error with a stable code.
A production shape
A key-service primary key, an offline escrow key, an enterprise policy, and a signed audit trail:
from cryptography_suite import KeyRef, Policy, Protector
from cryptography_suite.providers.hpke import HpkeRecipientProvider, load_public_key_text
from cryptography_suite_aws_kms import PROVIDER_ID as AWS, AwsKmsProvider
escrow = HpkeRecipientProvider(provider_id="com.example.escrow")
escrow.add_recipient("break-glass", load_public_key_text(escrow_public_key))
protector = Protector(
providers=[AwsKmsProvider(kms_client), escrow],
policy=Policy.enterprise(approved_providers=[AWS, escrow.provider_id]),
primary_key=KeyRef(AWS, "alias/payments"),
additional_keys=[KeyRef(escrow.provider_id, "break-glass")],
audit_sink=audit_chain,
)
Every envelope is wrapped for both keys. If the KMS key is disabled or the
region is lost, the escrow key opens everything; when the KMS key rotates,
rewrap moves envelopes to the new version and keeps the escrow recipient.
Only keys you configure are trusted for opening, so an envelope made under
someone else's key is never accepted as yours.
Features
| Key services | AWS KMS, Google Cloud KMS (including ML-KEM and X-Wing keys), Azure Key Vault and Managed HSM, HashiCorp Vault Transit; your own with a conformance kit |
| Public-key recipients | HPKE (RFC 9180) with X25519, P-384, ML-KEM-768 + X25519, and ML-KEM-1024 + P-384; sealers hold only public keys |
| Recovery | Escrow keys, k-of-n quorum recovery in which no custodian's key moves, rewrap without re-encryption |
| Scale | Hierarchical keys: one key-service call per tenant key per cache period instead of one per envelope |
| Large data | Streaming up to 1 TiB, atomic file output, authenticated range reads |
| Audit | Secret-free events, a signed hash-chained trail (Ed25519, or Ed25519 with ML-DSA-65), OpenTelemetry metrics |
| Policy | Immutable policies with content-derived identifiers that only narrow when combined; a FIPS profile |
| Interoperability | COSE-HPKE messages and keys; a JavaScript implementation for browsers, Node.js, Deno, and edge runtimes |
| Command line | cryptosuite with atomic output, JSON status, and stable exit codes |
| From v3 | Verified migration of v3 encrypted files into v4 envelopes, without writing plaintext, and an inventory and policy-checked import of v3 keys |
Documentation
- Quick start and concepts
- Key services, with the permissions each operation needs
- Rotation and recovery, the production checklist, and the incident runbooks
- Support and compatibility and the release readiness report
- Errors, the envelope format, and runnable examples
The full documentation, with the API reference, is built from
docs/.
Assurance
What has been done, and what has not:
- The format is specified byte by byte, with test vectors checked by an independent reader, and a conformance suite that the Python and JavaScript implementations both pass.
- Every primitive is checked against Project Wycheproof, HPKE against the CFRG vectors, and COSE-HPKE against the draft's examples.
- CI enforces 100% line and branch coverage, combined across Linux, macOS, and Windows; tests every single-bit change and truncation of envelopes against every reader; and fuzzes every untrusted input weekly.
- An internal audit, including mutation testing, found and addressed twelve issues (RFC-0031). The threat model states each security claim with the tests that support it.
- No independent audit has been done yet. It is a release gate for 4.0.0 (proposed scope).
Report vulnerabilities privately, as described in SECURITY.md.
Contributing
See CONTRIBUTING.md. The design is recorded in RFCs, and changes are listed in the changelog.
License
MIT.
Metadata
Release files for cryptography-suite 4.0.0b2
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 | Actions |
|---|---|---|---|---|
| cryptography_suite-4.0.0b2.tar.gz | 134.4 kB | With provenance | Details for cryptography_suite-4.0.0b2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cryptography_suite-4.0.0b2-py3-none-any.whl | Python 3 | none | any | Details for cryptography_suite-4.0.0b2-py3-none-any.whl |
Total release size: 293.4 kB
Release files / cryptography_suite-4.0.0b2.tar.gz
| Download URL | cryptography_suite-4.0.0b2.tar.gz |
|---|---|
| Size | 134.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
78b8e28c68f315554d23664e6850975029cf1ba9261a8d4727dbadb6509662ef
|
|
BLAKE2b-256 checksum How to use checksums |
14864d0349822d3e64ddabb4bd8dac70ad97e8e4afd1d862d36a99af2bfda289
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logRelease files / cryptography_suite-4.0.0b2-py3-none-any.whl
| Download URL | cryptography_suite-4.0.0b2-py3-none-any.whl |
|---|---|
| Size | 159.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0911f3fabef8f5542e7ece9154693d6a672deb6b0c29b24d83bc06d1746234b2
|
|
BLAKE2b-256 checksum How to use checksums |
b00fdebd142662e50b3103414ba713deee02569999580c7c783ceef28526adc9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logSecurity for cryptography-suite 4.0.0b2
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for cryptography_suite-4.0.0b2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logA 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.