Key Backends

class cryptoshred.backends.KeyBackend

The base class for KeyBackends this exists for typing and documentation purposes

generate_key()

Used to generate a new cryptoshredding key. Will return the id of the key.

Return type

UUID

Returns

The id of the newly generated key

get_iv()

Returns the initialization vector.

Return type

bytes

Returns

The initialization vector

get_key(id)

For a given key id returns the id and the key.

Parameters

id (UUID4) – The id of the subject for which to get the key

Return type

Tuple[UUID, bytes]

Returns

The id and the corresponding key

Raises

KeyNotFoundException – If there is no key for the given UUID

class cryptoshred.backends.DynamoDbSsmBackend(*, iv_param, table_name='cryptoshred-keys', dynamo=None)

An implementation of the key backend interface using AWS DynamoDb as key persistence layer. The initialization vector is stored in AWS SSM PS.

Parameters
  • iv_param (str) – The path to the SSM parameter holding the initialization vector

  • table_name (str) – The name of the dynamo table to use for fetching and storing keys

  • dynamo (DynamoDbResource) – Optional parameter for injecting custom boto3 dynamodb resource implementations