cardano::stake_pool::KesSigningKey class

A KES signing key used by stake pools to sign blocks.

Base classes

template <size_t Depth>
class cardano::SumKesPrivateKey<STAKE_POOL_KES_DEPTH>
KES private key based on the sum composition.

Public static variables

static size_t size constexpr
Size of the secret key in bytes.

Public static functions

static auto generate() →  KesSigningKey
static auto keygen(std::span<uint8_t, SumKesPrivateKey<Depth>::size+4> key_buffer, std::span<uint8_t, KesSeed::size> seed) →  std::pair< SumKesPrivateKey< Depth >, KesPublicKey > -> auto
Key generation.

Constructors, destructors, conversion operators

KesSigningKey(std::span<uint8_t> pub) explicit
Construct a signing key object from a span of key bytes.

Public functions

auto bytes() const →  const SecureByteArray< SumKesPrivateKey< Depth >::size+4 > & -> auto constexpr
Return a constant reference to the private key bytes. The encoding returns the following array of size Self::SIZE + 4: ( sk_{-1} || seed || self.lhs_pk || self.rhs_pk || period ) where sk_{-1} is the secret secret key of lower depth. Note that the period is only included in the last layer.
void drop()
Zero out the private key.
auto period() →  size_t
Return the current period of the secret key.
auto publicKey() const →  KesPublicKey
Derive the public key paired with this private key.
void saveToFile(std::string_view fpath) const
Export the key to a file in the cardano node JSON format.
auto sign(std::span<const uint8_t> msg) const →  SumKesSignature<Depth>
Generate a message signature from the private key.
auto sign(std::string_view msg) const →  SumKesSignature<Depth>
Sign the message with the private key.
auto signCompact(std::span<const uint8_t> msg) const →  SumKesCompactSignature<Depth>
Sign the message with the private key and produce a compact signature.
auto signCompact(std::string_view msg) const →  SumKesCompactSignature<Depth>
Sign the message with the private key and produce a compact signature.
void update()
Update the key to the next period.
auto verificationKey() const →  KesVerificationKey
Derive the corresponding verification (public) key.

Function documentation

static KesSigningKey cardano::stake_pool::KesSigningKey::generate()

Returns A new KES signing key.

Factory method to create a new KES signing key from a cryptographically secure random number generator.

cardano::stake_pool::KesSigningKey::KesSigningKey(std::span<uint8_t> pub) explicit

Construct a signing key object from a span of key bytes.

Parameters
pub A span of key bytes that will be copied into the object.

void cardano::stake_pool::KesSigningKey::saveToFile(std::string_view fpath) const

Export the key to a file in the cardano node JSON format.

Parameters
fpath Path to the file to be (over)written.

KesVerificationKey cardano::stake_pool::KesSigningKey::verificationKey() const

Derive the corresponding verification (public) key.

Returns The verification key object.