prf::control::test::FakeKeyService class final

Base classes

class prf::crypto::IKeyService
Crypto-backed key service used by control interface.

Constructors, destructors, conversion operators

FakeKeyService(const uint8_t admin_seed_base = 0xB0u, const bool admin_key_is_admin = false) explicit

Public functions

void add_admin_key()
auto add_trusted_key(const prf::crypto::Ed25519PublicKey& public_key, const prf::crypto::KeyFlags flags, prf::crypto::KeyId* out_key_id) -> bool override
Adds one trusted public key with selected role flags.
auto admin_key_id() const -> const prf::crypto::KeyId&
auto device_identity(prf::crypto::Ed25519PublicKey* out_public_key, prf::crypto::KeyId* out_key_id) const -> bool override
Returns device public key and its deterministic key identifier.
auto for_each_trusted_key(const TrustedKeyVisitor visitor, void*const user_ctx, size_t*const out_count) const -> bool override
Iterates all trusted keys stored in keyring without intermediate list materialization.
auto has_admin_trusted_key() const -> bool override
Returns true when any stored key is both trusted and admin.
auto is_admin_key(std::span<const uint8_t> key_id) const -> bool override
Returns true when key id exists and has admin flag enabled.
auto remove_trusted_key(std::span<const uint8_t> key_id) -> bool override
Removes one trusted key selected by key id.
auto sign(std::span<const uint8_t> message, prf::crypto::Ed25519Signature*const out_signature) const -> bool override
Signs message bytes with device private key.
auto sign_admin_cose(std::span<const uint8_t> payload, const uint16_t content_format, std::span<const uint8_t> nonce = {}) const -> std::vector<uint8_t>
auto sign_admin_cose_bootstrap(std::span<const uint8_t> payload, const uint16_t content_format, std::span<const uint8_t> nonce, const uint8_t bootstrap_code) const -> std::vector<uint8_t>
auto update_trusted_key_flags(std::span<const uint8_t> key_id, const prf::crypto::KeyFlags mask, const prf::crypto::KeyFlags values) -> bool override
Updates role flags for one trusted key.
auto verify(std::span<const uint8_t> message, const prf::crypto::Ed25519Signature& signature, std::span<const uint8_t> key_id) const -> bool override
Verifies message signature against stored key selected by key id.

Function documentation

bool prf::control::test::FakeKeyService::for_each_trusted_key(const TrustedKeyVisitor visitor, void*const user_ctx, size_t*const out_count) const override

Iterates all trusted keys stored in keyring without intermediate list materialization.

out_count is optional and returns number of emitted records.