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

#include <hpke.h>

Public Member Functions

constexpr AEAD_Id aead () const
size_t ciphertext_overhead () const
bool is_available () const
constexpr bool is_export_only () const
constexpr bool is_known () const
constexpr KDF_Id kdf () const
constexpr KEM_Id kem () const
constexpr bool operator== (const Suite &other) const
constexpr Suite (KEM_Id kem, KDF_Id kdf, AEAD_Id aead)
std::optional< std::string > to_string () const

Detailed Description

An HPKE ciphersuite: the triple of KEM, KDF and AEAD See RFC 9180 Section 4

This is a plain value type; it may hold any combination of codepoints, including unknown ones. Availability is checked when a context is created.

Definition at line 241 of file hpke.h.

Constructor & Destructor Documentation

◆ Suite()

Botan::HPKE::Suite::Suite ( KEM_Id kem,
KDF_Id kdf,
AEAD_Id aead )
inlineconstexpr

Definition at line 243 of file hpke.h.

243: m_kem(kem), m_kdf(kdf), m_aead(aead) {}
constexpr AEAD_Id aead() const
Definition hpke.h:249
constexpr KDF_Id kdf() const
Definition hpke.h:247
constexpr KEM_Id kem() const
Definition hpke.h:245

References aead(), kdf(), and kem().

Referenced by operator==().

Member Function Documentation

◆ aead()

AEAD_Id Botan::HPKE::Suite::aead ( ) const
inlineconstexpr

Definition at line 249 of file hpke.h.

249{ return m_aead; }

Referenced by Suite(), and to_string().

◆ ciphertext_overhead()

size_t Botan::HPKE::Suite::ciphertext_overhead ( ) const
inline

Bytes added to each plaintext when sealed (the AEAD tag length) See RFC 9180 Section 5.2 Throws Invalid_State for an export-only suite, which cannot seal

Definition at line 264 of file hpke.h.

264{ return m_aead.tag_length(); }

◆ is_available()

bool Botan::HPKE::Suite::is_available ( ) const
inline

Definition at line 257 of file hpke.h.

257{ return m_kem.is_available() && m_kdf.is_available() && m_aead.is_available(); }

◆ is_export_only()

bool Botan::HPKE::Suite::is_export_only ( ) const
inlineconstexpr

Definition at line 259 of file hpke.h.

259{ return m_aead.is_export_only(); }

◆ is_known()

bool Botan::HPKE::Suite::is_known ( ) const
inlineconstexpr

Definition at line 255 of file hpke.h.

255{ return m_kem.is_known() && m_kdf.is_known() && m_aead.is_known(); }

◆ kdf()

KDF_Id Botan::HPKE::Suite::kdf ( ) const
inlineconstexpr

Definition at line 247 of file hpke.h.

247{ return m_kdf; }

Referenced by Suite(), and to_string().

◆ kem()

KEM_Id Botan::HPKE::Suite::kem ( ) const
inlineconstexpr

Definition at line 245 of file hpke.h.

245{ return m_kem; }

Referenced by Suite(), and to_string().

◆ operator==()

bool Botan::HPKE::Suite::operator== ( const Suite & other) const
inlineconstexpr

Definition at line 251 of file hpke.h.

251 {
252 return m_kem == other.m_kem && m_kdf == other.m_kdf && m_aead == other.m_aead;
253 }

References Suite().

◆ to_string()

std::optional< std::string > Botan::HPKE::Suite::to_string ( ) const

Definition at line 213 of file hpke.cpp.

213 {
214 const auto kem = m_kem.to_string();
215 const auto kdf = m_kdf.to_string();
216 const auto aead = m_aead.to_string();
217 if(kem && kdf && aead) {
218 return fmt("{}/{}/{}", *kem, *kdf, *aead);
219 }
220 return std::nullopt;
221}
std::string fmt(std::string_view format, const T &... args)
Definition fmt.h:53

References aead(), Botan::fmt(), kdf(), and kem().


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