added file name to fido2 command

This commit is contained in:
merlokk 2018-11-27 12:07:33 +02:00
parent fc9558b18f
commit bad7b80036

View file

@ -876,7 +876,7 @@ int CmdHFFido2MakeCredential(const char *cmd) {
arg_litn("vV", "verbose", 0, 2, "show technical data. vv - show full certificates data"), arg_litn("vV", "verbose", 0, 2, "show technical data. vv - show full certificates data"),
arg_lit0("tT", "tlv", "Show DER certificate contents in TLV representation"), arg_lit0("tT", "tlv", "Show DER certificate contents in TLV representation"),
arg_lit0("cC", "cbor", "show CBOR decoded data"), arg_lit0("cC", "cbor", "show CBOR decoded data"),
arg_str0(NULL, NULL, "fido2.json", "JSON input / output file name for parameters. Default `fido2.json`"), arg_str0(NULL, NULL, "<json file name>", "JSON input / output file name for parameters. Default `fido2.json`"),
arg_param_end arg_param_end
}; };
CLIExecWithReturn(cmd, argtable, true); CLIExecWithReturn(cmd, argtable, true);
@ -887,15 +887,21 @@ int CmdHFFido2MakeCredential(const char *cmd) {
bool showDERTLV = arg_get_lit(3); bool showDERTLV = arg_get_lit(3);
bool showCBOR = arg_get_lit(4); bool showCBOR = arg_get_lit(4);
uint8_t jsonname[250] ={0};
char *cjsonname = (char *)jsonname;
int jsonnamelen = 0;
CLIGetStrWithReturn(5, jsonname, &jsonnamelen);
if (!jsonnamelen) {
strcat(cjsonname, "fido2");
jsonnamelen = strlen(cjsonname);
}
CLIParserFree(); CLIParserFree();
SetAPDULogging(APDULogging); SetAPDULogging(APDULogging);
int res = GetExistsFileNameJson("fido", "fido2", fname); int res = GetExistsFileNameJson("fido", cjsonname, fname);
if(res) { if(res) {
PrintAndLog("ERROR: Can't found the json file."); PrintAndLog("ERROR: Can't found the json file.");
return res; return res;
@ -986,21 +992,40 @@ int CmdHFFido2GetAssertion(const char *cmd) {
json_t *root = NULL; json_t *root = NULL;
char fname[300] = {0}; char fname[300] = {0};
CLIParserInit("hf fido assert",
"Execute a FIDO2 Get Assertion command. Needs json file with parameters. Sample file `fido2.json`. File can be placed in proxmark directory or in `proxmark/fido` directory.",
"Usage:\n\thf fido assert -> execute command default parameters file `fido2.json`\n"
"\thf fido assert test.json -> execute command with parameters file `text.json`");
bool APDULogging = false; void* argtable[] = {
bool verbose = true; arg_param_begin,
bool verbose2 = true; arg_lit0("aA", "apdu", "show APDU reqests and responses"),
bool showCBOR = true; arg_litn("vV", "verbose", 0, 2, "show technical data. vv - show full certificates data"),
arg_lit0("cC", "cbor", "show CBOR decoded data"),
arg_str0(NULL, NULL, "<json file name>", "JSON input / output file name for parameters. Default `fido2.json`"),
arg_param_end
};
CLIExecWithReturn(cmd, argtable, true);
bool APDULogging = arg_get_lit(1);
bool verbose = arg_get_lit(2);
bool verbose2 = arg_get_lit(2) > 1;
bool showCBOR = arg_get_lit(3);
uint8_t jsonname[250] ={0};
char *cjsonname = (char *)jsonname;
int jsonnamelen = 0;
CLIGetStrWithReturn(4, jsonname, &jsonnamelen);
if (!jsonnamelen) {
strcat(cjsonname, "fido2");
jsonnamelen = strlen(cjsonname);
}
CLIParserFree();
//CLIParserFree();
SetAPDULogging(APDULogging); SetAPDULogging(APDULogging);
int res = GetExistsFileNameJson("fido", "fido2", fname); int res = GetExistsFileNameJson("fido", "fido2", fname);
if(res) { if(res) {
PrintAndLog("ERROR: Can't found the json file."); PrintAndLog("ERROR: Can't found the json file.");