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.
  • 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.0b2

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.0b2
File Size Uploaded Provenance Actions
cryptography_suite_aws_kms-4.0.0b2.tar.gz 6.5 kB With provenance Details for cryptography_suite_aws_kms-4.0.0b2.tar.gz

Built distribution (wheel)

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

Total release size: 14.0 kB

Release files / cryptography_suite_aws_kms-4.0.0b2.tar.gz

Download URL cryptography_suite_aws_kms-4.0.0b2.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
41f5f176ae360411224e77dbeafe774aec9db881cca3d2d8da66f447a1af88b1
BLAKE2b-256 checksum
How to use checksums
1517bde7ca68570738c80f01c3879840c530f5066c8036939e3acef09267250a
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 log

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

Download URL cryptography_suite_aws_kms-4.0.0b2-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a638c989067f8301be2042f3b8e3fa3e98226d5714dc03dc0c0aed88e7f8bf8
BLAKE2b-256 checksum
How to use checksums
b6cdee9a1b51164e4348a13bf6f406d789f3b9aaa6227b806b42d5312a494a8f
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 log

Security for cryptography-suite-aws-kms 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.

Select from 2 files

Attestation for cryptography_suite_aws_kms-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 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