cardano::ed25519::PrivateKey class

Represent an Ed25519 private key.

Public static functions

static auto generate() →  PrivateKey

Constructors, destructors, conversion operators

PrivateKey() protected defaulted
PrivateKey(std::span<const uint8_t, KEY_SIZE> prv) explicit
Construct a key object from a span of key bytes.

Public functions

auto bytes() const →  const KeyByteArray& constexpr
Return a constant reference to the private key secure byte array.
auto publicKey() const →  PublicKey
Derive the public key paired with this private key.
auto sign(std::span<const uint8_t> msg) const →  ByteArray<SIGNATURE_SIZE>
Generate a message signature from the private key.

Function documentation

static PrivateKey cardano::ed25519::PrivateKey::generate()

Factory method to create a new Ed25519 private key from a cryptographically secure random number generator.

cardano::ed25519::PrivateKey::PrivateKey() protected defaulted

Make the default constructor protected so that it can only be used internally. The key will be all zeros.

cardano::ed25519::PrivateKey::PrivateKey(std::span<const uint8_t, KEY_SIZE> prv) explicit

Construct a key object from a span of key bytes.

Parameters
prv A span of 32 bytes that will be moved into the object.

ByteArray<SIGNATURE_SIZE> cardano::ed25519::PrivateKey::sign(std::span<const uint8_t> msg) const

Generate a message signature from the private key.

Parameters
msg A span of bytes (uint8_t) representing the message to sign.