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.
Warning
4.0.0rc1 is a release candidate, a pre-release. The envelope format,
the public API, the command line, and the JSON documents are frozen for
4.0. It is not independently audited, and it is under public review for
at least 60 days before 4.0.0. Do not protect production data with it yet.
Install it with
pip install --pre cryptography-suite; version 3.0.0 on PyPI is the
retired v3 educational toolkit and is unrelated to this API.
from cryptography_suite import EncryptionContext, Policy, Protector
from cryptography_suite.providers.hpke import HpkeRecipientProvider, generate_private_key
provider = HpkeRecipientProvider()
key = provider.add_identity("invoices", generate_private_key())
protector = Protector(provider=provider, policy=Policy(), primary_key=key)
context = EncryptionContext({"tenant": "acme"}, purpose="invoices")
envelope = protector.seal(b"confidential", context=context)
assert protector.open(envelope, context=context) == b"confidential"
Start with the quick start, then connect a key service. The design is recorded in the RFCs and the architecture documents, listed in the sidebar.
Getting started
Guides
- Key services
- Rotation and recovery
- Streaming and range reads
- Post-quantum protection
- Quorum recovery
- Multi-tenant data and key-service cost
- Audit and observability
- Policies
- COSE-HPKE
- Command line
- JavaScript and other languages
- Custom providers
- Production checklist
- Incident runbooks
- Migrating from version 3
Reference
Security