195dbdf32Schristos.\" Copyright (c) 2020 Yubico AB. All rights reserved. 2*2d40c451Schristos.\" 3*2d40c451Schristos.\" Redistribution and use in source and binary forms, with or without 4*2d40c451Schristos.\" modification, are permitted provided that the following conditions are 5*2d40c451Schristos.\" met: 6*2d40c451Schristos.\" 7*2d40c451Schristos.\" 1. Redistributions of source code must retain the above copyright 8*2d40c451Schristos.\" notice, this list of conditions and the following disclaimer. 9*2d40c451Schristos.\" 2. Redistributions in binary form must reproduce the above copyright 10*2d40c451Schristos.\" notice, this list of conditions and the following disclaimer in 11*2d40c451Schristos.\" the documentation and/or other materials provided with the 12*2d40c451Schristos.\" distribution. 13*2d40c451Schristos.\" 14*2d40c451Schristos.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 15*2d40c451Schristos.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 16*2d40c451Schristos.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17*2d40c451Schristos.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 18*2d40c451Schristos.\" HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19*2d40c451Schristos.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 20*2d40c451Schristos.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21*2d40c451Schristos.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22*2d40c451Schristos.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23*2d40c451Schristos.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24*2d40c451Schristos.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25*2d40c451Schristos.\" 26*2d40c451Schristos.\" SPDX-License-Identifier: BSD-2-Clause 2795dbdf32Schristos.\" 2895dbdf32Schristos.Dd $Mdocdate: October 26 2020 $ 2995dbdf32Schristos.Dt FIDO_LARGEBLOB_GET 3 3095dbdf32Schristos.Os 3195dbdf32Schristos.Sh NAME 3295dbdf32Schristos.Nm fido_dev_largeblob_get , 3395dbdf32Schristos.Nm fido_dev_largeblob_set , 3495dbdf32Schristos.Nm fido_dev_largeblob_remove , 3595dbdf32Schristos.Nm fido_dev_largeblob_get_array , 3695dbdf32Schristos.Nm fido_dev_largeblob_set_array 3795dbdf32Schristos.Nd FIDO2 large blob API 3895dbdf32Schristos.Sh SYNOPSIS 3995dbdf32Schristos.In fido.h 4095dbdf32Schristos.Ft int 4195dbdf32Schristos.Fn fido_dev_largeblob_get "fido_dev_t *dev" "const unsigned char *key_ptr" "size_t key_len" "unsigned char **blob_ptr" "size_t *blob_len" 4295dbdf32Schristos.Ft int 4395dbdf32Schristos.Fn fido_dev_largeblob_set "fido_dev_t *dev" "const unsigned char *key_ptr" "size_t key_len" "const unsigned char *blob_ptr" "size_t blob_len" "const char *pin" 4495dbdf32Schristos.Ft int 4595dbdf32Schristos.Fn fido_dev_largeblob_remove "fido_dev_t *dev" "const unsigned char *key_ptr" "size_t key_len" "const char *pin" 4695dbdf32Schristos.Ft int 4795dbdf32Schristos.Fn fido_dev_largeblob_get_array "fido_dev_t *dev" "unsigned char **cbor_ptr" "size_t *cbor_len" 4895dbdf32Schristos.Ft int 4995dbdf32Schristos.Fn fido_dev_largeblob_set_array "fido_dev_t *dev" "const unsigned char *cbor_ptr" "size_t cbor_len" "const char *pin" 5095dbdf32Schristos.Sh DESCRIPTION 5195dbdf32SchristosThe 5295dbdf32Schristos.Dq largeBlobs 5395dbdf32SchristosAPI of 5495dbdf32Schristos.Em libfido2 55*2d40c451Schristosallows binary blobs residing on a CTAP 2.1 authenticator to be 5695dbdf32Schristosread, written, and inspected. 5795dbdf32Schristos.Dq largeBlobs 58*2d40c451Schristosis a CTAP 2.1 extension. 5995dbdf32Schristos.Pp 6095dbdf32Schristos.Dq largeBlobs 6195dbdf32Schristosare stored as elements of a CBOR array. 6295dbdf32SchristosConfidentiality is ensured by encrypting each element with a 6395dbdf32Schristosdistinct, credential-bound 256-bit AES-GCM key. 6495dbdf32SchristosThe array is otherwise shared between different credentials and 6595dbdf32SchristosFIDO2 relying parties. 6695dbdf32Schristos.Pp 6795dbdf32SchristosRetrieval of a credential's encryption key is possible during 6895dbdf32Schristosenrollment with 6995dbdf32Schristos.Xr fido_cred_set_extensions 3 7095dbdf32Schristosand 7195dbdf32Schristos.Xr fido_cred_largeblob_key_ptr 3 , 7295dbdf32Schristosduring assertion with 7395dbdf32Schristos.Xr fido_assert_set_extensions 3 7495dbdf32Schristosand 7595dbdf32Schristos.Xr fido_assert_largeblob_key_ptr 3 , 7695dbdf32Schristosor, in the case of a resident credential, via 7795dbdf32Schristos.Em libfido2's 7895dbdf32Schristoscredential management API. 7995dbdf32Schristos.Pp 8095dbdf32SchristosThe 8195dbdf32Schristos.Dq largeBlobs 8295dbdf32SchristosCBOR array is opaque to the authenticator. 8395dbdf32SchristosManagement of the array is left at the discretion of FIDO2 clients. 84*2d40c451SchristosFor further details on CTAP 2.1's 8595dbdf32Schristos.Dq largeBlobs 86*2d40c451Schristosextension, please refer to the CTAP 2.1 spec. 8795dbdf32Schristos.Pp 8895dbdf32SchristosThe 8995dbdf32Schristos.Fn fido_dev_largeblob_get 9095dbdf32Schristosfunction retrieves the authenticator's 9195dbdf32Schristos.Dq largeBlobs 9295dbdf32SchristosCBOR array and, on success, returns the first blob 9395dbdf32Schristos.Pq iterating from array index zero 94*2d40c451Schristosthat can be decrypted by 9595dbdf32Schristos.Fa key_ptr , 9695dbdf32Schristoswhere 9795dbdf32Schristos.Fa key_ptr 9895dbdf32Schristospoints to 9995dbdf32Schristos.Fa key_len 10095dbdf32Schristosbytes. 10195dbdf32SchristosOn success, 10295dbdf32Schristos.Fn fido_dev_largeblob_get 10395dbdf32Schristossets 10495dbdf32Schristos.Fa blob_ptr 10595dbdf32Schristosto the body of the decrypted blob, and 10695dbdf32Schristos.Fa blob_len 10795dbdf32Schristosto the length of the decrypted blob in bytes. 10895dbdf32SchristosIt is the caller's responsibility to free 10995dbdf32Schristos.Fa blob_ptr . 11095dbdf32Schristos.Pp 11195dbdf32SchristosThe 11295dbdf32Schristos.Fn fido_dev_largeblob_set 11395dbdf32Schristosfunction uses 11495dbdf32Schristos.Fa key_ptr 11595dbdf32Schristosto encrypt 11695dbdf32Schristos.Fa blob_ptr 11795dbdf32Schristosand inserts the result in the authenticator's 11895dbdf32Schristos.Dq largeBlobs 11995dbdf32SchristosCBOR array. 12095dbdf32SchristosInsertion happens at the end of the array if no existing element 12195dbdf32Schristoscan be decrypted by 12295dbdf32Schristos.Fa key_ptr , 12395dbdf32Schristosor at the position of the first element 12495dbdf32Schristos.Pq iterating from array index zero 12595dbdf32Schristosthat can be decrypted by 12695dbdf32Schristos.Fa key_ptr . 12795dbdf32Schristos.Fa key_len 12895dbdf32Schristosholds the length of 12995dbdf32Schristos.Fa key_ptr 13095dbdf32Schristosin bytes, and 13195dbdf32Schristos.Fa blob_len 13295dbdf32Schristosthe length of 13395dbdf32Schristos.Fa blob_ptr 13495dbdf32Schristosin bytes. 13595dbdf32SchristosA 13695dbdf32Schristos.Fa pin 13795dbdf32Schristosor equivalent user-verification gesture is required. 13895dbdf32Schristos.Pp 13995dbdf32SchristosThe 14095dbdf32Schristos.Fn fido_dev_largeblob_remove 14195dbdf32Schristosfunction retrieves the authenticator's 14295dbdf32Schristos.Dq largeBlobs 14395dbdf32SchristosCBOR array and, on success, drops the first blob 14495dbdf32Schristos.Pq iterating from array index zero 14595dbdf32Schristosthat can be decrypted by 14695dbdf32Schristos.Fa key_ptr , 14795dbdf32Schristoswhere 14895dbdf32Schristos.Fa key_ptr 14995dbdf32Schristospoints to 15095dbdf32Schristos.Fa key_len 15195dbdf32Schristosbytes. 15295dbdf32SchristosA 15395dbdf32Schristos.Fa pin 15495dbdf32Schristosor equivalent user-verification gesture is required. 15595dbdf32Schristos.Pp 15695dbdf32SchristosThe 15795dbdf32Schristos.Fn fido_dev_largeblob_get_array 15895dbdf32Schristosfunction retrieves the authenticator's 15995dbdf32Schristos.Dq largeBlobs 16095dbdf32SchristosCBOR array and, on success, 16195dbdf32Schristossets 16295dbdf32Schristos.Fa cbor_ptr 16395dbdf32Schristosto the body of the CBOR array, and 16495dbdf32Schristos.Fa cbor_len 16595dbdf32Schristosto its corresponding length in bytes. 16695dbdf32SchristosIt is the caller's responsibility to free 16795dbdf32Schristos.Fa cbor_ptr . 16895dbdf32Schristos.Pp 16995dbdf32SchristosFinally, the 17095dbdf32Schristos.Fn fido_dev_largeblob_set_array 17195dbdf32Schristosfunction sets the authenticator's 17295dbdf32Schristos.Dq largeBlobs 17395dbdf32SchristosCBOR array to the data pointed to by 17495dbdf32Schristos.Fa cbor_ptr , 17595dbdf32Schristoswhere 17695dbdf32Schristos.Fa cbor_ptr 17795dbdf32Schristospoints to 17895dbdf32Schristos.Fa cbor_len 17995dbdf32Schristosbytes. 18095dbdf32SchristosA 18195dbdf32Schristos.Fa pin 18295dbdf32Schristosor equivalent user-verification gesture is required. 18395dbdf32Schristos.Sh RETURN VALUES 18495dbdf32SchristosThe functions 18595dbdf32Schristos.Fn fido_dev_largeblob_set , 18695dbdf32Schristos.Fn fido_dev_largeblob_get , 18795dbdf32Schristos.Fn fido_dev_largeblob_remove , 18895dbdf32Schristos.Fn fido_dev_largeblob_get_array , 18995dbdf32Schristosand 19095dbdf32Schristos.Fn fido_dev_largeblob_set_array 19195dbdf32Schristosreturn 19295dbdf32Schristos.Dv FIDO_OK 19395dbdf32Schristoson success. 19495dbdf32SchristosOn error, an error code defined in 19595dbdf32Schristos.In fido/err.h 19695dbdf32Schristosis returned. 19795dbdf32Schristos.Sh SEE ALSO 19895dbdf32Schristos.Xr fido_assert_largeblob_key_len 3 , 19995dbdf32Schristos.Xr fido_assert_largeblob_key_ptr 3 , 20095dbdf32Schristos.Xr fido_assert_set_extensions 3 , 20195dbdf32Schristos.Xr fido_cred_largeblob_key_len 3 , 20295dbdf32Schristos.Xr fido_cred_largeblob_key_ptr 3 , 20395dbdf32Schristos.Xr fido_cred_set_extensions 3 , 204*2d40c451Schristos.Xr fido_credman_get_dev_rk 3 , 205*2d40c451Schristos.Xr fido_credman_get_dev_rp 3 , 20695dbdf32Schristos.Xr fido_dev_get_assert 3 , 20795dbdf32Schristos.Xr fido_dev_make_cred 3 20895dbdf32Schristos.Sh CAVEATS 20995dbdf32SchristosThe 21095dbdf32Schristos.Dq largeBlobs 21195dbdf32Schristosextension is not meant to be used to store sensitive data. 21295dbdf32SchristosWhen retrieved, a credential's 21395dbdf32Schristos.Dq largeBlobs 21495dbdf32Schristosencryption key is transmitted in the clear, and an authenticator's 21595dbdf32Schristos.Dq largeBlobs 21695dbdf32SchristosCBOR array can be read without user interaction or verification. 217