Botan 3.6.0
Crypto and TLS for C&
Botan::Dilithium_Expanded_Keypair_Codec Class Referencefinal

#include <dilithium_round3_symmetric_primitives.h>

Inheritance diagram for Botan::Dilithium_Expanded_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 20 of file dilithium_round3_symmetric_primitives.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::Dilithium_Expanded_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 dilithium_round3_symmetric_primitives.cpp.

23 {
24 BOTAN_ARG_CHECK(mode.mode().is_available(), "Dilithium/ML-DSA mode is not available in this build");
25 BOTAN_ARG_CHECK(private_key.size() == mode.private_key_bytes(),
26 "dilithium private key does not have the correct byte count");
27 return Dilithium_Algos::decode_keypair(StrongSpan<const DilithiumSerializedPrivateKey>(private_key),
28 std::move(mode));
29}
#define BOTAN_ARG_CHECK(expr, msg)
Definition assert.h:29

References BOTAN_ARG_CHECK, Botan::DilithiumMode::is_available(), Botan::DilithiumConstants::mode(), and Botan::DilithiumConstants::private_key_bytes().

◆ encode_keypair()

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

Implements Botan::Dilithium_Keypair_Codec.

Definition at line 18 of file dilithium_round3_symmetric_primitives.cpp.

18 {
19 return Dilithium_Algos::encode_keypair(keypair).get();
20}

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