Botan 3.6.1
Crypto and TLS for C&
Botan::PK_Ops::Key_Agreement_with_KDF Class Referenceabstract

#include <pk_ops_impl.h>

Inheritance diagram for Botan::PK_Ops::Key_Agreement_with_KDF:
Botan::PK_Ops::Key_Agreement

Public Member Functions

secure_vector< uint8_t > agree (size_t key_len, std::span< const uint8_t > other_key, std::span< const uint8_t > salt) override
 
virtual size_t agreed_value_size () const =0
 
 ~Key_Agreement_with_KDF () override=default
 

Protected Member Functions

 Key_Agreement_with_KDF (std::string_view kdf)
 

Detailed Description

Definition at line 103 of file pk_ops_impl.h.

Constructor & Destructor Documentation

◆ ~Key_Agreement_with_KDF()

Botan::PK_Ops::Key_Agreement_with_KDF::~Key_Agreement_with_KDF ( )
overridedefault

◆ Key_Agreement_with_KDF()

Botan::PK_Ops::Key_Agreement_with_KDF::Key_Agreement_with_KDF ( std::string_view kdf)
explicitprotected

Definition at line 65 of file pk_ops.cpp.

65 {
66 if(kdf != "Raw") {
67 m_kdf = KDF::create_or_throw(kdf);
68 }
69}
static std::unique_ptr< KDF > create_or_throw(std::string_view algo_spec, std::string_view provider="")
Definition kdf.cpp:199

References Botan::KDF::create_or_throw().

Member Function Documentation

◆ agree()

secure_vector< uint8_t > Botan::PK_Ops::Key_Agreement_with_KDF::agree ( size_t key_len,
std::span< const uint8_t > other_key,
std::span< const uint8_t > salt )
overridevirtual

Implements Botan::PK_Ops::Key_Agreement.

Definition at line 71 of file pk_ops.cpp.

73 {
74 if(!salt.empty() && m_kdf == nullptr) {
75 throw Invalid_Argument("PK_Key_Agreement::derive_key requires a KDF to use a salt");
76 }
77
78 secure_vector<uint8_t> z = raw_agree(other_key.data(), other_key.size());
79 if(m_kdf) {
80 return m_kdf->derive_key(key_len, z, salt.data(), salt.size());
81 }
82 return z;
83}
std::vector< T, secure_allocator< T > > secure_vector
Definition secmem.h:61

◆ agreed_value_size()

virtual size_t Botan::PK_Ops::Key_Agreement::agreed_value_size ( ) const
pure virtualinherited

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