Botan 3.14.1
Crypto and TLS for C&
Botan::SPAKE2p::RegistrationRecord Class Referencefinal

#include <spake2p.h>

Public Member Functions

secure_vector< uint8_t > serialize () const

Static Public Member Functions

static RegistrationRecord deserialize (const SystemParameters &params, std::span< const uint8_t > record)
static RegistrationRecord from_password (const SystemParameters &params, std::string_view password, std::span< const uint8_t > prover_id, std::span< const uint8_t > verifier_id, std::span< const uint8_t > salt, RandomNumberGenerator &rng)

Friends

class ProverSecret
class VerifierContext

Detailed Description

SPAKE2+ Registration Record

This is the information (w0 and L in RFC 9383) which the verifier stores in order to authenticate the prover.

Definition at line 159 of file spake2p.h.

Member Function Documentation

◆ deserialize()

RegistrationRecord Botan::SPAKE2p::RegistrationRecord::deserialize ( const SystemParameters & params,
std::span< const uint8_t > record )
static

Deserialize a RegistrationRecord previously serialized by serialize

Definition at line 262 of file spake2p.cpp.

262 {
263 const size_t scalar_len = params.group().get_order_bytes();
264 const size_t point_len = params.share_size();
265
266 if(record.size() != scalar_len + point_len) {
267 throw Decoding_Error("Invalid length for SPAKE2+ registration record");
268 }
269
270 auto w0 = EC_Scalar::deserialize(params.group(), record.first(scalar_len));
271 auto l = EC_AffinePoint::deserialize_uncompressed(params.group(), record.last(point_len));
272
273 if(!w0 || !l) {
274 throw Decoding_Error("Invalid SPAKE2+ registration record");
275 }
276
277 return RegistrationRecord(std::move(*w0), std::move(*l));
278}
static std::optional< EC_AffinePoint > deserialize_uncompressed(const EC_Group &group, std::span< const uint8_t > bytes)
static std::optional< EC_Scalar > deserialize(const EC_Group &group, std::span< const uint8_t > bytes)

References Botan::EC_Scalar::deserialize(), Botan::EC_AffinePoint::deserialize_uncompressed(), Botan::EC_Group::get_order_bytes(), Botan::SPAKE2p::SystemParameters::group(), and Botan::SPAKE2p::SystemParameters::share_size().

Referenced by botan_spake2p_verifier_init().

◆ from_password()

RegistrationRecord Botan::SPAKE2p::RegistrationRecord::from_password ( const SystemParameters & params,
std::string_view password,
std::span< const uint8_t > prover_id,
std::span< const uint8_t > verifier_id,
std::span< const uint8_t > salt,
RandomNumberGenerator & rng )
static

Perform password registration, returning the registration record

This derives the record from the password using Argon2id; see ProverSecret::from_password for the details. The same password, identities, and salt must later be used to create the prover's secret.

The identities and salt may be empty.

Definition at line 253 of file spake2p.cpp.

258 {
259 return ProverSecret::from_password(params, password, prover_id, verifier_id, salt).registration_record(rng);
260}
static ProverSecret from_password(const SystemParameters &params, std::string_view password, std::span< const uint8_t > prover_id, std::span< const uint8_t > verifier_id, std::span< const uint8_t > salt)
Definition spake2p.cpp:288
RegistrationRecord registration_record(RandomNumberGenerator &rng) const
Definition spake2p.cpp:313

References Botan::SPAKE2p::ProverSecret::from_password(), and Botan::SPAKE2p::ProverSecret::registration_record().

◆ serialize()

secure_vector< uint8_t > Botan::SPAKE2p::RegistrationRecord::serialize ( ) const

Serialize the registration record

Warning
the return value is the unencrypted registration record, which is a sensitive value allowing password guessing attacks. Encrypt it for persistent storage if possible.

Definition at line 280 of file spake2p.cpp.

280 {
281 return concat<secure_vector<uint8_t>>(m_w0.serialize(), m_l.serialize_uncompressed());
282}
constexpr auto concat(Rs &&... ranges)
Definition concat_util.h:95

References Botan::concat().

◆ ProverSecret

friend class ProverSecret
friend

Definition at line 192 of file spake2p.h.

References ProverSecret.

Referenced by ProverSecret.

◆ VerifierContext

friend class VerifierContext
friend

Definition at line 193 of file spake2p.h.

References VerifierContext.

Referenced by VerifierContext.


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