Botan 3.14.1
Crypto and TLS for C&
Botan::HPKE::PSK Class Referencefinal

#include <hpke.h>

Public Member Functions

std::span< const uint8_t > identity () const
 PSK (std::span< const uint8_t > psk, std::span< const uint8_t > psk_id)
std::span< const uint8_t > secret () const

Detailed Description

A pre-shared key plus identity, for the PSK and AuthPSK modes

RFC 9180 Section 5.1 requires both fields to be non-empty, and (following the recommendation of its Section 9.5) the PSK must be at least 32 bytes. Section 9.5 further recommends a PSK of at least Nh bytes, the output length of the suite's KDF; that is not enforced, as a PSK is not bound to a suite.

Definition at line 426 of file hpke.h.

Constructor & Destructor Documentation

◆ PSK()

Botan::HPKE::PSK::PSK ( std::span< const uint8_t > psk,
std::span< const uint8_t > psk_id )

Definition at line 333 of file hpke.cpp.

333 :
334 m_psk(psk.begin(), psk.end()), m_psk_id(psk_id.begin(), psk_id.end()) {
335 // See RFC 9180 Section 5.1
336 BOTAN_ARG_CHECK(!m_psk.empty() && !m_psk_id.empty(), "HPKE PSK and PSK identity must both be non-empty");
337 // See RFC 9180 Section 9.5
338 BOTAN_ARG_CHECK(m_psk.size() >= 32, "HPKE PSK must be at least 32 bytes");
339}
#define BOTAN_ARG_CHECK(expr, msg)
Definition assert.h:33

References BOTAN_ARG_CHECK.

Member Function Documentation

◆ identity()

std::span< const uint8_t > Botan::HPKE::PSK::identity ( ) const
inline

Definition at line 432 of file hpke.h.

432{ return m_psk_id; }

◆ secret()

std::span< const uint8_t > Botan::HPKE::PSK::secret ( ) const
inline

Definition at line 430 of file hpke.h.

430{ return m_psk; }

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