1FIDO_CRED_SET_AUTHDAT... BSD Library Functions Manual FIDO_CRED_SET_AUTHDAT...
2

NAME

4     fido_cred_set_authdata, fido_cred_set_authdata_raw, fido_cred_set_x509,
5     fido_cred_set_sig, fido_cred_set_clientdata_hash, fido_cred_set_rp,
6     fido_cred_set_user, fido_cred_set_extensions, fido_cred_set_rk,
7     fido_cred_set_uv, fido_cred_set_fmt, fido_cred_set_type — set parameters
8     of a FIDO 2 credential
9

SYNOPSIS

11     #include <fido.h>
12
13     typedef enum {
14             FIDO_OPT_OMIT = 0, /* use authenticator's default */
15             FIDO_OPT_FALSE,    /* explicitly set option to false */
16             FIDO_OPT_TRUE,     /* explicitly set option to true */
17     } fido_opt_t;
18
19     int
20     fido_cred_set_authdata(fido_cred_t *cred, const unsigned char *ptr,
21         size_t len);
22
23     int
24     fido_cred_set_authdata_raw(fido_cred_t *cred, const unsigned char *ptr,
25         size_t len);
26
27     int
28     fido_cred_set_x509(fido_cred_t *cred, const unsigned char *ptr,
29         size_t len);
30
31     int
32     fido_cred_set_sig(fido_cred_t *cred, const unsigned char *ptr,
33         size_t len);
34
35     int
36     fido_cred_set_clientdata_hash(fido_cred_t *cred,
37         const unsigned char *ptr, size_t len);
38
39     int
40     fido_cred_set_rp(fido_cred_t *cred, const char *id, const char *name);
41
42     int
43     fido_cred_set_user(fido_cred_t *cred, const unsigned char *user_id,
44         size_t user_id_len, const char *name, const char *display_name,
45         const char *icon);
46
47     int
48     fido_cred_set_extensions(fido_cred_t *cred, int flags);
49
50     int
51     fido_cred_set_rk(fido_cred_t *cred, fido_opt_t rk);
52
53     int
54     fido_cred_set_uv(fido_cred_t *cred, fido_opt_t uv);
55
56     int
57     fido_cred_set_fmt(fido_cred_t *cred, const char *ptr);
58
59     int
60     fido_cred_set_type(fido_cred_t *cred, int cose_alg);
61

DESCRIPTION

63     The fido_cred_set_authdata set of functions define the various parameters
64     of a FIDO 2 credential, allowing a fido_cred_t type to be prepared for a
65     subsequent call to fido_dev_make_cred(3) or fido_cred_verify(3).  For the
66     complete specification of a FIDO 2 credential and the format of its con‐
67     stituent parts, please refer to the Web Authentication (webauthn) stan‐
68     dard.
69
70     The fido_cred_set_authdata(), fido_cred_set_x509(), fido_cred_set_sig(),
71     and fido_cred_set_clientdata_hash() functions set the authenticator data,
72     attestation certificate, signature and client data hash parts of cred to
73     ptr, where ptr points to len bytes.  A copy of ptr is made, and no refer‐
74     ences to the passed pointer are kept.  The authenticator data passed to
75     fido_cred_set_authdata() must be a CBOR-encoded byte string, as obtained
76     from fido_cred_authdata_ptr().  Alternatively, a raw binary blob may be
77     passed to fido_cred_set_authdata_raw().
78
79     The fido_cred_set_rp() function sets the relying party id and name param‐
80     eters of cred, where id and name are NUL-terminated UTF-8 strings.  The
81     contents of id and name are copied, and no references to the passed
82     pointers are kept.
83
84     The fido_cred_set_user() function sets the user attributes of cred, where
85     user_id points to user_id_len bytes and name, display_name, and icon are
86     NUL-terminated UTF-8 strings.  The contents of user_id, name,
87     display_name, and icon are copied, and no references to the passed point‐
88     ers are kept.  Previously set user attributes are flushed.  The user_id,
89     name, display_name, and icon parameters may be NULL.
90
91     The fido_cred_set_extensions() function sets the extensions of cred to
92     the bitmask flags.  At the moment, only the FIDO_EXT_HMAC_SECRET exten‐
93     sion is supported.  If flags is zero, the extensions of cred are cleared.
94
95     The fido_cred_set_rk() and fido_cred_set_uv() functions set the rk (resi‐
96     dent key) and uv (user verification) attributes of cred.  Both are
97     FIDO_OPT_OMIT by default, allowing the authenticator to use its default
98     settings.
99
100     The fido_cred_set_fmt() function sets the format of cred to fmt, where
101     fmt must be either packed (the format used in FIDO 2) or fido-u2f (the
102     format used by U2F).  A copy of fmt is made, and no references to the
103     passed pointer are kept.  Note that not all authenticators support FIDO2
104     and therefore may not be able to generate packed.
105
106     The fido_cred_set_type() function sets the type of cred to cose_alg,
107     where cose_alg is COSE_ES256, COSE_RS256, or COSE_EDDSA.  The type of a
108     credential may only be set once.  Note that not all authenticators sup‐
109     port COSE_RS256 or COSE_EDDSA.
110
111     Use of the fido_cred_set_authdata set of functions may happen in two dis‐
112     tinct situations: when generating a new credential on a FIDO device,
113     prior to fido_dev_make_cred(3) (i.e, in the context of a FIDO client), or
114     when validating a generated credential using fido_cred_verify(3) (i.e, in
115     the context of a FIDO server).
116
117     For a complete description of the generation of a FIDO 2 credential and
118     its verification, please refer to the FIDO 2 specification.  A concrete
119     utilisation example of the fido_cred_set_authdata set of functions can be
120     found in the cred.c example shipped with libfido2.
121

RETURN VALUES

123     The error codes returned by the fido_cred_set_authdata set of functions
124     are defined in <fido/err.h>.  On success, FIDO_OK is returned.
125

SEE ALSO

127     fido_cred_exclude(3), fido_cred_verify(3), fido_dev_make_cred(3)
128
129BSD                              May 10, 2020                              BSD
Impressum