xref: /freebsd/contrib/libfido2/man/fido_assert_set_authdata.3 (revision bdd1243df58e60e85101c09001d9812a789b6bc4)
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_ASSERT_SET_AUTHDATA 3
7.Os
8.Sh NAME
9.Nm fido_assert_set_authdata ,
10.Nm fido_assert_set_authdata_raw ,
11.Nm fido_assert_set_clientdata ,
12.Nm fido_assert_set_clientdata_hash ,
13.Nm fido_assert_set_count ,
14.Nm fido_assert_set_extensions ,
15.Nm fido_assert_set_hmac_salt ,
16.Nm fido_assert_set_hmac_secret ,
17.Nm fido_assert_set_up ,
18.Nm fido_assert_set_uv ,
19.Nm fido_assert_set_rp ,
20.Nm fido_assert_set_sig
21.Nd set parameters of a FIDO2 assertion
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_assert_set_authdata "fido_assert_t *assert" "size_t idx" "const unsigned char *ptr" "size_t len"
33.Ft int
34.Fn fido_assert_set_authdata_raw "fido_assert_t *assert" "size_t idx" "const unsigned char *ptr" "size_t len"
35.Ft int
36.Fn fido_assert_set_clientdata "fido_assert_t *assert" "const unsigned char *ptr" "size_t len"
37.Ft int
38.Fn fido_assert_set_clientdata_hash "fido_assert_t *assert" "const unsigned char *ptr" "size_t len"
39.Ft int
40.Fn fido_assert_set_count "fido_assert_t *assert" "size_t n"
41.Ft int
42.Fn fido_assert_set_extensions "fido_assert_t *assert" "int flags"
43.Ft int
44.Fn fido_assert_set_hmac_salt "fido_assert_t *assert" "const unsigned char *ptr" "size_t len"
45.Ft int
46.Fn fido_assert_set_hmac_secret "fido_assert_t *assert" "size_t idx" "const unsigned char *ptr" "size_t len"
47.Ft int
48.Fn fido_assert_set_up "fido_assert_t *assert" "fido_opt_t up"
49.Ft int
50.Fn fido_assert_set_uv "fido_assert_t *assert" "fido_opt_t uv"
51.Ft int
52.Fn fido_assert_set_rp "fido_assert_t *assert" "const char *id"
53.Ft int
54.Fn fido_assert_set_sig "fido_assert_t *assert" "size_t idx" "const unsigned char *ptr" "size_t len"
55.Sh DESCRIPTION
56The
57.Nm
58set of functions define the various parameters of a FIDO2
59assertion, allowing a
60.Fa fido_assert_t
61type to be prepared for a subsequent call to
62.Xr fido_dev_get_assert 3
63or
64.Xr fido_assert_verify 3 .
65For the complete specification of a FIDO2 assertion and the format
66of its constituent parts, please refer to the Web Authentication
67(webauthn) standard.
68.Pp
69The
70.Fn fido_assert_set_count
71function sets the number of assertion statements in
72.Fa assert
73to
74.Fa n .
75.Pp
76The
77.Fn fido_assert_set_authdata
78and
79.Fn fido_assert_set_sig
80functions set the authenticator data and signature parts of the
81statement with index
82.Fa idx
83of
84.Fa assert
85to
86.Fa ptr ,
87where
88.Fa ptr
89points to
90.Fa len
91bytes.
92A copy of
93.Fa ptr
94is made, and no references to the passed pointer are kept.
95Please note that the first assertion statement of
96.Fa assert
97has an
98.Fa idx
99of
100.Em 0 .
101The authenticator data passed to
102.Fn fido_assert_set_authdata
103must be a CBOR-encoded byte string, as obtained from
104.Fn fido_assert_authdata_ptr .
105Alternatively, a raw binary blob may be passed to
106.Fn fido_assert_set_authdata_raw .
107.Pp
108The
109.Fn fido_assert_set_clientdata_hash
110function sets the client data hash of
111.Fa assert
112to
113.Fa ptr ,
114where
115.Fa ptr
116points to
117.Fa len
118bytes.
119A copy of
120.Fa ptr
121is made, and no references to the passed pointer are kept.
122.Pp
123The
124.Fn fido_assert_set_clientdata
125function allows an application to set the client data hash of
126.Fa assert
127by specifying the assertion's unhashed client data.
128This is required by Windows Hello, which calculates the client data
129hash internally.
130For compatibility with Windows Hello, applications should use
131.Fn fido_assert_set_clientdata
132instead of
133.Fn fido_assert_set_clientdata_hash .
134.Pp
135The
136.Fn fido_assert_set_rp
137function sets the relying party
138.Fa id
139of
140.Fa assert ,
141where
142.Fa id
143is a NUL-terminated UTF-8 string.
144The content of
145.Fa id
146is copied, and no references to the passed pointer are kept.
147.Pp
148The
149.Fn fido_assert_set_extensions
150function sets the extensions of
151.Fa assert
152to the bitmask
153.Fa flags .
154At the moment, only the
155.Dv FIDO_EXT_CRED_BLOB ,
156.Dv FIDO_EXT_HMAC_SECRET ,
157and
158.Dv FIDO_EXT_LARGEBLOB_KEY
159extensions are supported.
160If
161.Fa flags
162is zero, the extensions of
163.Fa assert
164are cleared.
165.Pp
166The
167.Fn fido_assert_set_hmac_salt
168and
169.Fn fido_assert_set_hmac_secret
170functions set the hmac-salt and hmac-secret parts of
171.Fa assert
172to
173.Fa ptr ,
174where
175.Fa ptr
176points to
177.Fa len
178bytes.
179A copy of
180.Fa ptr
181is made, and no references to the passed pointer are kept.
182The HMAC Secret
183.Pq hmac-secret
184Extension is a CTAP 2.0 extension.
185The
186.Fn fido_assert_set_hmac_secret
187function is normally only useful when writing tests.
188.Pp
189The
190.Fn fido_assert_set_up
191and
192.Fn fido_assert_set_uv
193functions set the
194.Fa up
195(user presence) and
196.Fa uv
197(user verification)
198attributes of
199.Fa assert .
200Both are
201.Dv FIDO_OPT_OMIT
202by default, allowing the authenticator to use its default settings.
203.Pp
204Use of the
205.Nm
206set of functions may happen in two distinct situations:
207when asking a FIDO2 device to produce a series of assertion
208statements, prior to
209.Xr fido_dev_get_assert 3
210(i.e, in the context of a FIDO2 client), or when verifying assertion
211statements using
212.Xr fido_assert_verify 3
213(i.e, in the context of a FIDO2 server).
214.Pp
215For a complete description of the generation of a FIDO2 assertion
216and its verification, please refer to the FIDO2 specification.
217An example of how to use the
218.Nm
219set of functions can be found in the
220.Pa examples/assert.c
221file shipped with
222.Em libfido2 .
223.Sh RETURN VALUES
224The
225.Nm
226functions return
227.Dv FIDO_OK
228on success.
229The error codes returned by the
230.Nm
231set of functions are defined in
232.In fido/err.h .
233.Sh SEE ALSO
234.Xr fido_assert_allow_cred 3 ,
235.Xr fido_assert_verify 3 ,
236.Xr fido_dev_get_assert 3
237