[][src]Module tink_core::registry

Provides a container that for each supported key type holds a corresponding KeyManager object, which can generate new keys or instantiate the primitive corresponding to given key.

Registry is initialized at startup, and is later used to instantiate primitives for given keys or keysets. Keeping KeyManagers for all primitives in a single Registry (rather than having a separate KeyManager per primitive) enables modular construction of compound primitives from "simple" ones, e.g., AES-CTR-HMAC AEAD encryption uses IND-CPA encryption and a MAC.

Note that regular users will usually not work directly with Registry, but rather via primitive factories, which in the background query the Registry for specific KeyManagers. Registry is public though, to enable configurations with custom primitives and KeyManagers.

Traits

KeyManager

KeyManager "understands" keys of a specific key types: it can generate keys of a supported type and create primitives for supported keys. A key type is identified by the global name of the protocol buffer that holds the corresponding key material, and is given by type_url-field of KeyData-protocol buffer.

KmsClient

KmsClient knows how to produce primitives backed by keys stored in remote KMS services.

Functions

clear_kms_clients

Remove all registered KMS clients.

get_key_manager

Return the key manager for the given type_url if it exists.

get_kms_client

Fetches a KmsClient by a given URI.

get_template_generator

Find a key template generator function by name.

new_key

Generate a new key for the given key template as a serialized protobuf message.

new_key_data

Generate a new KeyData for the given key template.

primitive

Create a new primitive for the given serialized key using the KeyManager identified by the given type_url.

primitive_from_key_data

Create a new primitive for the key given in the given KeyData.

register_key_manager

Register the given key manager. Does not allow overwrite of existing key managers.

register_kms_client

Register a new KMS client

register_template_generator

Register a key template generator function by name.

template_names

Return all available key template generator names.

Type Definitions

KeyTemplateGenerator