10afa8e06SEd Maste.\" Copyright (c) 2019-2021 Yubico AB. All rights reserved. 2*2ccfa855SEd Maste.\" 3*2ccfa855SEd Maste.\" Redistribution and use in source and binary forms, with or without 4*2ccfa855SEd Maste.\" modification, are permitted provided that the following conditions are 5*2ccfa855SEd Maste.\" met: 6*2ccfa855SEd Maste.\" 7*2ccfa855SEd Maste.\" 1. Redistributions of source code must retain the above copyright 8*2ccfa855SEd Maste.\" notice, this list of conditions and the following disclaimer. 9*2ccfa855SEd Maste.\" 2. Redistributions in binary form must reproduce the above copyright 10*2ccfa855SEd Maste.\" notice, this list of conditions and the following disclaimer in 11*2ccfa855SEd Maste.\" the documentation and/or other materials provided with the 12*2ccfa855SEd Maste.\" distribution. 13*2ccfa855SEd Maste.\" 14*2ccfa855SEd Maste.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 15*2ccfa855SEd Maste.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 16*2ccfa855SEd Maste.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17*2ccfa855SEd Maste.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 18*2ccfa855SEd Maste.\" HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19*2ccfa855SEd Maste.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 20*2ccfa855SEd Maste.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21*2ccfa855SEd Maste.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22*2ccfa855SEd Maste.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23*2ccfa855SEd Maste.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24*2ccfa855SEd Maste.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25*2ccfa855SEd Maste.\" 26*2ccfa855SEd Maste.\" SPDX-License-Identifier: BSD-2-Clause 270afa8e06SEd Maste.\" 280afa8e06SEd Maste.Dd $Mdocdate: June 28 2019 $ 290afa8e06SEd Maste.Dt FIDO_CREDMAN_METADATA_NEW 3 300afa8e06SEd Maste.Os 310afa8e06SEd Maste.Sh NAME 320afa8e06SEd Maste.Nm fido_credman_metadata_new , 330afa8e06SEd Maste.Nm fido_credman_rk_new , 340afa8e06SEd Maste.Nm fido_credman_rp_new , 350afa8e06SEd Maste.Nm fido_credman_metadata_free , 360afa8e06SEd Maste.Nm fido_credman_rk_free , 370afa8e06SEd Maste.Nm fido_credman_rp_free , 380afa8e06SEd Maste.Nm fido_credman_rk_existing , 390afa8e06SEd Maste.Nm fido_credman_rk_remaining , 400afa8e06SEd Maste.Nm fido_credman_rk , 410afa8e06SEd Maste.Nm fido_credman_rk_count , 420afa8e06SEd Maste.Nm fido_credman_rp_id , 430afa8e06SEd Maste.Nm fido_credman_rp_name , 440afa8e06SEd Maste.Nm fido_credman_rp_count , 450afa8e06SEd Maste.Nm fido_credman_rp_id_hash_ptr , 460afa8e06SEd Maste.Nm fido_credman_rp_id_hash_len , 470afa8e06SEd Maste.Nm fido_credman_get_dev_metadata , 480afa8e06SEd Maste.Nm fido_credman_get_dev_rk , 490afa8e06SEd Maste.Nm fido_credman_set_dev_rk , 500afa8e06SEd Maste.Nm fido_credman_del_dev_rk , 510afa8e06SEd Maste.Nm fido_credman_get_dev_rp 520afa8e06SEd Maste.Nd FIDO2 credential management API 530afa8e06SEd Maste.Sh SYNOPSIS 540afa8e06SEd Maste.In fido.h 550afa8e06SEd Maste.In fido/credman.h 560afa8e06SEd Maste.Ft fido_credman_metadata_t * 570afa8e06SEd Maste.Fn fido_credman_metadata_new "void" 580afa8e06SEd Maste.Ft fido_credman_rk_t * 590afa8e06SEd Maste.Fn fido_credman_rk_new "void" 600afa8e06SEd Maste.Ft fido_credman_rp_t * 610afa8e06SEd Maste.Fn fido_credman_rp_new "void" 620afa8e06SEd Maste.Ft void 630afa8e06SEd Maste.Fn fido_credman_metadata_free "fido_credman_metadata_t **metadata_p" 640afa8e06SEd Maste.Ft void 650afa8e06SEd Maste.Fn fido_credman_rk_free "fido_credman_rk_t **rk_p" 660afa8e06SEd Maste.Ft void 670afa8e06SEd Maste.Fn fido_credman_rp_free "fido_credman_rp_t **rp_p" 680afa8e06SEd Maste.Ft uint64_t 690afa8e06SEd Maste.Fn fido_credman_rk_existing "const fido_credman_metadata_t *metadata" 700afa8e06SEd Maste.Ft uint64_t 710afa8e06SEd Maste.Fn fido_credman_rk_remaining "const fido_credman_metadata_t *metadata" 720afa8e06SEd Maste.Ft const fido_cred_t * 730afa8e06SEd Maste.Fn fido_credman_rk "const fido_credman_rk_t *rk" "size_t idx" 740afa8e06SEd Maste.Ft size_t 750afa8e06SEd Maste.Fn fido_credman_rk_count "const fido_credman_rk_t *rk" 760afa8e06SEd Maste.Ft const char * 770afa8e06SEd Maste.Fn fido_credman_rp_id "const fido_credman_rp_t *rp" "size_t idx" 780afa8e06SEd Maste.Ft const char * 790afa8e06SEd Maste.Fn fido_credman_rp_name "const fido_credman_rp_t *rp" "size_t idx" 800afa8e06SEd Maste.Ft size_t 810afa8e06SEd Maste.Fn fido_credman_rp_count "const fido_credman_rp_t *rp" 820afa8e06SEd Maste.Ft const unsigned char * 830afa8e06SEd Maste.Fn fido_credman_rp_id_hash_ptr "const fido_credman_rp_t *rp" "size_t idx" 840afa8e06SEd Maste.Ft size_t 850afa8e06SEd Maste.Fn fido_credman_rp_id_hash_len "const fido_credman_rp_t *" "size_t idx" 860afa8e06SEd Maste.Ft int 870afa8e06SEd Maste.Fn fido_credman_get_dev_metadata "fido_dev_t *dev" "fido_credman_metadata_t *metadata" "const char *pin" 880afa8e06SEd Maste.Ft int 890afa8e06SEd Maste.Fn fido_credman_get_dev_rk "fido_dev_t *dev" "const char *rp_id" "fido_credman_rk_t *rk" "const char *pin" 900afa8e06SEd Maste.Ft int 910afa8e06SEd Maste.Fn fido_credman_set_dev_rk "fido_dev_t *dev" "fido_cred_t *cred" "const char *pin" 920afa8e06SEd Maste.Ft int 930afa8e06SEd Maste.Fn fido_credman_del_dev_rk "fido_dev_t *dev" "const unsigned char *cred_id" "size_t cred_id_len" "const char *pin" 940afa8e06SEd Maste.Ft int 950afa8e06SEd Maste.Fn fido_credman_get_dev_rp "fido_dev_t *dev" "fido_credman_rp_t *rp" "const char *pin" 960afa8e06SEd Maste.Sh DESCRIPTION 970afa8e06SEd MasteThe credential management API of 980afa8e06SEd Maste.Em libfido2 990afa8e06SEd Masteallows resident credentials on a FIDO2 authenticator to be listed, 1000afa8e06SEd Masteinspected, modified, and removed. 1010afa8e06SEd MastePlease note that not all FIDO2 authenticators support credential 1020afa8e06SEd Mastemanagement. 1030afa8e06SEd MasteTo obtain information on what an authenticator supports, please 1040afa8e06SEd Masterefer to 1050afa8e06SEd Maste.Xr fido_cbor_info_new 3 . 1060afa8e06SEd Maste.Pp 1070afa8e06SEd MasteThe 1080afa8e06SEd Maste.Vt fido_credman_metadata_t 1090afa8e06SEd Mastetype abstracts credential management metadata. 1100afa8e06SEd Maste.Pp 1110afa8e06SEd MasteThe 1120afa8e06SEd Maste.Fn fido_credman_metadata_new 1130afa8e06SEd Mastefunction returns a pointer to a newly allocated, empty 1140afa8e06SEd Maste.Vt fido_credman_metadata_t 1150afa8e06SEd Mastetype. 1160afa8e06SEd MasteIf memory cannot be allocated, NULL is returned. 1170afa8e06SEd Maste.Pp 1180afa8e06SEd MasteThe 1190afa8e06SEd Maste.Fn fido_credman_metadata_free 1200afa8e06SEd Mastefunction releases the memory backing 1210afa8e06SEd Maste.Fa *metadata_p , 1220afa8e06SEd Mastewhere 1230afa8e06SEd Maste.Fa *metadata_p 1240afa8e06SEd Mastemust have been previously allocated by 1250afa8e06SEd Maste.Fn fido_credman_metadata_new . 1260afa8e06SEd MasteOn return, 1270afa8e06SEd Maste.Fa *metadata_p 1280afa8e06SEd Masteis set to NULL. 1290afa8e06SEd MasteEither 1300afa8e06SEd Maste.Fa metadata_p 1310afa8e06SEd Masteor 1320afa8e06SEd Maste.Fa *metadata_p 1330afa8e06SEd Mastemay be NULL, in which case 1340afa8e06SEd Maste.Fn fido_credman_metadata_free 1350afa8e06SEd Masteis a NOP. 1360afa8e06SEd Maste.Pp 1370afa8e06SEd MasteThe 1380afa8e06SEd Maste.Fn fido_credman_get_dev_metadata 1390afa8e06SEd Mastefunction populates 1400afa8e06SEd Maste.Fa metadata 1410afa8e06SEd Mastewith information retrieved from 1420afa8e06SEd Maste.Fa dev . 1430afa8e06SEd MasteA valid 1440afa8e06SEd Maste.Fa pin 1450afa8e06SEd Mastemust be provided. 1460afa8e06SEd Maste.Pp 1470afa8e06SEd MasteThe 1480afa8e06SEd Maste.Fn fido_credman_rk_existing 1490afa8e06SEd Mastefunction inspects 1500afa8e06SEd Maste.Fa metadata 1510afa8e06SEd Masteand returns the number of resident credentials on the 1520afa8e06SEd Masteauthenticator. 1530afa8e06SEd MasteThe 1540afa8e06SEd Maste.Fn fido_credman_rk_remaining 1550afa8e06SEd Mastefunction inspects 1560afa8e06SEd Maste.Fa metadata 1570afa8e06SEd Masteand returns the estimated number of resident credentials that can 1580afa8e06SEd Mastebe created on the authenticator. 1590afa8e06SEd Maste.Pp 1600afa8e06SEd MasteThe 1610afa8e06SEd Maste.Vt fido_credman_rk_t 1620afa8e06SEd Mastetype abstracts the set of resident credentials belonging to a 1630afa8e06SEd Mastegiven relying party. 1640afa8e06SEd Maste.Pp 1650afa8e06SEd MasteThe 1660afa8e06SEd Maste.Fn fido_credman_rk_new 1670afa8e06SEd Mastefunction returns a pointer to a newly allocated, empty 1680afa8e06SEd Maste.Vt fido_credman_rk_t 1690afa8e06SEd Mastetype. 1700afa8e06SEd MasteIf memory cannot be allocated, NULL is returned. 1710afa8e06SEd Maste.Pp 1720afa8e06SEd MasteThe 1730afa8e06SEd Maste.Fn fido_credman_rk_free 1740afa8e06SEd Mastefunction releases the memory backing 1750afa8e06SEd Maste.Fa *rk_p , 1760afa8e06SEd Mastewhere 1770afa8e06SEd Maste.Fa *rk_p 1780afa8e06SEd Mastemust have been previously allocated by 1790afa8e06SEd Maste.Fn fido_credman_rk_new . 1800afa8e06SEd MasteOn return, 1810afa8e06SEd Maste.Fa *rk_p 1820afa8e06SEd Masteis set to NULL. 1830afa8e06SEd MasteEither 1840afa8e06SEd Maste.Fa rk_p 1850afa8e06SEd Masteor 1860afa8e06SEd Maste.Fa *rk_p 1870afa8e06SEd Mastemay be NULL, in which case 1880afa8e06SEd Maste.Fn fido_credman_rk_free 1890afa8e06SEd Masteis a NOP. 1900afa8e06SEd Maste.Pp 1910afa8e06SEd MasteThe 1920afa8e06SEd Maste.Fn fido_credman_get_dev_rk 1930afa8e06SEd Mastefunction populates 1940afa8e06SEd Maste.Fa rk 1950afa8e06SEd Mastewith the set of resident credentials belonging to 1960afa8e06SEd Maste.Fa rp_id 1970afa8e06SEd Mastein 1980afa8e06SEd Maste.Fa dev . 1990afa8e06SEd MasteA valid 2000afa8e06SEd Maste.Fa pin 2010afa8e06SEd Mastemust be provided. 2020afa8e06SEd Maste.Pp 2030afa8e06SEd MasteThe 2040afa8e06SEd Maste.Fn fido_credman_rk_count 2050afa8e06SEd Mastefunction returns the number of resident credentials in 2060afa8e06SEd Maste.Fa rk . 2070afa8e06SEd MasteThe 2080afa8e06SEd Maste.Fn fido_credman_rk 2090afa8e06SEd Mastefunction returns a pointer to the credential at index 2100afa8e06SEd Maste.Fa idx 2110afa8e06SEd Mastein 2120afa8e06SEd Maste.Fa rk . 2130afa8e06SEd MastePlease note that the first credential in 2140afa8e06SEd Maste.Fa rk 2150afa8e06SEd Mastehas an 2160afa8e06SEd Maste.Fa idx 2170afa8e06SEd Maste(index) value of 0. 2180afa8e06SEd Maste.Pp 2190afa8e06SEd MasteThe 2200afa8e06SEd Maste.Fn fido_credman_set_dev_rk 2210afa8e06SEd Mastefunction updates the credential pointed to by 2220afa8e06SEd Maste.Fa cred 2230afa8e06SEd Mastein 2240afa8e06SEd Maste.Fa dev . 2250afa8e06SEd MasteThe credential id and user id attributes of 2260afa8e06SEd Maste.Fa cred 2270afa8e06SEd Mastemust be set. 2280afa8e06SEd MasteSee 2290afa8e06SEd Maste.Xr fido_cred_set_id 3 2300afa8e06SEd Masteand 2310afa8e06SEd Maste.Xr fido_cred_set_user 3 2320afa8e06SEd Mastefor details. 2330afa8e06SEd MasteOnly a credential's user attributes (name, display name) 2340afa8e06SEd Mastemay be updated at this time. 2350afa8e06SEd Maste.Pp 2360afa8e06SEd MasteThe 2370afa8e06SEd Maste.Fn fido_credman_del_dev_rk 2380afa8e06SEd Mastefunction deletes the resident credential identified by 2390afa8e06SEd Maste.Fa cred_id 2400afa8e06SEd Mastefrom 2410afa8e06SEd Maste.Fa dev , 2420afa8e06SEd Mastewhere 2430afa8e06SEd Maste.Fa cred_id 2440afa8e06SEd Mastepoints to 2450afa8e06SEd Maste.Fa cred_id_len 2460afa8e06SEd Mastebytes. 2470afa8e06SEd MasteA valid 2480afa8e06SEd Maste.Fa pin 2490afa8e06SEd Mastemust be provided. 2500afa8e06SEd Maste.Pp 2510afa8e06SEd MasteThe 2520afa8e06SEd Maste.Vt fido_credman_rp_t 2530afa8e06SEd Mastetype abstracts information about a relying party. 2540afa8e06SEd Maste.Pp 2550afa8e06SEd MasteThe 2560afa8e06SEd Maste.Fn fido_credman_rp_new 2570afa8e06SEd Mastefunction returns a pointer to a newly allocated, empty 2580afa8e06SEd Maste.Vt fido_credman_rp_t 2590afa8e06SEd Mastetype. 2600afa8e06SEd MasteIf memory cannot be allocated, NULL is returned. 2610afa8e06SEd Maste.Pp 2620afa8e06SEd MasteThe 2630afa8e06SEd Maste.Fn fido_credman_rp_free 2640afa8e06SEd Mastefunction releases the memory backing 2650afa8e06SEd Maste.Fa *rp_p , 2660afa8e06SEd Mastewhere 2670afa8e06SEd Maste.Fa *rp_p 2680afa8e06SEd Mastemust have been previously allocated by 2690afa8e06SEd Maste.Fn fido_credman_rp_new . 2700afa8e06SEd MasteOn return, 2710afa8e06SEd Maste.Fa *rp_p 2720afa8e06SEd Masteis set to NULL. 2730afa8e06SEd MasteEither 2740afa8e06SEd Maste.Fa rp_p 2750afa8e06SEd Masteor 2760afa8e06SEd Maste.Fa *rp_p 2770afa8e06SEd Mastemay be NULL, in which case 2780afa8e06SEd Maste.Fn fido_credman_rp_free 2790afa8e06SEd Masteis a NOP. 2800afa8e06SEd Maste.Pp 2810afa8e06SEd MasteThe 2820afa8e06SEd Maste.Fn fido_credman_get_dev_rp 2830afa8e06SEd Mastefunction populates 2840afa8e06SEd Maste.Fa rp 2850afa8e06SEd Mastewith information about relying parties with resident credentials 2860afa8e06SEd Mastein 2870afa8e06SEd Maste.Fa dev . 2880afa8e06SEd MasteA valid 2890afa8e06SEd Maste.Fa pin 2900afa8e06SEd Mastemust be provided. 2910afa8e06SEd Maste.Pp 2920afa8e06SEd MasteThe 2930afa8e06SEd Maste.Fn fido_credman_rp_count 2940afa8e06SEd Mastefunction returns the number of relying parties in 2950afa8e06SEd Maste.Fa rp . 2960afa8e06SEd Maste.Pp 2970afa8e06SEd MasteThe 2980afa8e06SEd Maste.Fn fido_credman_rp_id 2990afa8e06SEd Masteand 3000afa8e06SEd Maste.Fn fido_credman_rp_name 3010afa8e06SEd Mastefunctions return pointers to the id and name of relying party 3020afa8e06SEd Maste.Fa idx 3030afa8e06SEd Mastein 3040afa8e06SEd Maste.Fa rp . 3050afa8e06SEd MasteIf not NULL, the values returned by these functions point to 3060afa8e06SEd MasteNUL-terminated UTF-8 strings. 3070afa8e06SEd MastePlease note that the first relying party in 3080afa8e06SEd Maste.Fa rp 3090afa8e06SEd Mastehas an 3100afa8e06SEd Maste.Fa idx 3110afa8e06SEd Maste(index) value of 0. 3120afa8e06SEd Maste.Pp 3130afa8e06SEd MasteThe 3140afa8e06SEd Maste.Fn fido_credman_rp_id_hash_ptr 3150afa8e06SEd Mastefunction returns a pointer to the hashed id of relying party 3160afa8e06SEd Maste.Fa idx 3170afa8e06SEd Mastein 3180afa8e06SEd Maste.Fa rp . 3190afa8e06SEd MasteThe corresponding length can be obtained by 3200afa8e06SEd Maste.Fn fido_credman_rp_id_hash_len . 3210afa8e06SEd MastePlease note that the first relying party in 3220afa8e06SEd Maste.Fa rp 3230afa8e06SEd Mastehas an 3240afa8e06SEd Maste.Fa idx 3250afa8e06SEd Maste(index) value of 0. 3260afa8e06SEd Maste.Sh RETURN VALUES 3270afa8e06SEd MasteThe 3280afa8e06SEd Maste.Fn fido_credman_get_dev_metadata , 3290afa8e06SEd Maste.Fn fido_credman_get_dev_rk , 3300afa8e06SEd Maste.Fn fido_credman_set_dev_rk , 3310afa8e06SEd Maste.Fn fido_credman_del_dev_rk , 3320afa8e06SEd Masteand 3330afa8e06SEd Maste.Fn fido_credman_get_dev_rp 3340afa8e06SEd Mastefunctions return 3350afa8e06SEd Maste.Dv FIDO_OK 3360afa8e06SEd Masteon success. 3370afa8e06SEd MasteOn error, a different error code defined in 3380afa8e06SEd Maste.In fido/err.h 3390afa8e06SEd Masteis returned. 3400afa8e06SEd MasteFunctions returning pointers are not guaranteed to succeed, and 3410afa8e06SEd Masteshould have their return values checked for NULL. 3420afa8e06SEd Maste.Sh SEE ALSO 3430afa8e06SEd Maste.Xr fido_cbor_info_new 3 , 3440afa8e06SEd Maste.Xr fido_cred_new 3 , 3450afa8e06SEd Maste.Xr fido_dev_supports_credman 3 3460afa8e06SEd Maste.Sh CAVEATS 3470afa8e06SEd MasteResident credentials are called 3480afa8e06SEd Maste.Dq discoverable credentials 3493e696dfbSEd Mastein CTAP 2.1. 350