aws_encryption_sdk.materials_managers.caching

Caching crypto material manager.

Classes

CachingCryptoMaterialsManager(cache, max_age)

Crypto material manager which caches results from an underlying material manager.

class aws_encryption_sdk.materials_managers.caching.CachingCryptoMaterialsManager(cache, max_age, max_messages_encrypted=4294967296, max_bytes_encrypted=9223372036854775807, partition_name=None, master_key_provider=None, backing_materials_manager=None)

Bases: CryptoMaterialsManager

Crypto material manager which caches results from an underlying material manager.

New in version 1.3.0.

>>> import aws_encryption_sdk
>>> kms_key_provider = aws_encryption_sdk.KMSMasterKeyProvider(key_ids=[
...     'arn:aws:kms:us-east-1:2222222222222:key/22222222-2222-2222-2222-222222222222',
...     'arn:aws:kms:us-east-1:3333333333333:key/33333333-3333-3333-3333-333333333333'
... ])
>>> local_cache = aws_encryption_sdk.LocalCryptoMaterialsCache(capacity=100)
>>> caching_materials_manager = aws_encryption_sdk.CachingCryptoMaterialsManager(
...     master_key_provider=kms_key_provider,
...     cache=local_cache,
...     max_age=600.0,
...     max_messages_encrypted=10
... )

Note

The partition name is used to enable a single cache instance to be used by multiple material manager instances by partitioning the entries in that cache based on this value. If no partition name is provided, a random UUID will be used.

Note

Either backing_materials_manager or master_key_provider must be provided. backing_materials_manager will always be used if present.

Parameters

Method generated by attrs for class CachingCryptoMaterialsManager.

get_encryption_materials(request)

Provides encryption materials appropriate for the request.

Parameters

request (aws_encryption_sdk.materials_managers.EncryptionMaterialsRequest) – Encryption materials request

Returns

encryption materials

Return type

aws_encryption_sdk.materials_managers.EncryptionMaterials

decrypt_materials(request)

Provides decryption materials appropriate for the request.

Parameters

request (aws_encryption_sdk.materials_managers.DecryptionMaterialsRequest) – decrypt materials request

Returns

decryption materials

Return type

aws_encryption_sdk.materials_managers.DecryptionMaterials