summaryrefslogtreecommitdiff
path: root/man/fido_cred_set_authdata.3
diff options
context:
space:
mode:
Diffstat (limited to 'man/fido_cred_set_authdata.3')
-rw-r--r--man/fido_cred_set_authdata.3240
1 files changed, 240 insertions, 0 deletions
diff --git a/man/fido_cred_set_authdata.3 b/man/fido_cred_set_authdata.3
new file mode 100644
index 0000000..8b087fa
--- /dev/null
+++ b/man/fido_cred_set_authdata.3
@@ -0,0 +1,240 @@
1.\" Copyright (c) 2018 Yubico AB. All rights reserved.
2.\" Use of this source code is governed by a BSD-style
3.\" license that can be found in the LICENSE file.
4.\"
5.Dd $Mdocdate: May 23 2018 $
6.Dt FIDO_CRED_SET_AUTHDATA 3
7.Os
8.Sh NAME
9.Nm fido_cred_set_authdata ,
10.Nm fido_cred_set_authdata_raw ,
11.Nm fido_cred_set_x509 ,
12.Nm fido_cred_set_sig ,
13.Nm fido_cred_set_clientdata_hash ,
14.Nm fido_cred_set_rp ,
15.Nm fido_cred_set_user ,
16.Nm fido_cred_set_extensions ,
17.Nm fido_cred_set_rk ,
18.Nm fido_cred_set_uv ,
19.Nm fido_cred_set_fmt ,
20.Nm fido_cred_set_type
21.Nd set parameters of a FIDO 2 credential
22.Sh SYNOPSIS
23.In fido.h
24.Bd -literal
25typedef enum {
26 FIDO_OPT_OMIT = 0, /* use authenticator's default */
27 FIDO_OPT_FALSE, /* explicitly set option to false */
28 FIDO_OPT_TRUE, /* explicitly set option to true */
29} fido_opt_t;
30.Ed
31.Ft int
32.Fn fido_cred_set_authdata "fido_cred_t *cred" "const unsigned char *ptr" "size_t len"
33.Ft int
34.Fn fido_cred_set_authdata_raw "fido_cred_t *cred" "const unsigned char *ptr" "size_t len"
35.Ft int
36.Fn fido_cred_set_x509 "fido_cred_t *cred" "const unsigned char *ptr" "size_t len"
37.Ft int
38.Fn fido_cred_set_sig "fido_cred_t *cred" "const unsigned char *ptr" "size_t len"
39.Ft int
40.Fn fido_cred_set_clientdata_hash "fido_cred_t *cred" "const unsigned char *ptr" "size_t len"
41.Ft int
42.Fn fido_cred_set_rp "fido_cred_t *cred" "const char *id" "const char *name"
43.Ft int
44.Fn fido_cred_set_user "fido_cred_t *cred" "const unsigned char *user_id" "size_t user_id_len" "const char *name" "const char *display_name" "const char *icon"
45.Ft int
46.Fn fido_cred_set_extensions "fido_cred_t *cred" "int flags"
47.Ft int
48.Fn fido_cred_set_rk "fido_cred_t *cred" "fido_opt_t rk"
49.Ft int
50.Fn fido_cred_set_uv "fido_cred_t *cred" "fido_opt_t uv"
51.Ft int
52.Fn fido_cred_set_fmt "fido_cred_t *cred" "const char *ptr"
53.Ft int
54.Fn fido_cred_set_type "fido_cred_t *cred" "int cose_alg"
55.Sh DESCRIPTION
56The
57.Nm
58set of functions define the various parameters of a FIDO 2
59credential, allowing a
60.Fa fido_cred_t
61type to be prepared for a subsequent call to
62.Xr fido_dev_make_cred 3
63or
64.Xr fido_cred_verify 3 .
65For the complete specification of a FIDO 2 credential and the format
66of its constituent parts, please refer to the Web Authentication
67(webauthn) standard.
68.Pp
69The
70.Fn fido_cred_set_authdata ,
71.Fn fido_cred_set_x509 ,
72.Fn fido_cred_set_sig ,
73and
74.Fn fido_cred_set_clientdata_hash
75functions set the authenticator data, attestation certificate,
76signature and client data hash parts of
77.Fa cred
78to
79.Fa ptr ,
80where
81.Fa ptr
82points to
83.Fa len
84bytes.
85A copy of
86.Fa ptr
87is made, and no references to the passed pointer are kept.
88The authenticator data passed to
89.Fn fido_cred_set_authdata
90must be a CBOR-encoded byte string, as obtained from
91.Fn fido_cred_authdata_ptr .
92Alternatively, a raw binary blob may be passed to
93.Fn fido_cred_set_authdata_raw .
94.Pp
95The
96.Fn fido_cred_set_rp
97function sets the relying party
98.Fa id
99and
100.Fa name
101parameters of
102.Fa cred ,
103where
104.Fa id
105and
106.Fa name
107are NUL-terminated UTF-8 strings.
108The contents of
109.Fa id
110and
111.Fa name
112are copied, and no references to the passed pointers are kept.
113.Pp
114The
115.Fn fido_cred_set_user
116function sets the user attributes of
117.Fa cred ,
118where
119.Fa user_id
120points to
121.Fa user_id_len
122bytes and
123.Fa name ,
124.Fa display_name ,
125and
126.Fa icon
127are NUL-terminated UTF-8 strings.
128The contents of
129.Fa user_id ,
130.Fa name ,
131.Fa display_name ,
132and
133.Fa icon
134are copied, and no references to the passed pointers are kept.
135Previously set user attributes are flushed.
136The
137.Fa user_id ,
138.Fa name ,
139.Fa display_name ,
140and
141.Fa icon
142parameters may be NULL.
143.Pp
144The
145.Fn fido_cred_set_extensions
146function sets the extensions of
147.Fa cred
148to the bitmask
149.Fa flags .
150At the moment, only the
151.Dv FIDO_EXT_HMAC_SECRET
152extension is supported.
153If
154.Fa flags
155is zero, the extensions of
156.Fa cred
157are cleared.
158.Pp
159The
160.Fn fido_cred_set_rk
161and
162.Fn fido_cred_set_uv
163functions set the
164.Em rk
165(resident key)
166and
167.Em uv
168(user verification)
169attributes of
170.Fa cred .
171Both are
172.Dv FIDO_OPT_OMIT
173by default, allowing the authenticator to use its default settings.
174.Pp
175The
176.Fn fido_cred_set_fmt
177function sets the format of
178.Fa cred
179to
180.Fa fmt ,
181where
182.Fa fmt
183must be either
184.Vt "packed"
185(the format used in FIDO 2)
186or
187.Vt "fido-u2f"
188(the format used by U2F).
189A copy of
190.Fa fmt
191is made, and no references to the passed pointer are kept.
192Note that not all authenticators support FIDO2 and therefore may not
193be able to generate
194.Vt "packed" .
195.Pp
196The
197.Fn fido_cred_set_type
198function sets the type of
199.Fa cred to
200.Fa cose_alg ,
201where
202.Fa cose_alg
203is
204.Dv COSE_ES256 ,
205.Dv COSE_RS256 ,
206or
207.Dv COSE_EDDSA .
208The type of a credential may only be set once.
209Note that not all authenticators support COSE_RS256 or COSE_EDDSA.
210.Pp
211Use of the
212.Nm
213set of functions may happen in two distinct situations:
214when generating a new credential on a FIDO device, prior to
215.Xr fido_dev_make_cred 3
216(i.e, in the context of a FIDO client), or when validating
217a generated credential using
218.Xr fido_cred_verify 3
219(i.e, in the context of a FIDO server).
220.Pp
221For a complete description of the generation of a FIDO 2 credential
222and its verification, please refer to the FIDO 2 specification.
223A concrete utilisation example of the
224.Nm
225set of functions can be found in the
226.Pa cred.c
227example shipped with
228.Em libfido2 .
229.Sh RETURN VALUES
230The error codes returned by the
231.Nm
232set of functions are defined in
233.In fido/err.h .
234On success,
235.Dv FIDO_OK
236is returned.
237.Sh SEE ALSO
238.Xr fido_cred_exclude 3 ,
239.Xr fido_cred_verify 3 ,
240.Xr fido_dev_make_cred 3