Botan 3.6.1
Crypto and TLS for C&
Botan::TLS::ExternalPSK Class Reference

#include <tls_external_psk.h>

Public Member Functions

 ExternalPSK (const ExternalPSK &)=delete
 
 ExternalPSK (ExternalPSK &&)=default
 
 ExternalPSK (std::string_view identity, std::string_view prf_algo, secure_vector< uint8_t > psk)
 
secure_vector< uint8_t > extract_master_secret ()
 
const std::string & identity () const
 
ExternalPSKoperator= (const ExternalPSK &)=delete
 
ExternalPSKoperator= (ExternalPSK &&)=default
 
const std::string & prf_algo () const
 
 ~ExternalPSK ()=default
 

Detailed Description

This is an externally provided PreSharedKey along with its identity, master secret and (in case of TLS 1.3) a pre-provisioned Pseudo Random Function.

Definition at line 24 of file tls_external_psk.h.

Constructor & Destructor Documentation

◆ ExternalPSK() [1/3]

Botan::TLS::ExternalPSK::ExternalPSK ( const ExternalPSK & )
delete

◆ ExternalPSK() [2/3]

Botan::TLS::ExternalPSK::ExternalPSK ( ExternalPSK && )
default

◆ ~ExternalPSK()

Botan::TLS::ExternalPSK::~ExternalPSK ( )
default

◆ ExternalPSK() [3/3]

Botan::TLS::ExternalPSK::ExternalPSK ( std::string_view identity,
std::string_view prf_algo,
secure_vector< uint8_t > psk )
inline

Definition at line 32 of file tls_external_psk.h.

32 :
33 m_identity(identity), m_prf_algo(prf_algo), m_master_secret(std::move(psk)) {}
const std::string & prf_algo() const
const std::string & identity() const

Member Function Documentation

◆ extract_master_secret()

secure_vector< uint8_t > Botan::TLS::ExternalPSK::extract_master_secret ( )
inline

Returns the master secret by moving it out of this object. Do not call this method more than once.

Definition at line 46 of file tls_external_psk.h.

46 {
47 BOTAN_STATE_CHECK(!m_master_secret.empty());
48 return std::exchange(m_master_secret, {});
49 }
#define BOTAN_STATE_CHECK(expr)
Definition assert.h:41

References BOTAN_STATE_CHECK.

◆ identity()

const std::string & Botan::TLS::ExternalPSK::identity ( ) const
inline

Identity (e.g. username of the PSK owner) of the preshared key. Despite the std::string return type, this may or may not be a human-readable/printable string.

Definition at line 40 of file tls_external_psk.h.

40{ return m_identity; }

◆ operator=() [1/2]

ExternalPSK & Botan::TLS::ExternalPSK::operator= ( const ExternalPSK & )
delete

◆ operator=() [2/2]

ExternalPSK & Botan::TLS::ExternalPSK::operator= ( ExternalPSK && )
default

◆ prf_algo()

const std::string & Botan::TLS::ExternalPSK::prf_algo ( ) const
inline

External preshared keys in TLS 1.3 must be provisioned with a pseudo-random function (typically SHA-256 or the like). This is needed to calculate/verify the PSK binder values in the client hello.

Definition at line 56 of file tls_external_psk.h.

56{ return m_prf_algo; }

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