MetaStore

Meta cryptographic provider store.

class dynamodb_encryption_sdk.material_providers.store.meta.MetaStore(table: boto3.resources.base.ServiceResource, materials_provider: dynamodb_encryption_sdk.material_providers.CryptographicMaterialsProvider)[source]

Bases: dynamodb_encryption_sdk.material_providers.store.ProviderStore

Create and retrieve wrapped cryptographic materials providers, storing their cryptographic materials using the provided encrypted table.

Parameters
  • table (boto3.resources.base.ServiceResource) – Pre-configured boto3 DynamoDB Table object

  • materials_provider (CryptographicMaterialsProvider) – Cryptographic materials provider to use

classmethod create_table(client: botocore.client.BaseClient, table_name: str, read_units: int, write_units: int) None[source]

Create the table for this MetaStore.

Parameters
  • table (boto3.resources.base.BaseClient) – Pre-configured boto3 DynamoDB client object

  • table_name (str) – Name of table to create

  • read_units (int) – Read capacity units to provision

  • write_units (int) – Write capacity units to provision

get_or_create_provider(material_name: str, version: int) dynamodb_encryption_sdk.material_providers.CryptographicMaterialsProvider[source]

Obtain a cryptographic materials provider identified by a name and version.

If the requested version does not exist, a new one will be created.

Parameters
  • material_name (str) – Material to locate

  • version (int) – Version of material to locate

Returns

cryptographic materials provider

Return type

CryptographicMaterialsProvider

Raises

InvalidVersionError – if the requested version is not available and cannot be created

provider(material_name: str, version: Optional[int] = None) dynamodb_encryption_sdk.material_providers.CryptographicMaterialsProvider[source]

Obtain a cryptographic materials provider identified by a name and version.

If the version is provided, an error will be raised if that version is not found.

If the version is not provided, the maximum version will be used.

Parameters
  • material_name (str) – Material to locate

  • version (int) – Version of material to locate (optional)

Returns

cryptographic materials provider

Return type

CryptographicMaterialsProvider

Raises

InvalidVersionError – if the requested version is not found

version_from_material_description(material_description)[source]

Determine the version from the provided material description.

Parameters

material_description (dict) – Material description to use with this request

Returns

version to use

Return type

int

max_version(material_name)[source]

Find the maximum known version of the specified material.

Parameters

material_name (str) – Material to locate

Returns

Maximum known version

Return type

int

Raises

NoKnownVersion – if no version can be found