// gcc largeblob.c -o largeblob -lfido2 #include #include int main() { // Initialize the FIDO library fido_init(0); // Find the first available device size_t count; auto devlist = fido_dev_info_new(1); fido_dev_info_manifest(devlist, 1, &count); if (count == 0) { fido_dev_info_free(&devlist, 1); return 1; } // Open the device auto path = fido_dev_info_path(fido_dev_info_ptr(devlist, 0)); auto dev = fido_dev_new(); fido_dev_open(dev, path); // Print the firmware version fprintf(stderr, "Firmware: %d.%d.%d\n", fido_dev_major(dev), fido_dev_minor(dev), fido_dev_build(dev)); // Extract the large blob array unsigned char *cbor_ptr; size_t cbor_len; fido_dev_largeblob_get_array(dev, &cbor_ptr, &cbor_len); // Dump array to stdout fwrite(cbor_ptr, cbor_len, 1, stdout); fprintf(stderr, "Dumped largeBlob array of size %dB\n", cbor_len); free(cbor_ptr); // Close the device fido_dev_close(dev); fido_dev_free(&dev); // Clear the manifest memory fido_dev_info_free(&devlist, 1); return 0; }