BSL v1.1.1 - 50.g42e5d9b
AMMOS Bundle Protocol Security Library (BSL)
Loading...
Searching...
No Matches
BSL_KeyStore_Descriptors_t Struct Reference

The set of callback function pointers which actually implement a key store. More...

#include <bsl/crypto/KeyStore.h>

+ Collaboration diagram for BSL_KeyStore_Descriptors_t:

Data Fields

int(* new_key )(BSL_Crypto_KeyHandle_t *key_out)
 Construct a new default empty key, outside of a key store.
 
BSL_Crypto_KeyHandle_t(* acquire_key )(BSL_Crypto_KeyHandle_t handle)
 Acquire a new copy of a handle.
 
void(* release_key )(BSL_Crypto_KeyHandle_t handle)
 Release the use of a handle.
 
int(* find_key )(const BSL_Data_t *keyid, BSL_Crypto_KeyHandle_t *handle)
 Find an identified key in the key store.
 
int(* add_key )(const BSL_Data_t *keyid, BSL_Crypto_KeyHandle_t handle)
 Add a key to the key store.
 
int(* set_keymat )(BSL_Crypto_KeyHandle_t handle, const BSL_Data_t *data)
 Set the (plaintext) key material for a key.
 
int(* get_keymat )(BSL_Crypto_KeyHandle_t handle, BSL_Data_t *view)
 Get the (plaintext) key material for a key.
 
const BSL_Variant_t *(* get_parameter )(BSL_Crypto_KeyHandle_t handle, int64_t param_id)
 Get a specific parameter which may be attached to a key.
 
BSL_Variant_t *(* set_parameter )(BSL_Crypto_KeyHandle_t handle, int64_t param_id)
 Set a key parameter before it is added to the key store.
 
void(* update_stats )(BSL_Crypto_KeyHandle_t handle, uint64_t use, uint64_t bytes)
 Update telemetry counters for a key.
 
int(* get_stats )(BSL_Crypto_KeyHandle_t handle, BSL_Crypto_KeyStats_t *stats)
 Get full counters for a key.
 

Detailed Description

The set of callback function pointers which actually implement a key store.

When registering, all of the functions need to be non-NULL.

Field Documentation

◆ acquire_key

BSL_Crypto_KeyHandle_t(* BSL_KeyStore_Descriptors_t::acquire_key) (BSL_Crypto_KeyHandle_t handle)

Acquire a new copy of a handle.

Parameters
[in]handleThe handle to acquire. If NULL handle this is a do-nothing.
Returns
The copy, or NULL if failure.

Referenced by BSL_AuthCtx_Init(), BSL_Cipher_Init(), and BSL_KeyStore_Init().

◆ add_key

int(* BSL_KeyStore_Descriptors_t::add_key) (const BSL_Data_t *keyid, BSL_Crypto_KeyHandle_t handle)

Add a key to the key store.

Parameters
[in]keyidA unique-to-the-store identifier for a key.
[in]handleThe non-NULL handle to the key to add.
Returns
BSL_SUCCESS if added.

Referenced by BSL_Crypto_KeyLoader_LoadCoseKeySet_decode(), BSL_Crypto_KeyLoader_LoadJwkSet(), and BSL_KeyStore_Init().

◆ find_key

int(* BSL_KeyStore_Descriptors_t::find_key) (const BSL_Data_t *keyid, BSL_Crypto_KeyHandle_t *handle)

Find an identified key in the key store.

Some keys are ephemeral and not registered in the store.

Parameters
[in]keyidA unique-to-the-store identifier for a key.
[out]handleIf found, will be set non-NULL handle.
Returns
BSL_SUCCESS if found.

Referenced by BSL_Crypto_GetKeyStatistics(), BSL_Crypto_GetRegistryKey(), and BSL_KeyStore_Init().

◆ get_keymat

int(* BSL_KeyStore_Descriptors_t::get_keymat) (BSL_Crypto_KeyHandle_t handle, BSL_Data_t *view)

Get the (plaintext) key material for a key.

Parameters
[in]handleThe handle to the key.
[out]dataNon-null pointer to output struct, which will be set to a view on the data.
Returns
BSL_SUCCESS if valid.

Referenced by BSL_AuthCtx_Init(), BSL_Cipher_Init(), BSL_Crypto_CompareKeys(), BSL_Crypto_KDF(), BSL_Crypto_UnwrapKey(), BSL_Crypto_WrapKey(), and BSL_KeyStore_Init().

◆ get_parameter

const BSL_Variant_t *(* BSL_KeyStore_Descriptors_t::get_parameter) (BSL_Crypto_KeyHandle_t handle, int64_t param_id)

Get a specific parameter which may be attached to a key.

Parameters
[in]handleThe handle to the key.
param_idThe unique identifier for the parameter. The available parameters will be determined by the key source (e.g. COSE_Key parameters).
Returns
A non-null pointer if the parameter exists.

Referenced by BSL_Crypto_GetKeyParameter(), and BSL_KeyStore_Init().

◆ get_stats

int(* BSL_KeyStore_Descriptors_t::get_stats) (BSL_Crypto_KeyHandle_t handle, BSL_Crypto_KeyStats_t *stats)

Get full counters for a key.

Referenced by BSL_Crypto_GetKeyStatistics(), and BSL_KeyStore_Init().

◆ new_key

int(* BSL_KeyStore_Descriptors_t::new_key) (BSL_Crypto_KeyHandle_t *key_out)

Construct a new default empty key, outside of a key store.

Parameters
[out]key_outThe non-null pointer to set. The handle must be released with release_key when it is done being used.
Returns
BSL_SUCCESS if successful.

Referenced by BSL_Crypto_LoadKey(), BSL_KeyStore_Init(), and MockBPA_KeyStore_Descriptors().

◆ release_key

void(* BSL_KeyStore_Descriptors_t::release_key) (BSL_Crypto_KeyHandle_t handle)

Release the use of a handle.

When all active handles are released the key should be destroyed.

Parameters
[in]handleThe non-NULL handle to release.

Referenced by BSL_AuthCtx_Deinit(), BSL_Cipher_Deinit(), BSL_Crypto_ReleaseKeyHandle(), and BSL_KeyStore_Init().

◆ set_keymat

int(* BSL_KeyStore_Descriptors_t::set_keymat) (BSL_Crypto_KeyHandle_t handle, const BSL_Data_t *data)

Set the (plaintext) key material for a key.

Parameters
[in]handleThe handle to the key.
[in]dataNon-null pointer to key bytes, which will be copied.
Returns
BSL_SUCCESS if valid.

Referenced by BSL_Crypto_LoadKey(), and BSL_KeyStore_Init().

◆ set_parameter

BSL_Variant_t *(* BSL_KeyStore_Descriptors_t::set_parameter) (BSL_Crypto_KeyHandle_t handle, int64_t param_id)

Set a key parameter before it is added to the key store.

Parameters
[in]handleThe handle to the key.
param_idThe unique identifier for the parameter.
Returns
A non-null pointer to the parameter. If the parameter already exists, the pointer will be to the pre-existing value.

Referenced by BSL_Crypto_KeyLoader_LoadCoseKeySet_decode(), and BSL_KeyStore_Init().

◆ update_stats

void(* BSL_KeyStore_Descriptors_t::update_stats) (BSL_Crypto_KeyHandle_t handle, uint64_t use, uint64_t bytes)

The documentation for this struct was generated from the following file: