|
BSL v1.1.1 - 50.g42e5d9b
AMMOS Bundle Protocol Security Library (BSL)
|
Implementation of the key loader logic for JWK Set and COSE Key Set. More...
#include "KeyLoader.h"#include <bsl/front/TextUtil.h>#include <bsl/dynamic/CBOR.h>#include <bsl/dynamic/Variant.h>#include <bsl/cose_sc/CoseMsg.h>#include <jansson.h>#include <m-string.h>#include <fcntl.h>#include <sys/mman.h>#include <sys/stat.h>#include <unistd.h>
Include dependency graph for KeyLoader.c:Functions | |
| int | BSL_Crypto_KeyLoader_LoadFile (const char *file_path) |
| Load keys from file. | |
| int | BSL_Crypto_KeyLoader_LoadJwkSet (int fd) |
| static int | BSL_Crypto_KeyLoader_LoadCoseKeySet_decode (QCBORDecodeContext *dec, const void *obj) |
Decode a COSE_KeySet array. | |
| int | BSL_Crypto_KeyLoader_LoadCoseKeySet (int infd) |
Variables | |
| BSL_KeyStore_Descriptors_t | BSL_KeyStore_State |
| Initialized to library default. | |
Implementation of the key loader logic for JWK Set and COSE Key Set.
| int BSL_Crypto_KeyLoader_LoadCoseKeySet | ( | int | infd | ) |
| infd | The file descriptor to read from. |
References BSL_CBOR_Decode(), BSL_Crypto_KeyLoader_LoadCoseKeySet_decode(), BSL_Data_InitView(), BSL_ERR_DECODING, and BSL_LOG_ERR.
Referenced by BSL_Crypto_KeyLoader_LoadFile(), and LLVMFuzzerTestOneInput().
|
static |
Decode a COSE_KeySet array.
Matches BSL_CBOR_Decode_f signature.
References BSL_KeyStore_Descriptors_t::add_key, BSL_Crypto_LoadKey(), BSL_Crypto_ReleaseKeyHandle(), BSL_Data_InitView(), BSL_KeyStore_State, BSL_LOG_DEBUG, BSL_LOG_ERR, BSL_LOG_WARNING, BSL_SUCCESS, BSL_Variant_SetBytestr(), BSL_Variant_SetInt64(), BSLX_COSEMSG_KEY_PARAM_ALG, BSLX_COSEMSG_KEY_PARAM_BASEIV, BSLX_COSEMSG_KEY_PARAM_KID, BSLX_COSEMSG_KEY_PARAM_KTY, keyhandle, BSL_Data_t::len, and BSL_KeyStore_Descriptors_t::set_parameter.
Referenced by BSL_Crypto_KeyLoader_LoadCoseKeySet().
| int BSL_Crypto_KeyLoader_LoadFile | ( | const char * | file_path | ) |
Load keys from file.
| [in] | file_path | path to JSON file with JWK Set or CBOR file with COSE_KeySet |
References BSL_Crypto_KeyLoader_LoadCoseKeySet(), BSL_Crypto_KeyLoader_LoadJwkSet(), BSL_ERR_ARG_INVALID, BSL_ERR_DECODING, BSL_LOG_ERR, BSL_LOG_INFO, and BSL_SUCCESS.
Referenced by main().
| int BSL_Crypto_KeyLoader_LoadJwkSet | ( | int | infd | ) |
| infd | The file descriptor to read from. |
References BSL_KeyStore_Descriptors_t::add_key, BSL_Crypto_LoadKey(), BSL_Crypto_ReleaseKeyHandle(), BSL_Data_Deinit(), BSL_Data_Init(), BSL_DATA_INIT_VIEW_CSTR, BSL_KeyStore_State, BSL_LOG_DEBUG, BSL_LOG_ERR, BSL_LOG_INFO, BSL_SUCCESS, BSL_TextUtil_Base64_Decode(), keyhandle, BSL_Data_t::len, and BSL_Data_t::ptr.
Referenced by BSL_Crypto_KeyLoader_LoadFile(), and LLVMFuzzerTestOneInput().
|
extern |
Initialized to library default.
Referenced by BSL_Crypto_CompareKeys(), BSL_Crypto_GetKeyParameter(), BSL_Crypto_GetKeyStatistics(), BSL_Crypto_GetRegistryKey(), BSL_Crypto_KeyLoader_LoadCoseKeySet_decode(), BSL_Crypto_KeyLoader_LoadJwkSet(), BSL_Crypto_LoadKey(), BSL_Crypto_ReleaseKeyHandle(), BSL_KeyStore_Deinit(), and BSL_KeyStore_Init().