CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
AttestationKeyService.h
Go to the documentation of this file.
1#pragma once
2
3#include "cdc_core/IService.h"
5#include <cstdint>
6
7namespace cdc::core {
8
10public:
11 static constexpr uint8_t ATTESTATION_ECC_SLOT = 0;
12
13 void setSecureElement(hal::ISecureElement* se) { secureElement_ = se; }
14
15 bool init() override;
16 bool start() override;
17 void stop() override;
18 ServiceState getState() const override { return state_; }
19 const char* getName() const override { return "attestation_key"; }
20
21 void onTick(uint32_t nowMs);
22
23private:
24 bool ensureKey();
25 bool loadStoredHash(uint8_t* out, size_t outLen);
26 bool saveStoredHash(const uint8_t* data, size_t len);
27
28 hal::ISecureElement* secureElement_ = nullptr;
30 bool ready_ = false;
31 uint32_t lastAttemptMs_ = 0;
32};
33
34} // namespace cdc::core
bool start() override
Starts service, ensures initialized state, and attempts to provision the attestation key synchronousl...
ServiceState getState() const override
void setSecureElement(hal::ISecureElement *se)
const char * getName() const override
void stop() override
Stops attestation-key background processing.
void onTick(uint32_t nowMs)
Periodically attempts to ensure attestation key exists and is valid.
bool init() override
Initializes service state.
static constexpr uint8_t ATTESTATION_ECC_SLOT