Botan 3.14.1
Crypto and TLS for C&
Botan::DL_PublicKey Class Referencefinal

#include <dl_scheme.h>

Public Member Functions

bool check_key (RandomNumberGenerator &rng, bool strong) const
std::vector< uint8_t > DER_encode () const
 DL_PublicKey (const AlgorithmIdentifier &alg_id, std::span< const uint8_t > key_bits, DL_Group_Format format)
 DL_PublicKey (const DL_Group &group, const BigInt &public_key)
size_t estimated_strength () const
const BigInt & get_int_field (std::string_view algo_name, std::string_view field) const
const DL_Group & group () const
size_t p_bits () const
const BigInt & public_key () const
std::vector< uint8_t > public_key_as_bytes () const

Detailed Description

Definition at line 21 of file dl_scheme.h.

Constructor & Destructor Documentation

◆ DL_PublicKey() [1/2]

Botan::DL_PublicKey::DL_PublicKey ( const DL_Group & group,
const BigInt & public_key )

Definition at line 69 of file dl_scheme.cpp.

69 :
70 m_group(group), m_public_key(check_dl_public_key_input(public_key, m_group)) {}
const BigInt & public_key() const
Definition dl_scheme.h:31
const DL_Group & group() const
Definition dl_scheme.h:29

References group(), and public_key().

◆ DL_PublicKey() [2/2]

Botan::DL_PublicKey::DL_PublicKey ( const AlgorithmIdentifier & alg_id,
std::span< const uint8_t > key_bits,
DL_Group_Format format )

Definition at line 72 of file dl_scheme.cpp.

74 :
75 m_group(alg_id.parameters(), format),
76 m_public_key(check_dl_public_key_input(decode_single_bigint(key_bits), m_group)) {}

Member Function Documentation

◆ check_key()

bool Botan::DL_PublicKey::check_key ( RandomNumberGenerator & rng,
bool strong ) const

Definition at line 88 of file dl_scheme.cpp.

88 {
89 return m_group.verify_group(rng, strong) && m_group.verify_public_element(m_public_key);
90}

◆ DER_encode()

std::vector< uint8_t > Botan::DL_PublicKey::DER_encode ( ) const

Definition at line 82 of file dl_scheme.cpp.

82 {
83 std::vector<uint8_t> output;
84 DER_Encoder(output).encode(m_public_key);
85 return output;
86}

References Botan::DER_Encoder::encode().

◆ estimated_strength()

size_t Botan::DL_PublicKey::estimated_strength ( ) const

Definition at line 92 of file dl_scheme.cpp.

92 {
93 return m_group.estimated_strength();
94}

◆ get_int_field()

const BigInt & Botan::DL_PublicKey::get_int_field ( std::string_view algo_name,
std::string_view field ) const

Definition at line 142 of file dl_scheme.cpp.

142 {
143 if(field == "p") {
144 return m_group.get_p();
145 } else if(field == "q") {
146 return m_group.get_q();
147 } else if(field == "g") {
148 return m_group.get_g();
149 } else if(field == "y") {
150 return m_public_key;
151 } else {
152 throw Unknown_PK_Field_Name(algo, field);
153 }
154}

◆ group()

const DL_Group & Botan::DL_PublicKey::group ( ) const
inline

Definition at line 29 of file dl_scheme.h.

29{ return m_group; }

Referenced by DL_PublicKey().

◆ p_bits()

size_t Botan::DL_PublicKey::p_bits ( ) const

Definition at line 96 of file dl_scheme.cpp.

96 {
97 return m_group.p_bits();
98}

◆ public_key()

const BigInt & Botan::DL_PublicKey::public_key ( ) const
inline

Definition at line 31 of file dl_scheme.h.

31{ return m_public_key; }

Referenced by DL_PublicKey().

◆ public_key_as_bytes()

std::vector< uint8_t > Botan::DL_PublicKey::public_key_as_bytes ( ) const

Definition at line 78 of file dl_scheme.cpp.

78 {
79 return m_public_key.serialize(m_group.p_bytes());
80}

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