Loading...
Searching...
No Matches
ctap.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021 Freie Universität Berlin
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
25#ifndef FIDO2_CTAP_H
26#define FIDO2_CTAP_H
27
28#include <stdint.h>
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
39#define CTAP_MAX_MSG_SIZE 0x400
40
47typedef enum {
48 CTAP2_OK = 0x00,
49 CTAP1_ERR_INVALID_COMMAND = 0x01,
50 CTAP1_ERR_INVALID_PARAMETER = 0x02,
51 CTAP1_ERR_INVALID_LENGTH = 0x03,
52 CTAP1_ERR_INVALID_SEQ = 0x04,
53 CTAP1_ERR_TIMEOUT = 0x05,
54 CTAP1_ERR_CHANNEL_BUSY = 0x06,
55 CTAP1_ERR_LOCK_REQUIRED = 0x0A,
56 CTAP1_ERR_INVALID_CHANNEL = 0x0B,
57 CTAP2_ERR_CBOR_PARSING = 0x10,
58 CTAP2_ERR_CBOR_UNEXPECTED_TYPE = 0x11,
59 CTAP2_ERR_INVALID_CBOR = 0x12,
60 CTAP2_ERR_INVALID_CBOR_TYPE = 0x13,
61 CTAP2_ERR_MISSING_PARAMETER = 0x14,
62 CTAP2_ERR_LIMIT_EXCEEDED = 0x15,
63 CTAP2_ERR_UNSUPPORTED_EXTENSION = 0x16,
64 CTAP2_ERR_TOO_MANY_ELEMENTS = 0x17,
65 CTAP2_ERR_EXTENSION_NOT_SUPPORTED = 0x18,
66 CTAP2_ERR_CREDENTIAL_EXCLUDED = 0x19,
67 CTAP2_ERR_CREDENTIAL_NOT_VALID = 0x20,
68 CTAP2_ERR_PROCESSING = 0x21,
69 CTAP2_ERR_INVALID_CREDENTIAL = 0x22,
70 CTAP2_ERR_USER_ACTION_PENDING = 0x23,
71 CTAP2_ERR_OPERATION_PENDING = 0x24,
72 CTAP2_ERR_NO_OPERATIONS = 0x25,
73 CTAP2_ERR_UNSUPPORTED_ALGORITHM = 0x26,
74 CTAP2_ERR_OPERATION_DENIED = 0x27,
75 CTAP2_ERR_KEY_STORE_FULL = 0x28,
76 CTAP2_ERR_NOT_BUSY = 0x29,
77 CTAP2_ERR_NO_OPERATION_PENDING = 0x2A,
78 CTAP2_ERR_UNSUPPORTED_OPTION = 0x2B,
79 CTAP2_ERR_INVALID_OPTION = 0x2C,
80 CTAP2_ERR_KEEPALIVE_CANCEL = 0x2D,
81 CTAP2_ERR_NO_CREDENTIALS = 0x2E,
82 CTAP2_ERR_USER_ACTION_TIMEOUT = 0x2F,
83 CTAP2_ERR_NOT_ALLOWED = 0x30,
84 CTAP2_ERR_PIN_INVALID = 0x31,
85 CTAP2_ERR_PIN_BLOCKED = 0x32,
86 CTAP2_ERR_PIN_AUTH_INVALID = 0x33,
87 CTAP2_ERR_PIN_AUTH_BLOCKED = 0x34,
88 CTAP2_ERR_PIN_NOT_SET = 0x35,
89 CTAP2_ERR_PIN_REQUIRED = 0x36,
90 CTAP2_ERR_PIN_POLICY_VIOLATION = 0x37,
91 CTAP2_ERR_PIN_TOKEN_EXPIRED = 0x38,
92 CTAP2_ERR_REQUEST_TOO_LARGE = 0x39,
93 CTAP2_ERR_ACTION_TIMEOUT = 0x3A,
94 CTAP2_ERR_UP_REQUIRED = 0x3B,
95 CTAP1_ERR_OTHER = 0x7F,
96 CTAP2_ERR_SPEC_LAST = 0xDF,
97 CTAP2_ERR_EXTENSION_FIRST = 0xE0,
98 CTAP2_ERR_EXTENSION_LAST = 0xEF,
99 CTAP2_ERR_VENDOR_FIRST = 0xF0,
100 CTAP2_ERR_VENDOR_LAST = 0xFF
109typedef struct {
110 uint8_t *buf;
111 size_t len;
112 uint8_t method;
113} ctap_req_t;
114
120typedef struct {
121 uint8_t status;
122 uint8_t data[CTAP_MAX_MSG_SIZE];
124
132
145
157
169
180
191
203
214
215#ifdef __cplusplus
216}
217#endif
218#endif /* FIDO2_CTAP_H */
#define CTAP_MAX_MSG_SIZE
CTAP max message size.
Definition ctap.h:39
size_t fido2_ctap_get_info(ctap_resp_t *resp)
GetInfo method.
ctap_status_codes_t
CTAP status codes.
Definition ctap.h:47
size_t fido2_ctap_handle_request(ctap_req_t *req, ctap_resp_t *resp)
Handle CBOR encoded ctap request.
size_t fido2_ctap_make_credential(ctap_req_t *req, ctap_resp_t *resp)
MakeCredential method.
int fido2_ctap_init(void)
Initialize ctap.
size_t fido2_ctap_client_pin(ctap_req_t *req, ctap_resp_t *resp)
ClientPIN method.
size_t fido2_ctap_get_assertion(ctap_req_t *req, ctap_resp_t *resp)
GetAssertion method.
size_t fido2_ctap_get_next_assertion(ctap_resp_t *resp)
GetNextAssertion method.
size_t fido2_ctap_reset(ctap_resp_t *resp)
Reset method.
CTAP request struct.
Definition ctap.h:109
uint8_t * buf
Buffer holding CBOR encoded data.
Definition ctap.h:110
uint8_t method
CTAP method identitifer.
Definition ctap.h:112
size_t len
Length of buf.
Definition ctap.h:111
CTAP response struct.
Definition ctap.h:120
uint8_t status
response status
Definition ctap.h:121