summaryrefslogtreecommitdiff
path: root/tools/fido2-assert.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/fido2-assert.c')
-rw-r--r--tools/fido2-assert.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/tools/fido2-assert.c b/tools/fido2-assert.c
new file mode 100644
index 0000000..9ce537a
--- /dev/null
+++ b/tools/fido2-assert.c
@@ -0,0 +1,54 @@
1/*
2 * Copyright (c) 2018 Yubico AB. All rights reserved.
3 * Use of this source code is governed by a BSD-style
4 * license that can be found in the LICENSE file.
5 */
6
7/*
8 * Example usage:
9 *
10 * $ echo assertion challenge | openssl sha256 -binary | base64 > assert_param
11 * $ echo relying party >> assert_param
12 * $ head -1 cred >> assert_param # credential id
13 * $ tail -n +2 cred > pubkey # credential pubkey
14 * $ fido2-assert -G -i assert_param /dev/hidraw5 | fido2-assert -V pubkey rs256
15 *
16 * See blurb in fido2-cred.c on how to obtain cred.
17 */
18
19#include <fido.h>
20#include <stdio.h>
21#include <stdlib.h>
22#include <string.h>
23
24#include "../openbsd-compat/openbsd-compat.h"
25#include "extern.h"
26
27void
28usage(void)
29{
30 fprintf(stderr,
31"usage: fido2-assert -G [-dhpruv] [-i input_file] [-o output_file] device\n"
32" fido2-assert -V [-dhpv] [-i input_file] key_file [type]\n"
33 );
34
35 exit(1);
36}
37
38int
39main(int argc, char **argv)
40{
41 if (argc < 2 || strlen(argv[1]) != 2 || argv[1][0] != '-')
42 usage();
43
44 switch (argv[1][1]) {
45 case 'G':
46 return (assert_get(--argc, ++argv));
47 case 'V':
48 return (assert_verify(--argc, ++argv));
49 }
50
51 usage();
52
53 /* NOTREACHED */
54}