Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

cryptography-suite-aws-kms

AWS Key Management Service provider for cryptography-suite, the policy-driven envelope encryption SDK. Pre-release; not independently audited.

Install

python -m pip install "cryptography-suite-aws-kms[boto3]"

Use

import boto3
from botocore.config import Config

from cryptography_suite import EncryptionContext, KeyRef, Policy, Protector
from cryptography_suite_aws_kms import PROVIDER_ID, AwsKmsProvider

kms = boto3.client(
    "kms",
    region_name="eu-west-1",
    config=Config(connect_timeout=3, read_timeout=5, retries={"total_max_attempts": 1}),
)
protector = Protector(
    provider=AwsKmsProvider(kms),
    policy=Policy.enterprise(approved_providers=[PROVIDER_ID]),
    primary_key=KeyRef(PROVIDER_ID, "alias/payments"),
    audit_sink=audit_sink,
)
context = EncryptionContext({"tenant": "acme"}, purpose="payments")
envelope = protector.seal(b"...", context=context)
plaintext = protector.open(envelope, context=context)

You build the boto3 client: region, credentials, endpoints, and retries are yours. The provider never reads credentials or the environment and does not import boto3 itself.

Keys and permissions

Item Value
Keys Symmetric encryption keys (SYMMETRIC_DEFAULT), named by key ID, key ARN, or alias.
Recorded version The key ARN. AWS rotates key material behind the same ARN, so automatic rotation needs no rewrap.
To seal kms:DescribeKey, kms:Encrypt
To open kms:Decrypt, and kms:DescribeKey when the trusted key is given by alias
Health check kms:ListKeys

Behaviour

  • Binding. Each wrap calls Encrypt with the encryption context {"cryptography-suite:binding": base64url(SHA-256(protected header))}. KMS authenticates it, so a wrapped key cannot be moved to another envelope, and CloudTrail links every key use to an envelope without revealing it. envelope_binding_context(envelope) computes the same context from a stored envelope, which finds the envelopes a suspicious call opened (see the incident runbooks).
  • Exact keys. Decrypt is pinned to the key ARN the envelope records, and a recipient whose key and version disagree is refused before KMS is called, so the key used is always the one the reader trusts.
  • One attempt per call. boto3 sets retries per client, not per call, so the client must make exactly one attempt: retries={"total_max_attempts": 1}. Any other client is refused with a ValueError, because botocore's retries would multiply the policy's bounded attempts. Note that botocore's max_attempts counts retries: {"max_attempts": 1} means two attempts.
  • Timeouts. The policy's provider_timeout_ms (30 seconds by default) is checked between attempts but cannot cut a call short. Keep connect_timeout plus read_timeout within it (botocore defaults to 60 seconds each).
  • Errors. KMS errors map to stable error codes; throttling and transient service errors are retryable within the policy's budget, and missing or expired credentials are PROVIDER_AUTH_FAILED. grant_tokens= passes KMS grant tokens.

Documentation

cryptography_suite.providers.conformance.verify_provider checks the provider against a test key in your account.

Metadata

Release files for cryptography-suite-aws-kms 4.0.0rc1

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

Source distribution (sdist)

Source distribution for cryptography-suite-aws-kms 4.0.0rc1
File Size Uploaded Provenance Actions
cryptography_suite_aws_kms-4.0.0rc1.tar.gz 7.3 kB With provenance Details for cryptography_suite_aws_kms-4.0.0rc1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cryptography-suite-aws-kms 4.0.0rc1
File Interpreter ABI Platform Actions
cryptography_suite_aws_kms-4.0.0rc1-py3-none-any.whl Python 3 none any Details for cryptography_suite_aws_kms-4.0.0rc1-py3-none-any.whl

Total release size: 15.5 kB

Release files / cryptography_suite_aws_kms-4.0.0rc1.tar.gz

Download URL cryptography_suite_aws_kms-4.0.0rc1.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7a13d5a2c4172cfc714771c71cdfd00dc83e70c28a95cf0bae55a8895b9a37ab
BLAKE2b-256 checksum
How to use checksums
396635baed0415b39b24a643040e78bf19173defe89d4385c88a35a75e666139
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 Dec 1, 2026.

Transparency log

Release files / cryptography_suite_aws_kms-4.0.0rc1-py3-none-any.whl

Download URL cryptography_suite_aws_kms-4.0.0rc1-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3902d87a2d09c3f0f11b86a71f9486d2ac0cef2efaf781c6412c22659157d7f8
BLAKE2b-256 checksum
How to use checksums
8f47a7a48e014772e5b550d752e859af3d2e22272690f68bf45f4582cd5ff823
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 Dec 1, 2026.

Transparency log

Security for cryptography-suite-aws-kms 4.0.0rc1

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.

Select from 2 files

Attestation for cryptography_suite_aws_kms-4.0.0rc1.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 Dec 1, 2026.

Transparency log

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