aws_encryption_sdk.caches.base

Base class interface for caches for use with caching crypto material managers.

Classes

CryptoMaterialsCache Parent interface for crypto materials caches.
class aws_encryption_sdk.caches.base.CryptoMaterialsCache

Bases: object

Parent interface for crypto materials caches.

New in version 1.3.0.

put_encryption_materials(cache_key, encryption_materials, plaintext_length, entry_hints=None)

Adds encryption materials to the cache.

Parameters:
  • cache_key (bytes) – Identifier for entries in cache
  • encryption_materials (aws_encryption_sdk.materials_managers.EncryptionMaterials) – Encryption materials to add to cache
  • plaintext_length (int) – Length of plaintext associated with this request to the cache
  • entry_hints (aws_encryption_sdk.caches.CryptoCacheEntryHints) – Metadata to associate with entry (optional)
Return type:

aws_encryption_sdk.caches.CryptoCacheEntry

put_decryption_materials(cache_key, decryption_materials)

Adds decryption materials to the cache

Parameters:
Return type:

aws_encryption_sdk.caches.CryptoCacheEntry

get_encryption_materials(cache_key, plaintext_length)

Locates exactly one available encryption materials cache entry for the specified cache_key, incrementing the entry’s usage stats prior to returning it to the caller.

Parameters:
  • cache_key (bytes) – Cache ID for which to locate cache entries
  • plaintext_length (int) – Bytes to be encrypted by the encryption materials
Return type:

aws_encryption_sdk.caches.CryptoCacheEntry

Raises:

CacheKeyError – if no values found in cache for cache_key

get_decryption_materials(cache_key)

Locates exactly one available decryption materials cache entry for the specified cache_key.

Parameters:cache_key (bytes) – Cache ID for which to locate cache entries
Return type:aws_encryption_sdk.caches.CryptoCacheEntry
Raises:CacheKeyError – if no values found in cache for cache_key