Path: blob/main/contrib/libfido2/tools/fido2-assert.c
39536 views
/*1* Copyright (c) 2018-2023 Yubico AB. All rights reserved.2* Use of this source code is governed by a BSD-style3* license that can be found in the LICENSE file.4* SPDX-License-Identifier: BSD-2-Clause5*/67/*8* Example usage:9*10* $ echo assertion challenge | openssl sha256 -binary | base64 > assert_param11* $ echo relying party >> assert_param12* $ head -1 cred >> assert_param # credential id13* $ tail -n +2 cred > pubkey # credential pubkey14* $ fido2-assert -G -i assert_param /dev/hidraw5 | fido2-assert -V pubkey rs25615*16* See blurb in fido2-cred.c on how to obtain cred.17*/1819#include <fido.h>20#include <stdio.h>21#include <stdlib.h>22#include <string.h>2324#include "../openbsd-compat/openbsd-compat.h"25#include "extern.h"2627void28usage(void)29{30fprintf(stderr,31"usage: fido2-assert -G [-bdhpruvw] [-t option] [-i input_file] [-o output_file] device\n"32" fido2-assert -V [-dhpv] [-i input_file] key_file [type]\n"33);3435exit(1);36}3738int39main(int argc, char **argv)40{41if (argc < 2 || strlen(argv[1]) != 2 || argv[1][0] != '-')42usage();4344switch (argv[1][1]) {45case 'G':46return (assert_get(--argc, ++argv));47case 'V':48return (assert_verify(--argc, ++argv));49}5051usage();5253/* NOTREACHED */54}555657