Botan 3.14.1
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 39 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 26 of file stateful_key_index_registry.cpp.

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

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 66 of file stateful_key_index_registry.h.

66=>(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 68 of file stateful_key_index_registry.h.

68{ return m_val == other.m_val; }

References KeyId().

◆ Stateful_Key_Index_Registry

friend class Stateful_Key_Index_Registry
friend

Definition at line 75 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: