|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
NVS-backed store of third-party certifications on the badge's own key. More...
#include <GpgSelfCertStore.h>
Public Member Functions | |
| bool | addCert (const gpg_self_cert_t &cert) |
| Persist a certification. Replaces an existing entry from the same issuer. | |
| uint8_t | count () |
| Number of stored certifications. | |
| uint8_t | listIndex (gpg_self_cert_index_entry_t *out, uint8_t max) |
| Build the sorted index (oldest first). | |
| bool | getCert (uint8_t index, gpg_self_cert_t *out) |
| Load one certification by sorted index (0..count()-1). | |
| bool | deleteCert (uint8_t index) |
| Remove one certification by sorted index. No-op if out of range. | |
Static Public Member Functions | |
| static GpgSelfCertStore & | instance () |
Static Public Attributes | |
| static constexpr uint8_t | kMaxCerts = 16 |
| Hard ceiling. Past this addCert rejects further inserts. | |
NVS-backed store of third-party certifications on the badge's own key.
Singleton. All public methods open and close their own NVS handle, so the store is safe to call from any task without external synchronisation.
Definition at line 48 of file GpgSelfCertStore.h.
| bool cdc::mod_gpg::GpgSelfCertStore::addCert | ( | const gpg_self_cert_t & | cert | ) |
Persist a certification. Replaces an existing entry from the same issuer.
Definition at line 51 of file GpgSelfCertStore.cpp.
References count(), cdc::mod_gpg::gpg_self_cert_t::issuer_fp_v4, cdc::mod_gpg::kGpgSelfCertSigMax, kMaxCerts, LOG_W, name, cdc::mod_gpg::gpg_self_cert_t::sig_pkt_len, and TAG.
| uint8_t cdc::mod_gpg::GpgSelfCertStore::count | ( | ) |
Number of stored certifications.
Definition at line 66 of file GpgSelfCertStore.cpp.
References kMaxCerts.
Referenced by addCert().
| bool cdc::mod_gpg::GpgSelfCertStore::deleteCert | ( | uint8_t | index | ) |
Remove one certification by sorted index. No-op if out of range.
Definition at line 130 of file GpgSelfCertStore.cpp.
References cdc::core::NvsScope::commit(), and name.
Referenced by cdc::mod_gpg::onMyCertDeleteConfirm().
| bool cdc::mod_gpg::GpgSelfCertStore::getCert | ( | uint8_t | index, |
| gpg_self_cert_t * | out ) |
Load one certification by sorted index (0..count()-1).
Definition at line 123 of file GpgSelfCertStore.cpp.
References name.
|
static |
Definition at line 23 of file GpgSelfCertStore.cpp.
Referenced by cdc::mod_gpg::cmd_gpg_mycert_delete(), cdc::mod_gpg::cmd_gpg_mycert_import(), cdc::mod_gpg::cmd_gpg_mycert_list(), cdc::mod_gpg::deliverGpgCert(), cdc::mod_gpg::gpgBuildOwnSignedKeyArmored(), cdc::mod_gpg::onMyCertDeleteConfirm(), cdc::mod_gpg::onMyCertListSelect(), and cdc::mod_gpg::rebuildMyCertList().
| uint8_t cdc::mod_gpg::GpgSelfCertStore::listIndex | ( | gpg_self_cert_index_entry_t * | out, |
| uint8_t | max ) |
Build the sorted index (oldest first).
| out | Caller-owned buffer of at least max entries. |
| max | Capacity of out. |
Definition at line 83 of file GpgSelfCertStore.cpp.
References cdc::mod_gpg::gpg_self_cert_index_entry_t::received_at, and cdc::mod_gpg::gpg_self_cert_t::received_at.
|
staticconstexpr |
Hard ceiling. Past this addCert rejects further inserts.
Definition at line 51 of file GpgSelfCertStore.h.
Referenced by addCert(), cdc::mod_gpg::cmd_gpg_mycert_list(), count(), and cdc::mod_gpg::rebuildMyCertList().