10afa8e06SEd Maste /* 2*60a517b6SEd Maste * Copyright (c) 2018-2023 Yubico AB. All rights reserved. 30afa8e06SEd Maste * Use of this source code is governed by a BSD-style 40afa8e06SEd Maste * license that can be found in the LICENSE file. 52ccfa855SEd Maste * SPDX-License-Identifier: BSD-2-Clause 60afa8e06SEd Maste */ 70afa8e06SEd Maste 80afa8e06SEd Maste /* 90afa8e06SEd Maste * Example usage: 100afa8e06SEd Maste * 110afa8e06SEd Maste * $ echo assertion challenge | openssl sha256 -binary | base64 > assert_param 120afa8e06SEd Maste * $ echo relying party >> assert_param 130afa8e06SEd Maste * $ head -1 cred >> assert_param # credential id 140afa8e06SEd Maste * $ tail -n +2 cred > pubkey # credential pubkey 150afa8e06SEd Maste * $ fido2-assert -G -i assert_param /dev/hidraw5 | fido2-assert -V pubkey rs256 160afa8e06SEd Maste * 170afa8e06SEd Maste * See blurb in fido2-cred.c on how to obtain cred. 180afa8e06SEd Maste */ 190afa8e06SEd Maste 200afa8e06SEd Maste #include <fido.h> 210afa8e06SEd Maste #include <stdio.h> 220afa8e06SEd Maste #include <stdlib.h> 230afa8e06SEd Maste #include <string.h> 240afa8e06SEd Maste 250afa8e06SEd Maste #include "../openbsd-compat/openbsd-compat.h" 260afa8e06SEd Maste #include "extern.h" 270afa8e06SEd Maste 280afa8e06SEd Maste void usage(void)290afa8e06SEd Masteusage(void) 300afa8e06SEd Maste { 310afa8e06SEd Maste fprintf(stderr, 32*60a517b6SEd Maste "usage: fido2-assert -G [-bdhpruvw] [-t option] [-i input_file] [-o output_file] device\n" 330afa8e06SEd Maste " fido2-assert -V [-dhpv] [-i input_file] key_file [type]\n" 340afa8e06SEd Maste ); 350afa8e06SEd Maste 360afa8e06SEd Maste exit(1); 370afa8e06SEd Maste } 380afa8e06SEd Maste 390afa8e06SEd Maste int main(int argc,char ** argv)400afa8e06SEd Mastemain(int argc, char **argv) 410afa8e06SEd Maste { 420afa8e06SEd Maste if (argc < 2 || strlen(argv[1]) != 2 || argv[1][0] != '-') 430afa8e06SEd Maste usage(); 440afa8e06SEd Maste 450afa8e06SEd Maste switch (argv[1][1]) { 460afa8e06SEd Maste case 'G': 470afa8e06SEd Maste return (assert_get(--argc, ++argv)); 480afa8e06SEd Maste case 'V': 490afa8e06SEd Maste return (assert_verify(--argc, ++argv)); 500afa8e06SEd Maste } 510afa8e06SEd Maste 520afa8e06SEd Maste usage(); 530afa8e06SEd Maste 540afa8e06SEd Maste /* NOTREACHED */ 550afa8e06SEd Maste } 56