Botan 3.6.1
Crypto and TLS for C&
Botan::ML_DSA_Expanding_Keypair_Codec Class Referencefinal

#include <ml_dsa_impl.h>

Inheritance diagram for Botan::ML_DSA_Expanding_Keypair_Codec:
Botan::Dilithium_Keypair_Codec

Public Member Functions

DilithiumInternalKeypair decode_keypair (std::span< const uint8_t > private_key, DilithiumConstants mode) const override
 
secure_vector< uint8_t > encode_keypair (DilithiumInternalKeypair keypair) const override
 

Static Public Member Functions

static std::unique_ptr< Dilithium_Keypair_Codeccreate (DilithiumMode mode)
 

Detailed Description

Definition at line 21 of file ml_dsa_impl.h.

Member Function Documentation

◆ create()

std::unique_ptr< Dilithium_Keypair_Codec > Botan::Dilithium_Keypair_Codec::create ( DilithiumMode mode)
staticinherited

Definition at line 22 of file dilithium_keys.cpp.

22 {
23#if defined(BOTAN_HAS_DILITHIUM) || defined(BOTAN_HAS_DILITHIUM_AES)
24 if(mode.is_dilithium_round3()) {
25 return std::make_unique<Dilithium_Expanded_Keypair_Codec>();
26 }
27#endif
28
29#if defined(BOTAN_HAS_ML_DSA)
30 if(mode.is_ml_dsa()) {
31 return std::make_unique<ML_DSA_Expanding_Keypair_Codec>();
32 }
33#endif
34
35 throw Not_Implemented("requested ML-DSA/Dilithium mode is not implemented in this build");
36}

References Botan::DilithiumMode::is_dilithium_round3(), and Botan::DilithiumMode::is_ml_dsa().

Referenced by Botan::DilithiumConstants::DilithiumConstants().

◆ decode_keypair()

DilithiumInternalKeypair Botan::ML_DSA_Expanding_Keypair_Codec::decode_keypair ( std::span< const uint8_t > private_key,
DilithiumConstants mode ) const
overridevirtual

Implements Botan::Dilithium_Keypair_Codec.

Definition at line 22 of file ml_dsa_impl.cpp.

23 {
24 return Dilithium_Algos::expand_keypair(DilithiumSeedRandomness(private_key_seed), std::move(mode));
25}
DilithiumInternalKeypair expand_keypair(DilithiumSeedRandomness xi, DilithiumConstants mode)
Strong< secure_vector< uint8_t >, struct DilithiumSeedRandomness_ > DilithiumSeedRandomness
Principal seed used to generate Dilithium key pairs.

References Botan::Dilithium_Algos::expand_keypair().

◆ encode_keypair()

secure_vector< uint8_t > Botan::ML_DSA_Expanding_Keypair_Codec::encode_keypair ( DilithiumInternalKeypair keypair) const
overridevirtual

Implements Botan::Dilithium_Keypair_Codec.

Definition at line 15 of file ml_dsa_impl.cpp.

15 {
16 BOTAN_ASSERT_NONNULL(keypair.second);
17 const auto& seed = keypair.second->seed();
18 BOTAN_ARG_CHECK(seed.has_value(), "Cannot encode keypair without the private seed");
19 return seed.value().get();
20}
#define BOTAN_ASSERT_NONNULL(ptr)
Definition assert.h:86
#define BOTAN_ARG_CHECK(expr, msg)
Definition assert.h:29

References BOTAN_ARG_CHECK, and BOTAN_ASSERT_NONNULL.


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