7#include "mbedtls/sha256.h"
21 "Fire",
"Water",
"Earth",
"Air",
22 "Aether",
"Sulfur",
"Mercury",
"Salt",
23 "Gold",
"Silver",
"Copper",
"Iron",
24 "Tin",
"Lead",
"Antimony",
"Arsenic",
25 "Bismuth",
"Phosphorus",
"Platinum",
"Zinc",
26 "Magnesium",
"Potassium",
"Vitriol",
"Aquafortis",
27 "Alkahest",
"Azoth",
"Cinnabar",
"Nitre",
28 "Calx",
"Regulus",
"Quintessence",
"Stone"
37 if (index >= 32)
return "?";
50 char* buf,
size_t len) {
56 mbedtls_sha256(pubkey, pubkey_len, hash, 0);
59 indices[0] = (hash[0] >> 3) & 0x1F;
60 indices[1] = ((hash[0] << 2) | (hash[1] >> 6)) & 0x1F;
61 indices[2] = (hash[1] >> 1) & 0x1F;
62 indices[3] = ((hash[1] << 4) | (hash[2] >> 4)) & 0x1F;
63 indices[4] = ((hash[2] << 1) | (hash[3] >> 7)) & 0x1F;
68 strlcat(buf,
" ", len);
96 strlcpy(buf,
"(no key)", len);
static constexpr size_t P256_PUBKEY_RAW_SIZE
Uncompressed P-256 public key, raw X||Y coordinates (no SEC1 0x04 prefix).
const char * key_fingerprint_word(uint8_t index)
Returns alchemical word for 5-bit index.
bool key_fingerprint_from_pubkey(const uint8_t *pubkey, size_t pubkey_len, char *buf, size_t len)
Generates human-readable fingerprint from public key bytes.
static const char *const ALCHEMY_WORDS[32]
Lookup table of 32 alchemical element labels (5-bit index space).
bool key_fingerprint_generate(uint8_t slot, char *buf, size_t len)
Reads public key from secure element slot and generates fingerprint.
#define KEY_FINGERPRINT_MAX_LEN
#define KEY_FINGERPRINT_WORD_COUNT
#define ED25519_PUBKEY_SIZE
Ed25519 raw public key size in bytes.
#define SHA256_DIGEST_SIZE
SHA-256 digest output size in bytes (FIPS 180-4).
ISecureElement * getSecureElementInstance()
Returns singleton secure-element stub instance.