CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
cdc::mod_gpg Namespace Reference

Namespaces

namespace  openpgp

Classes

struct  gpg_status_t
 Snapshot of the current OpenPGP card-application state for UI display. More...
class  GpgModule
struct  gpg_recv_key_t
 One GPG public key received from another badge. More...
struct  gpg_recv_index_entry_t
 Sort entry used to expose a stable ordered index over NVS keys. More...
class  GpgRecvStore
 NVS-backed store for cross-sign target keys received via BLE. More...
struct  WizardState
struct  DecKeyStorage
struct  AesKeyStorage

Typedefs

using XsigReceivedCallback = void (*)(const gpg_recv_key_t& key)
 Callback invoked when a remote badge has finished pushing a key.

Enumerations

enum  GpgMenuAction : uintptr_t {
  GPG_MENU_STATUS = 1 , GPG_MENU_GENERATE , GPG_MENU_EXPORT , GPG_MENU_SEND ,
  GPG_MENU_RECEIVED , GPG_MENU_SETTINGS , GPG_MENU_RESET
}

Functions

bool ble_gpg_xsig_init ()
 Initialise the GPG cross-sign BLE endpoint.
void ble_gpg_xsig_set_received_callback (XsigReceivedCallback cb)
 Install / remove the "key received" notification.
bool ble_gpg_xsig_send (const uint8_t addr[6], uint8_t addr_type)
 Push the badge's own public key to a peer.
static void registerStrings ()
static void cmd_gpg_status (const char *args)
 Serial command printing current GPG key status.
static void cmd_gpg_generate (const char *args)
 Serial command generating GPG key with selected curve and user-id.
static void cmd_gpg_export (const char *args)
 Serial command exporting GPG public key in PEM format.
static void cmd_gpg_reset (const char *args)
static void cmd_gpg_recv_list (const char *args)
static void cmd_gpg_recv_info (const char *args)
static void cmd_gpg_recv_delete (const char *args)
static void cmd_gpg_cross_sign (const char *args)
static void cmd_gpg_export_signed (const char *args)
static void cmd_gpg (const char *args)
static void registerCommands ()
 Registers serial commands exposed by GPG module.
static void fp_to_hex (const uint8_t *fp, size_t len, char *out, size_t out_size)
static bool parse_index (const char *args, uint8_t *out)
static void showStatus ()
 Displays current GPG key status and metadata.
static void wizardStart ()
 Starts key-generation wizard flow.
static void showExport ()
 Exports public key to serial output and QR view.
static void confirmReset ()
 Opens reset confirmation dialog.
static void showSettings ()
 Shows GPG settings menu.
static void onSettingsSelect (uint16_t index, void *)
 Handles settings-menu selection for PW1/PW3 change flow.
static void showSendKey ()
static void showReceivedKeys ()
static void onMenuSelect (uint16_t, void *userData)
 Handles GPG main-menu selections via the entry's userData tag.
static ui::ListItem makeMenuItem (const char *label, GpgMenuAction action)
static void rebuildMenu ()
 Rebuilds GPG main menu labels and populates userData tags.
static bool gpg_verify_pw1 (const char *pin)
 Verifies OpenPGP PW1 using persistent pin-storage backend.
static bool gpg_verify_pw3 (const char *pin)
 Verifies OpenPGP PW3 using persistent pin-storage backend.
static bool gpg_change_pw1 (const char *, const char *newPin)
 Changes OpenPGP PW1 value.
static bool gpg_change_pw3 (const char *, const char *newPin)
 Changes OpenPGP PW3 value.
static uint8_t gpg_retries_pw1 ()
 Returns remaining retries for OpenPGP PW1.
static uint8_t gpg_retries_pw3 ()
 Returns remaining retries for OpenPGP PW3.
static bool gpg_blocked_pw1 ()
 Returns whether OpenPGP PW1 is blocked.
static bool gpg_blocked_pw3 ()
 Returns whether OpenPGP PW3 is blocked.
static void onGpgPinComplete (bool)
 Pin-change completion callback returning to previous view.
static void onWizardName (const char *text)
 Saves wizard name and opens email step.
static void onWizardEmail (const char *text)
 Saves wizard email and opens curve selection.
static void onWizardCurve (uint16_t index, void *)
 Finalizes wizard curve selection and triggers key generation.
static void onResetConfirm (void *)
 Confirm callback resetting all GPG key material.
static void rebuildReceivedList ()
static void onReceivedListSelect (uint16_t index, void *)
static void showReceivedDetail ()
static void onReceivedActionSelect (uint16_t index, void *)
static void onReceivedSignConfirm (void *)
static void onReceivedDeleteConfirm (void *)
bool calculateFingerprintV4 (uint8_t curve, const uint8_t *pubkey, size_t pubkey_len, uint32_t created_at, uint8_t out_fp[20])
 Compute the RFC 4880 V4 OpenPGP fingerprint (SHA-1, 20 bytes).
bool calculateFingerprintV5 (uint8_t curve, const uint8_t *pubkey, size_t pubkey_len, uint32_t created_at, uint8_t out_fp[32])
 Compute the V5 / RFC 9580 OpenPGP fingerprint (SHA-256, 32 bytes).
bool gpgCrossSignDigest (const uint8_t fp_v4[20], const char *user_id, uint8_t out_hash[32])
 Build the digest input for a cross-signature.
bool gpgCrossSign (const gpg_recv_key_t &target, uint32_t sig_creation_time, uint8_t out_sig[64])
 Cross-sign a received key with the badge's own SIG ECC slot.
bool gpgBuildSignedKeyArmored (const gpg_recv_key_t &key, char *out, size_t out_size, size_t *out_len)
 Build an ASCII-armored OpenPGP block carrying the cross-signed key.

Variables

constexpr uint8_t kGpgRecvFlagVerified = 0x01
constexpr ui::I18nEntry kStrings []
static constexpr const char * CMD_MODULE = "gpg"
static bool s_commandsRegistered = false
static const cdc::serial::SubCommand kGpgSubs []
static char s_reset_token [7] = {}
 Serial command resetting GPG key material.
static uint64_t s_reset_token_ts_us = 0
static constexpr uint64_t RESET_TOKEN_TIMEOUT_US = 30ULL * 1000ULL * 1000ULL
static ui::ListView s_menuView
static ui::ListView s_settingsView
static ui::PinChangeView s_pinChangeView
static ui::T9InputView s_t9Input
static ui::ListView s_curveView
static ui::InfoView s_infoView
static ui::QRCodeView s_qrView
static bool s_viewsInitialized = false
static ui::ListItem s_menuItems [8] = {}
static ui::ListItem s_settingsItems []
static WizardState s_wizard = {}
static ui::ListView s_recvListView
 Received-keys list UI state.
static ui::ListView s_recvActionView
static ui::ListItem s_recvListItems [GpgRecvStore::kMaxKeys+1]
static ui::ListItem s_recvActionItems [3]
static char s_recvListLabels [GpgRecvStore::kMaxKeys][72]
static uint8_t s_recvSelectedIndex = 0
static gpg_recv_key_t s_recvSelectedKey = {}
static char s_recvDetailText [640]
static char s_recvExportBuf [4096]

Detailed Description

Sender state machine: we discover the peer's RX handle, then write the payload in MTU-sized chunks.

Typedef Documentation

◆ XsigReceivedCallback

using cdc::mod_gpg::XsigReceivedCallback = void (*)(const gpg_recv_key_t& key)

Callback invoked when a remote badge has finished pushing a key.

The key has already been written through GpgRecvStore::addKey() before this callback fires; consumers use it to refresh UI state.

Definition at line 15 of file ble_gpg_xsig.h.

Enumeration Type Documentation

◆ GpgMenuAction

enum cdc::mod_gpg::GpgMenuAction : uintptr_t
Enumerator
GPG_MENU_STATUS 
GPG_MENU_GENERATE 
GPG_MENU_EXPORT 
GPG_MENU_SEND 
GPG_MENU_RECEIVED 
GPG_MENU_SETTINGS 
GPG_MENU_RESET 

Definition at line 389 of file GpgModule.cpp.

Function Documentation

◆ ble_gpg_xsig_init()

◆ ble_gpg_xsig_send()

bool cdc::mod_gpg::ble_gpg_xsig_send ( const uint8_t addr[6],
uint8_t addr_type )

Push the badge's own public key to a peer.

Establishes a connection to addr, discovers the GPG cross-sign service, writes the key payload to the RX characteristic and disconnects.

The badge's own key is built from gpg_get_status(); if no GPG key is configured the call returns false.

Definition at line 398 of file ble_gpg_xsig.cpp.

References cdc::hal::BleUuid::from128(), and cdc::hal::getBluetoothControllerInstance().

◆ ble_gpg_xsig_set_received_callback()

void cdc::mod_gpg::ble_gpg_xsig_set_received_callback ( XsigReceivedCallback cb)

Install / remove the "key received" notification.

Definition at line 292 of file ble_gpg_xsig.cpp.

Referenced by cdc::mod_gpg::GpgModule::start().

◆ calculateFingerprintV4()

bool cdc::mod_gpg::calculateFingerprintV4 ( uint8_t curve,
const uint8_t * pubkey,
size_t pubkey_len,
uint32_t created_at,
uint8_t out_fp[20] )

Compute the RFC 4880 V4 OpenPGP fingerprint (SHA-1, 20 bytes).

Parameters
curveCDC_CURVE_ED25519 or CDC_CURVE_P256.
pubkey32-byte Ed25519 point or raw 64-byte P-256 (X || Y, no SEC1 prefix).
pubkey_lenLength of pubkey (32 or 64).
created_atKey creation timestamp (Unix epoch seconds).
out_fp20-byte output buffer.
Returns
true on success.

Definition at line 75 of file fingerprint.cpp.

References curve.

◆ calculateFingerprintV5()

bool cdc::mod_gpg::calculateFingerprintV5 ( uint8_t curve,
const uint8_t * pubkey,
size_t pubkey_len,
uint32_t created_at,
uint8_t out_fp[32] )

Compute the V5 / RFC 9580 OpenPGP fingerprint (SHA-256, 32 bytes).

Uses the same body layout as V4 (version 0x04, EdDSA/ECDSA algo byte, curve OID, MPI). Differs from V4 in the hash function and in the prefix: 0x9A || 4-byte body length (vs V4's 0x99 || 2-byte length).

Definition at line 103 of file fingerprint.cpp.

References curve.

◆ cmd_gpg()

void cdc::mod_gpg::cmd_gpg ( const char * args)
static

Definition at line 106 of file GpgModule.cpp.

References cdc::serial::dispatchSubCommand(), and kGpgSubs.

Referenced by registerCommands().

◆ cmd_gpg_cross_sign()

void cdc::mod_gpg::cmd_gpg_cross_sign ( const char * args)
static

◆ cmd_gpg_export()

void cdc::mod_gpg::cmd_gpg_export ( const char * args)
static

Serial command exporting GPG public key in PEM format.

Parameters
argsUnused command arguments.

Definition at line 179 of file GpgModule.cpp.

References gpg_export_pubkey_pem(), and cdc::serial::Console::printf().

◆ cmd_gpg_export_signed()

void cdc::mod_gpg::cmd_gpg_export_signed ( const char * args)
static

◆ cmd_gpg_generate()

void cdc::mod_gpg::cmd_gpg_generate ( const char * args)
static

Serial command generating GPG key with selected curve and user-id.

Parameters
argsCommand arguments (<curve> <user_id>).

Definition at line 144 of file GpgModule.cpp.

References CDC_CURVE_ED25519, CDC_CURVE_P256, curve, gpg_generate_key(), gpg_set_pending_user_id(), GPG_USER_ID_MAX, and cdc::serial::Console::printf().

◆ cmd_gpg_recv_delete()

void cdc::mod_gpg::cmd_gpg_recv_delete ( const char * args)
static

◆ cmd_gpg_recv_info()

◆ cmd_gpg_recv_list()

◆ cmd_gpg_reset()

void cdc::mod_gpg::cmd_gpg_reset ( const char * args)
static

◆ cmd_gpg_status()

void cdc::mod_gpg::cmd_gpg_status ( const char * args)
static

Serial command printing current GPG key status.

Parameters
argsUnused command arguments.

Definition at line 126 of file GpgModule.cpp.

References CDC_CURVE_ED25519, cdc::mod_gpg::gpg_status_t::created_at, cdc::mod_gpg::gpg_status_t::curve, gpg_get_status(), cdc::serial::Console::printf(), cdc::mod_gpg::gpg_status_t::sign_count, and cdc::mod_gpg::gpg_status_t::user_id.

◆ confirmReset()

void cdc::mod_gpg::confirmReset ( )
static

Opens reset confirmation dialog.

Definition at line 726 of file GpgModule.cpp.

References onResetConfirm(), cdc::ui::showConfirm(), cdc::ui::tr(), and cdc::ui::ConfirmView::WARNING.

Referenced by onMenuSelect().

◆ fp_to_hex()

void cdc::mod_gpg::fp_to_hex ( const uint8_t * fp,
size_t len,
char * out,
size_t out_size )
static

Definition at line 221 of file GpgModule.cpp.

Referenced by cmd_gpg_recv_info(), cmd_gpg_recv_list(), and showReceivedDetail().

◆ gpg_blocked_pw1()

bool cdc::mod_gpg::gpg_blocked_pw1 ( )
static

Returns whether OpenPGP PW1 is blocked.

Returns
true when blocked.

Definition at line 505 of file GpgModule.cpp.

References pin_storage_openpgp_pw1_blocked().

Referenced by onSettingsSelect().

◆ gpg_blocked_pw3()

bool cdc::mod_gpg::gpg_blocked_pw3 ( )
static

Returns whether OpenPGP PW3 is blocked.

Returns
true when blocked.

Definition at line 513 of file GpgModule.cpp.

References pin_storage_openpgp_pw3_blocked().

Referenced by onSettingsSelect().

◆ gpg_change_pw1()

bool cdc::mod_gpg::gpg_change_pw1 ( const char * ,
const char * newPin )
static

Changes OpenPGP PW1 value.

Parameters
oldPinIgnored old PIN parameter from generic callback signature.
newPinNew PW1 value.
Returns
true on success.

Definition at line 471 of file GpgModule.cpp.

References pin_storage_openpgp_change_pw1().

Referenced by onSettingsSelect().

◆ gpg_change_pw3()

bool cdc::mod_gpg::gpg_change_pw3 ( const char * ,
const char * newPin )
static

Changes OpenPGP PW3 value.

Parameters
oldPinIgnored old PIN parameter from generic callback signature.
newPinNew PW3 value.
Returns
true on success.

Definition at line 481 of file GpgModule.cpp.

References pin_storage_openpgp_change_pw3().

Referenced by onSettingsSelect().

◆ gpg_retries_pw1()

uint8_t cdc::mod_gpg::gpg_retries_pw1 ( )
static

Returns remaining retries for OpenPGP PW1.

Returns
Retry counter.

Definition at line 489 of file GpgModule.cpp.

References pin_storage_openpgp_pw1_retries().

Referenced by onSettingsSelect().

◆ gpg_retries_pw3()

uint8_t cdc::mod_gpg::gpg_retries_pw3 ( )
static

Returns remaining retries for OpenPGP PW3.

Returns
Retry counter.

Definition at line 497 of file GpgModule.cpp.

References pin_storage_openpgp_pw3_retries().

Referenced by onSettingsSelect().

◆ gpg_verify_pw1()

bool cdc::mod_gpg::gpg_verify_pw1 ( const char * pin)
static

Verifies OpenPGP PW1 using persistent pin-storage backend.

Parameters
pinCandidate PW1 value.
Returns
true when valid.

Definition at line 452 of file GpgModule.cpp.

References pin_storage_openpgp_verify_pw1().

Referenced by onSettingsSelect().

◆ gpg_verify_pw3()

bool cdc::mod_gpg::gpg_verify_pw3 ( const char * pin)
static

Verifies OpenPGP PW3 using persistent pin-storage backend.

Parameters
pinCandidate PW3 value.
Returns
true when valid.

Definition at line 461 of file GpgModule.cpp.

References pin_storage_openpgp_verify_pw3().

Referenced by onSettingsSelect().

◆ gpgBuildSignedKeyArmored()

bool cdc::mod_gpg::gpgBuildSignedKeyArmored ( const gpg_recv_key_t & key,
char * out,
size_t out_size,
size_t * out_len )

Build an ASCII-armored OpenPGP block carrying the cross-signed key.

Packs the received key as Public Key Packet (Tag 6) + User ID Packet (Tag 13) + Certification Signature Packet (Tag 2) into a single BEGIN/END PGP PUBLIC KEY BLOCK payload. Suitable for gpg --import.

Parameters
keyReceived key descriptor (must already have my_signature).
outOutput character buffer.
out_sizeCapacity of out.
out_lenBytes written (excluding any terminating null).
Returns
true on success; false on buffer overflow or invalid input.

Definition at line 283 of file xsig.cpp.

References CDC_CURVE_ED25519, cdc::mod_gpg::gpg_status_t::curve, cdc::mod_gpg::gpg_status_t::fingerprint, gpg_get_status(), cdc::mod_gpg::gpg_recv_key_t::my_signature, OPENPGP_ALGO_ECDSA, OPENPGP_ALGO_EDDSA, cdc::mod_gpg::gpg_recv_key_t::received_at, cdc::mod_gpg::gpg_recv_key_t::sig_len, and cdc::mod_gpg::gpg_recv_key_t::user_id.

Referenced by cmd_gpg_export_signed(), and onReceivedActionSelect().

◆ gpgCrossSign()

bool cdc::mod_gpg::gpgCrossSign ( const gpg_recv_key_t & target,
uint32_t sig_creation_time,
uint8_t out_sig[64] )

Cross-sign a received key with the badge's own SIG ECC slot.

Builds the RFC 4880 certification hash (sig type 0x10 over the target's Public Key Packet + User ID Packet), signs it with the badge's signature subkey via TROPIC01, and returns R || S as 64 bytes.

The badge's own curve is read from gpg_get_status; sig length is always 64 regardless of curve (Ed25519 and P-256 both produce 32+32-byte concatenated R || S in this implementation).

Parameters
targetReceived key descriptor.
sig_creation_timeTimestamp embedded into the hashed-subpackets.
out_sig64-byte output (R || S).
Returns
true on success.

Definition at line 193 of file xsig.cpp.

References CDC_CURVE_ED25519, cdc::mod_gpg::gpg_status_t::curve, cdc::hal::getSecureElementInstance(), gpg_get_status(), gpg_storage_sig_slot(), LOG_W, cdc::hal::OK, OPENPGP_ALGO_ECDSA, OPENPGP_ALGO_EDDSA, TAG, and cdc::mod_gpg::gpg_recv_key_t::user_id.

Referenced by cmd_gpg_cross_sign(), and onReceivedSignConfirm().

◆ gpgCrossSignDigest()

bool cdc::mod_gpg::gpgCrossSignDigest ( const uint8_t fp_v4[20],
const char * user_id,
uint8_t out_hash[32] )

Build the digest input for a cross-signature.

Per docs/CROSS_SIGNING.md: data = fp_v4 (20 B) || user_id padded with zeros to 64 B hash = SHA-256(data)

Definition at line 134 of file fingerprint.cpp.

References user_id.

◆ makeMenuItem()

ui::ListItem cdc::mod_gpg::makeMenuItem ( const char * label,
GpgMenuAction action )
inlinestatic

Definition at line 424 of file GpgModule.cpp.

Referenced by rebuildMenu().

◆ onGpgPinComplete()

void cdc::mod_gpg::onGpgPinComplete ( bool )
static

Pin-change completion callback returning to previous view.

Parameters
changedResult flag (unused).

Definition at line 521 of file GpgModule.cpp.

References cdc::ui::ViewStack::instance(), and cdc::ui::ViewStack::pop().

Referenced by onSettingsSelect().

◆ onMenuSelect()

void cdc::mod_gpg::onMenuSelect ( uint16_t ,
void * userData )
static

◆ onReceivedActionSelect()

◆ onReceivedDeleteConfirm()

◆ onReceivedListSelect()

void cdc::mod_gpg::onReceivedListSelect ( uint16_t index,
void * userData )
static

◆ onReceivedSignConfirm()

◆ onResetConfirm()

void cdc::mod_gpg::onResetConfirm ( void * )
static

Confirm callback resetting all GPG key material.

Parameters
userDataOptional callback context (unused).

Definition at line 715 of file GpgModule.cpp.

References gpg_reset(), cdc::ui::showToastError(), cdc::ui::showToastSuccess(), and cdc::ui::tr().

Referenced by confirmReset().

◆ onSettingsSelect()

void cdc::mod_gpg::onSettingsSelect ( uint16_t index,
void *  )
static

◆ onWizardCurve()

void cdc::mod_gpg::onWizardCurve ( uint16_t index,
void *  )
static

Finalizes wizard curve selection and triggers key generation.

Parameters
indexSelected curve index.
userDataOptional callback context (unused).

Definition at line 634 of file GpgModule.cpp.

References CDC_CURVE_ED25519, CDC_CURVE_P256, gpg_generate_key(), gpg_set_pending_user_id(), GPG_USER_ID_MAX, cdc::ui::ViewStack::instance(), cdc::ui::ViewStack::pop(), s_wizard, cdc::ui::showToastError(), cdc::ui::showToastSuccess(), cdc::ui::tr(), and user_id.

Referenced by onWizardEmail().

◆ onWizardEmail()

void cdc::mod_gpg::onWizardEmail ( const char * text)
static

Saves wizard email and opens curve selection.

Parameters
textEntered email.

Definition at line 616 of file GpgModule.cpp.

References cdc::ui::ViewStack::instance(), cdc::ui::ListItem::label, onWizardCurve(), cdc::ui::ViewStack::push(), s_curveView, s_wizard, and cdc::ui::tr().

Referenced by onWizardName().

◆ onWizardName()

void cdc::mod_gpg::onWizardName ( const char * text)
static

Saves wizard name and opens email step.

Parameters
textEntered name.

Definition at line 605 of file GpgModule.cpp.

References cdc::ui::ViewStack::instance(), onWizardEmail(), cdc::ui::ViewStack::push(), s_t9Input, s_wizard, and cdc::ui::tr().

Referenced by wizardStart().

◆ parse_index()

bool cdc::mod_gpg::parse_index ( const char * args,
uint8_t * out )
static

◆ rebuildMenu()

void cdc::mod_gpg::rebuildMenu ( )
static

◆ rebuildReceivedList()

◆ registerCommands()

void cdc::mod_gpg::registerCommands ( )
static

Registers serial commands exposed by GPG module.

Definition at line 113 of file GpgModule.cpp.

References cmd_gpg(), CMD_MODULE, cdc::serial::getCommandRegistry(), kGpgSubs, and s_commandsRegistered.

Referenced by cdc::mod_gpg::GpgModule::init().

◆ registerStrings()

void cdc::mod_gpg::registerStrings ( )
static

◆ showExport()

◆ showReceivedDetail()

◆ showReceivedKeys()

void cdc::mod_gpg::showReceivedKeys ( )
static

◆ showSendKey()

void cdc::mod_gpg::showSendKey ( )
static

Definition at line 751 of file GpgModule.cpp.

References cdc::ui::showToast().

Referenced by onMenuSelect().

◆ showSettings()

void cdc::mod_gpg::showSettings ( )
static

Shows GPG settings menu.

Definition at line 552 of file GpgModule.cpp.

References cdc::ui::ViewStack::instance(), onSettingsSelect(), cdc::ui::ViewStack::push(), s_settingsItems, s_settingsView, and cdc::ui::tr().

Referenced by onMenuSelect().

◆ showStatus()

◆ wizardStart()

void cdc::mod_gpg::wizardStart ( )
static

Starts key-generation wizard flow.

Definition at line 594 of file GpgModule.cpp.

References cdc::ui::ViewStack::instance(), onWizardName(), cdc::ui::ViewStack::push(), s_t9Input, s_wizard, and cdc::ui::tr().

Referenced by onMenuSelect().

Variable Documentation

◆ CMD_MODULE

const char* cdc::mod_gpg::CMD_MODULE = "gpg"
staticconstexpr

Definition at line 80 of file GpgModule.cpp.

Referenced by registerCommands().

◆ kGpgRecvFlagVerified

uint8_t cdc::mod_gpg::kGpgRecvFlagVerified = 0x01
constexpr

Definition at line 8 of file GpgRecvStore.h.

Referenced by cmd_gpg_cross_sign(), cmd_gpg_recv_info(), and onReceivedSignConfirm().

◆ kGpgSubs

const cdc::serial::SubCommand cdc::mod_gpg::kGpgSubs[]
static
Initial value:
= {
{"STATUS", "", "Show keys, fingerprints, counters", cmd_gpg_status},
{"GENERATE", "<curve> <user_id>", "Generate SIG+DEC+AUT keys (curve 1=Ed25519, 2=P-256)", cmd_gpg_generate},
{"EXPORT", "", "Print primary + subkey public keys as PEM", cmd_gpg_export},
{"RESET", "[token]", "Two-step destructive reset of all GPG keys", cmd_gpg_reset},
{"RECV_LIST", "", "List received cross-sign keys", cmd_gpg_recv_list},
{"RECV_INFO", "<index>", "Show received key details", cmd_gpg_recv_info},
{"RECV_DELETE", "<index>", "Delete received key", cmd_gpg_recv_delete},
{"CROSS_SIGN", "<index>", "Cross-sign a received key", cmd_gpg_cross_sign},
{"EXPORT_SIGNED","<index>", "Export signed key as ASCII-armored OpenPGP block", cmd_gpg_export_signed},
{nullptr, nullptr, nullptr, nullptr},
}
static void cmd_gpg_recv_info(const char *args)
static void cmd_gpg_status(const char *args)
Serial command printing current GPG key status.
static void cmd_gpg_cross_sign(const char *args)
static void cmd_gpg_recv_list(const char *args)
static void cmd_gpg_recv_delete(const char *args)
static void cmd_gpg_export(const char *args)
Serial command exporting GPG public key in PEM format.
static void cmd_gpg_reset(const char *args)
static void cmd_gpg_export_signed(const char *args)
static void cmd_gpg_generate(const char *args)
Serial command generating GPG key with selected curve and user-id.

Definition at line 93 of file GpgModule.cpp.

Referenced by cmd_gpg(), and registerCommands().

◆ kStrings

ui::I18nEntry cdc::mod_gpg::kStrings[]
constexpr

Definition at line 40 of file GpgModule.cpp.

Referenced by registerStrings().

◆ RESET_TOKEN_TIMEOUT_US

uint64_t cdc::mod_gpg::RESET_TOKEN_TIMEOUT_US = 30ULL * 1000ULL * 1000ULL
staticconstexpr

Definition at line 196 of file GpgModule.cpp.

Referenced by cmd_gpg_reset().

◆ s_commandsRegistered

bool cdc::mod_gpg::s_commandsRegistered = false
static

Definition at line 81 of file GpgModule.cpp.

Referenced by registerCommands().

◆ s_curveView

ui::ListView cdc::mod_gpg::s_curveView
static

Definition at line 371 of file GpgModule.cpp.

Referenced by onWizardEmail().

◆ s_infoView

ui::InfoView cdc::mod_gpg::s_infoView
static

Definition at line 372 of file GpgModule.cpp.

Referenced by onReceivedActionSelect(), showReceivedDetail(), and showStatus().

◆ s_menuItems

ui::ListItem cdc::mod_gpg::s_menuItems[8] = {}
static

Definition at line 375 of file GpgModule.cpp.

Referenced by rebuildMenu().

◆ s_menuView

ui::ListView cdc::mod_gpg::s_menuView
static

Definition at line 367 of file GpgModule.cpp.

Referenced by cdc::mod_gpg::GpgModule::getMenuItems(), and rebuildMenu().

◆ s_pinChangeView

ui::PinChangeView cdc::mod_gpg::s_pinChangeView
static

Definition at line 369 of file GpgModule.cpp.

Referenced by onSettingsSelect().

◆ s_qrView

ui::QRCodeView cdc::mod_gpg::s_qrView
static

Definition at line 373 of file GpgModule.cpp.

Referenced by showExport().

◆ s_recvActionItems

ui::ListItem cdc::mod_gpg::s_recvActionItems[3]
static

Definition at line 737 of file GpgModule.cpp.

Referenced by showReceivedDetail().

◆ s_recvActionView

ui::ListView cdc::mod_gpg::s_recvActionView
static

Definition at line 735 of file GpgModule.cpp.

Referenced by showReceivedDetail().

◆ s_recvDetailText

char cdc::mod_gpg::s_recvDetailText[640]
static

Definition at line 741 of file GpgModule.cpp.

Referenced by showReceivedDetail().

◆ s_recvExportBuf

char cdc::mod_gpg::s_recvExportBuf[4096]
static

Definition at line 742 of file GpgModule.cpp.

Referenced by onReceivedActionSelect().

◆ s_recvListItems

ui::ListItem cdc::mod_gpg::s_recvListItems[GpgRecvStore::kMaxKeys+1]
static

Definition at line 736 of file GpgModule.cpp.

Referenced by rebuildReceivedList().

◆ s_recvListLabels

char cdc::mod_gpg::s_recvListLabels[GpgRecvStore::kMaxKeys][72]
static

Definition at line 738 of file GpgModule.cpp.

Referenced by rebuildReceivedList().

◆ s_recvListView

ui::ListView cdc::mod_gpg::s_recvListView
static

Received-keys list UI state.

Definition at line 734 of file GpgModule.cpp.

Referenced by rebuildReceivedList(), and showReceivedKeys().

◆ s_recvSelectedIndex

uint8_t cdc::mod_gpg::s_recvSelectedIndex = 0
static

◆ s_recvSelectedKey

gpg_recv_key_t cdc::mod_gpg::s_recvSelectedKey = {}
static

◆ s_reset_token

char cdc::mod_gpg::s_reset_token[7] = {}
static

Serial command resetting GPG key material.

Parameters
argsUnused command arguments.

Definition at line 194 of file GpgModule.cpp.

Referenced by cmd_gpg_reset().

◆ s_reset_token_ts_us

uint64_t cdc::mod_gpg::s_reset_token_ts_us = 0
static

Definition at line 195 of file GpgModule.cpp.

Referenced by cmd_gpg_reset().

◆ s_settingsItems

ui::ListItem cdc::mod_gpg::s_settingsItems[]
static
Initial value:
= {
{ nullptr, 0, false, nullptr },
{ nullptr, 0, false, nullptr },
}

Definition at line 376 of file GpgModule.cpp.

Referenced by showSettings().

◆ s_settingsView

ui::ListView cdc::mod_gpg::s_settingsView
static

Definition at line 368 of file GpgModule.cpp.

Referenced by showSettings().

◆ s_t9Input

ui::T9InputView cdc::mod_gpg::s_t9Input
static

Definition at line 370 of file GpgModule.cpp.

Referenced by onWizardName(), and wizardStart().

◆ s_viewsInitialized

bool cdc::mod_gpg::s_viewsInitialized = false
static

Definition at line 374 of file GpgModule.cpp.

Referenced by cdc::mod_gpg::GpgModule::getMenuItems().

◆ s_wizard

WizardState cdc::mod_gpg::s_wizard = {}
static

Definition at line 387 of file GpgModule.cpp.

Referenced by onWizardCurve(), onWizardEmail(), onWizardName(), and wizardStart().