Fido2 (#727)
[proxmark3-svn] / client / fido / fidocore.h
1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2018 Merlok
3 //
4 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
5 // at your option, any later version. See the LICENSE.txt file for the text of
6 // the license.
7 //-----------------------------------------------------------------------------
8 // FIDO2 authenticators core data and commands
9 // https://fidoalliance.org/specs/fido-v2.0-id-20180227/fido-client-to-authenticator-protocol-v2.0-id-20180227.html
10 //-----------------------------------------------------------------------------
11 //
12 #ifndef __FIDOCORE_H__
13 #define __FIDOCORE_H__
14
15 #include <stddef.h>
16 #include <stdint.h>
17 #include <jansson.h>
18 #include "cmdhf14a.h"
19 #include "emv/emvcore.h"
20
21 typedef enum {
22 fido2CmdMakeCredential = 0x01,
23 fido2CmdGetAssertion = 0x02,
24 fido2CmdCancel = 0x03,
25 fido2CmdGetInfo = 0x04,
26 fido2CmdClientPIN = 0x06,
27 fido2CmdReset = 0x07,
28 fido2CmdGetNextAssertion = 0x08,
29
30 // another data
31 fido2COSEKey = 0xF0
32 } fido2Commands;
33
34 typedef enum {
35 ptQuery,
36 ptResponse,
37 } fido2PacketType;
38
39 extern int FIDOSelect(bool ActivateField, bool LeaveFieldON, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw);
40 extern int FIDOExchange(sAPDU apdu, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw);
41 extern int FIDORegister(uint8_t *params, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw);
42 extern int FIDOAuthentication(uint8_t *params, uint8_t paramslen, uint8_t controlb, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw);
43 extern int FIDO2GetInfo(uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw);
44 extern int FIDO2MakeCredential(uint8_t *params, uint8_t paramslen, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw);
45 extern int FIDO2GetAssertion(uint8_t *params, uint8_t paramslen, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw);
46
47 extern int FIDOCheckDERAndGetKey(uint8_t *der, size_t derLen, bool verbose, uint8_t *publicKey, size_t publicKeyMaxLen);
48
49 extern char *fido2GetCmdMemberDescription(uint8_t cmdCode, bool isResponse, int memberNum);
50 extern char *fido2GetCmdErrorDescription(uint8_t errorCode);
51
52 extern bool CheckrpIdHash(json_t *json, uint8_t *hash);
53 extern int FIDO2CreateMakeCredentionalReq(json_t *root, uint8_t *data, size_t maxdatalen, size_t *datalen);
54 extern int FIDO2MakeCredentionalParseRes(json_t *root, uint8_t *data, size_t dataLen, bool verbose, bool verbose2, bool showCBOR, bool showDERTLV);
55 extern int FIDO2CreateGetAssertionReq(json_t *root, uint8_t *data, size_t maxdatalen, size_t *datalen, bool createAllowList);
56 extern int FIDO2GetAssertionParseRes(json_t *root, uint8_t *data, size_t dataLen, bool verbose, bool verbose2, bool showCBOR);
57
58 #endif /* __FIDOCORE_H__ */
Impressum, Datenschutz