Skip to content

KDFGenerator

KDF Generator class. More...

#include <KDFGenerator.hpp>

Public Types

Name
using typename ecdsa_t::pubkey::public_key< PolicyType >::signature_type SignatureType
using std::string ECDSAPubKey

Public Functions

Name
KDFGenerator(const ecdsa_t::pubkey::ext_private_key< PolicyType > & own_prvt_key, const ECDSAPubKey & other_party_key)
Constructs a new KDFGenerator object.
std::string GenerateSharedSecret(const ecdsa_t::pubkey::ext_private_key< PolicyType > & own_prvt_key, const ECDSAPubKey & other_party_key)
Generates a shared secret with a new derived key.
ecdsa_t::scalar_field_value_type GetNewKeyFromSecret(std::string_view signed_secret, const ECDSAPubKey & signer_pubkey, const ECDSAPubKey & verifier_pubkey)
Extracts the derived new key from the signed secret.
bool operator==(const KDFGenerator & other) const
Checks if the encryptor is the same for the KDF.
ecdsa_t::pubkey::public_key< PolicyType > BuildPublicKeyECDSA(const ECDSAPubKey & pubkey_data)
Builds the public key data type from the data.

Public Attributes

Name
std::size_t EXPECTED_SECRET_SIZE
Expected size of the signature in bytes.

Detailed Description

template <typename PolicyType >
class KDFGenerator;

KDF Generator class.

Public Types Documentation

using SignatureType

using KDFGenerator< PolicyType >::SignatureType = typename ecdsa_t::pubkey::public_key<PolicyType>::signature_type;

using ECDSAPubKey

using KDFGenerator< PolicyType >::ECDSAPubKey = std::string;

Public Functions Documentation

function KDFGenerator

explicit KDFGenerator(
    const ecdsa_t::pubkey::ext_private_key< PolicyType > & own_prvt_key,
    const ECDSAPubKey & other_party_key
)

Constructs a new KDFGenerator object.

Parameters:

  • own_prvt_key The private key from the owner of the instance
  • other_party_key The public key data from the other party

function GenerateSharedSecret

std::string GenerateSharedSecret(
    const ecdsa_t::pubkey::ext_private_key< PolicyType > & own_prvt_key,
    const ECDSAPubKey & other_party_key
)

Generates a shared secret with a new derived key.

Parameters:

  • own_prvt_key Key to sign the secret
  • other_party_key public key of other party

Return: The secret that represents the signed data and new derived key

function GetNewKeyFromSecret

ecdsa_t::scalar_field_value_type GetNewKeyFromSecret(
    std::string_view signed_secret,
    const ECDSAPubKey & signer_pubkey,
    const ECDSAPubKey & verifier_pubkey
)

Extracts the derived new key from the signed secret.

Parameters:

  • signed_secret The shared secret
  • signer_pubkey The public key data from the signer of the secret
  • verifier_pubkey The public key data that will be checked on the signature

Return: New derived key scalar value

Warning: If the signature can't be verified or the data decrypted, it throws a runtime exception

function operator==

inline bool operator==(
    const KDFGenerator & other
) const

Checks if the encryptor is the same for the KDF.

Parameters:

  • other The other KDF instance

Return: true if the encryptors are the same, false otherwise

function BuildPublicKeyECDSA

static ecdsa_t::pubkey::public_key< PolicyType > BuildPublicKeyECDSA(
    const ECDSAPubKey & pubkey_data
)

Builds the public key data type from the data.

Parameters:

  • pubkey_data String representation of X+Y coordinates

Return: The ECDSA public key object

Public Attributes Documentation

variable EXPECTED_SECRET_SIZE

static std::size_t EXPECTED_SECRET_SIZE = 192;

Expected size of the signature in bytes.


Updated on 2026-03-04 at 13:10:44 -0800