detects FIDO tag

This commit is contained in:
merlokk 2018-10-16 18:42:16 +03:00
commit 6d6fd1dd21

View file

@ -32,6 +32,8 @@
#include "ui.h"
#include "cmdhf14a.h"
#include "mifare.h"
#include "emv/emvcore.h"
#include "emv/dump.h"
static int CmdHelp(const char *Cmd);
@ -44,6 +46,38 @@ int CmdHFMFPInfo(const char *cmd) {
CmdHF14AInfo("");
// FIDO info
PrintAndLog("--------------------------------------------");
SetAPDULogging(false);
uint8_t data[APDU_AID_LEN] = {0};
int datalen = 0;
param_gethex_to_eol("A0000006472F0001", 0, data, sizeof(data), &datalen);
uint8_t buf[APDU_RES_LEN] = {0};
size_t len = 0;
uint16_t sw = 0;
int res = EMVSelect(true, false, data, datalen, buf, sizeof(buf), &len, &sw, NULL);
if (res)
return res;
if (sw != 0x9000) {
if (sw)
PrintAndLog("Not a FIDO card! APDU response: %04x - %s", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
else
PrintAndLog("APDU exchange error. Card returns 0x0000.");
return 0;
}
if (!strncmp((char *)buf, "U2F_V2", 7)) {
PrintAndLog("FIDO authenricator detected.");
PrintAndLog("WARNING: strange version:");
dump_buffer((const unsigned char *)buf, len, NULL, 0);
return 0;
}
PrintAndLog("FIDO authenricator detected. Version: %.*s", len, buf);
DropField();