|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
NVS-backed store for cross-sign target keys received via BLE. More...
#include <GpgRecvStore.h>
Public Member Functions | |
| bool | addKey (const gpg_recv_key_t &key) |
| Persist a new key. Replaces an existing entry if the fingerprint matches. | |
| uint8_t | count () |
| Number of stored keys. | |
| uint8_t | listIndex (gpg_recv_index_entry_t *out, uint8_t max) |
| Build the sorted index (oldest first). | |
| bool | getKey (uint8_t index, gpg_recv_key_t *out) |
| Load one key by sorted index (0..count()-1). | |
| bool | deleteKey (uint8_t index) |
| Remove one key by sorted index. No-op if index is out of range. | |
| bool | setSignature (uint8_t index, const uint8_t *sig, uint8_t sig_len, uint8_t flags) |
| Attach a cross-signature and flag bits to an existing entry. | |
Static Public Member Functions | |
| static GpgRecvStore & | instance () |
Static Public Attributes | |
| static constexpr uint8_t | kMaxKeys = 128 |
| Hard ceiling. Past this addKey rejects further inserts. | |
NVS-backed store for cross-sign target keys received via BLE.
Singleton. All public methods open and close their own NVS handle, so the store is safe to call from any task without external synchronisation (NVS itself serialises writes).
Definition at line 58 of file GpgRecvStore.h.
| bool cdc::mod_gpg::GpgRecvStore::addKey | ( | const gpg_recv_key_t & | key | ) |
Persist a new key. Replaces an existing entry if the fingerprint matches.
Definition at line 51 of file GpgRecvStore.cpp.
References count(), cdc::mod_gpg::gpg_recv_key_t::fingerprint_v4, kMaxKeys, LOG_W, name, and TAG.
| uint8_t cdc::mod_gpg::GpgRecvStore::count | ( | ) |
Number of stored keys.
Definition at line 66 of file GpgRecvStore.cpp.
References kMaxKeys.
Referenced by addKey().
| bool cdc::mod_gpg::GpgRecvStore::deleteKey | ( | uint8_t | index | ) |
Remove one key by sorted index. No-op if index is out of range.
Definition at line 131 of file GpgRecvStore.cpp.
References cdc::core::NvsScope::commit(), and name.
Referenced by cdc::mod_gpg::onReceivedDeleteConfirm().
| bool cdc::mod_gpg::GpgRecvStore::getKey | ( | uint8_t | index, |
| gpg_recv_key_t * | out ) |
Load one key by sorted index (0..count()-1).
Definition at line 124 of file GpgRecvStore.cpp.
References name.
Referenced by cdc::mod_gpg::onReceivedSignConfirm().
|
static |
Definition at line 24 of file GpgRecvStore.cpp.
Referenced by cdc::mod_gpg::cmd_gpg_cross_sign(), cdc::mod_gpg::cmd_gpg_export_signed(), cdc::mod_gpg::cmd_gpg_recv_delete(), cdc::mod_gpg::cmd_gpg_recv_info(), cdc::mod_gpg::cmd_gpg_recv_list(), cdc::mod_gpg::onReceivedDeleteConfirm(), cdc::mod_gpg::onReceivedListSelect(), cdc::mod_gpg::onReceivedSignConfirm(), and cdc::mod_gpg::rebuildReceivedList().
| uint8_t cdc::mod_gpg::GpgRecvStore::listIndex | ( | gpg_recv_index_entry_t * | out, |
| uint8_t | max ) |
Build the sorted index (oldest first).
| out | Caller-owned buffer of at least max entries (use PSRAM). |
| max | Capacity of out. |
Definition at line 83 of file GpgRecvStore.cpp.
References cdc::mod_gpg::gpg_recv_index_entry_t::flags, cdc::mod_gpg::gpg_recv_key_t::flags, cdc::mod_gpg::gpg_recv_index_entry_t::received_at, and cdc::mod_gpg::gpg_recv_key_t::received_at.
| bool cdc::mod_gpg::GpgRecvStore::setSignature | ( | uint8_t | index, |
| const uint8_t * | sig, | ||
| uint8_t | sig_len, | ||
| uint8_t | flags ) |
Attach a cross-signature and flag bits to an existing entry.
Definition at line 141 of file GpgRecvStore.cpp.
References cdc::mod_gpg::gpg_recv_key_t::flags, flags, cdc::mod_gpg::gpg_recv_key_t::my_signature, name, and cdc::mod_gpg::gpg_recv_key_t::sig_len.
|
staticconstexpr |
Hard ceiling. Past this addKey rejects further inserts.
Definition at line 61 of file GpgRecvStore.h.
Referenced by addKey(), cdc::mod_gpg::cmd_gpg_recv_list(), count(), and cdc::mod_gpg::rebuildReceivedList().