Botan 3.13.0
Crypto and TLS for C&
Botan::Stateful_Key_Index_Registry::KeyId Class Referencefinal

#include <stateful_key_index_registry.h>

Public Member Functions

 KeyId ()=default
 KeyId (std::string_view algo_name, std::span< const uint8_t > algo_params, uint64_t max_operations, std::span< const uint8_t > key_material_1, std::span< const uint8_t > key_material_2)
uint64_t max_operations () const
auto operator<=> (const KeyId &other) const
bool operator== (const KeyId &other) const

Friends

class Stateful_Key_Index_Registry

Detailed Description

Definition at line 38 of file stateful_key_index_registry.h.

Constructor & Destructor Documentation

◆ KeyId() [1/2]

Botan::Stateful_Key_Index_Registry::KeyId::KeyId ( std::string_view algo_name,
std::span< const uint8_t > algo_params,
uint64_t max_operations,
std::span< const uint8_t > key_material_1,
std::span< const uint8_t > key_material_2 )

Create a KeyId for some kind of key material

Parameters
algo_nameAlgorithm name (ex "XMSS", "HSS-LMS")
algo_paramsEncoding of the algorithm parameters
max_operationsMaximum number of operations the key supports. This must be derived from algo_params; equal identities must have equal maximums.
key_material_1First part of key identifying material
key_material_2Second part of key identifying material (can be omitted)

Definition at line 27 of file stateful_key_index_registry.cpp.

31 :
32 m_process_id(OS::get_process_id()), m_max_operations(max_operations) {
33 auto hash = HashFunction::create_or_throw("SHA-256");
34
35 hash->update("Botan Stateful_Key_Index_Registry KeyID");
36 hash->update_be(static_cast<uint64_t>(algo_name.size()));
37 hash->update(algo_name);
38 hash->update_be(static_cast<uint64_t>(algo_params.size()));
39 hash->update(algo_params);
40 hash->update_be(static_cast<uint64_t>(key_material_1.size()));
41 hash->update(key_material_1);
42 hash->update_be(static_cast<uint64_t>(key_material_2.size()));
43 hash->update(key_material_2);
44
45 BOTAN_ASSERT_NOMSG(hash->output_length() == m_val.size());
46
47 hash->final(m_val);
48}
#define BOTAN_ASSERT_NOMSG(expr)
Definition assert.h:75
static std::unique_ptr< HashFunction > create_or_throw(std::string_view algo_spec, std::string_view provider="")
Definition hash.cpp:308
uint32_t BOTAN_TEST_API get_process_id()
Definition os_utils.cpp:77

References BOTAN_ASSERT_NOMSG, Botan::HashFunction::create_or_throw(), and max_operations().

Referenced by operator<=>(), and operator==().

◆ KeyId() [2/2]

Botan::Stateful_Key_Index_Registry::KeyId::KeyId ( )
default

Member Function Documentation

◆ max_operations()

uint64_t Botan::Stateful_Key_Index_Registry::KeyId::max_operations ( ) const
inline

◆ operator<=>()

auto Botan::Stateful_Key_Index_Registry::KeyId::operator<=> ( const KeyId & other) const
inline

Definition at line 65 of file stateful_key_index_registry.h.

65=>(const KeyId& other) const { return m_val <=> other.m_val; }
KeyId(std::string_view algo_name, std::span< const uint8_t > algo_params, uint64_t max_operations, std::span< const uint8_t > key_material_1, std::span< const uint8_t > key_material_2)

References KeyId().

◆ operator==()

bool Botan::Stateful_Key_Index_Registry::KeyId::operator== ( const KeyId & other) const
inline

Definition at line 67 of file stateful_key_index_registry.h.

67{ return m_val == other.m_val; }

References KeyId().

◆ Stateful_Key_Index_Registry

friend class Stateful_Key_Index_Registry
friend

Definition at line 74 of file stateful_key_index_registry.h.

References Stateful_Key_Index_Registry.

Referenced by Stateful_Key_Index_Registry.


The documentation for this class was generated from the following files: