27 #define SSH_SK_USER_PRESENCE_REQD 0x01
28 #define SSH_SK_USER_VERIFICATION_REQD 0x04
29 #define SSH_SK_FORCE_OPERATION 0x10
30 #define SSH_SK_RESIDENT_KEY 0x20
33 #define SSH_SK_ECDSA 0x00
34 #define SSH_SK_ED25519 0x01
37 #define SSH_SK_ERR_GENERAL -1
38 #define SSH_SK_ERR_UNSUPPORTED -2
39 #define SSH_SK_ERR_PIN_REQUIRED -3
40 #define SSH_SK_ERR_DEVICE_NOT_FOUND -4
41 #define SSH_SK_ERR_CREDENTIAL_EXISTS -5
43 struct sk_enroll_response {
46 size_t public_key_len;
48 size_t key_handle_len;
51 uint8_t *attestation_cert;
52 size_t attestation_cert_len;
57 struct sk_sign_response {
66 struct sk_resident_key {
70 struct sk_enroll_response key;
82 #define SSH_SK_VERSION_MAJOR 0x000a0000
83 #define SSH_SK_VERSION_MAJOR_MASK 0xffff0000
86 uint32_t sk_api_version(
void);
89 int sk_enroll(uint32_t alg,
const uint8_t *challenge,
size_t challenge_len,
90 const char *application, uint8_t flags,
const char *pin,
91 struct sk_option **options,
struct sk_enroll_response **enroll_response);
94 int sk_sign(uint32_t alg,
const uint8_t *data,
size_t data_len,
95 const char *application,
const uint8_t *key_handle,
size_t key_handle_len,
96 uint8_t flags,
const char *pin,
struct sk_option **options,
97 struct sk_sign_response **sign_response);
100 int sk_load_resident_keys(
const char *pin,
struct sk_option **options,
101 struct sk_resident_key ***rks,
size_t *nrks);