CmdHF14ADesGetKeySettings works

This commit is contained in:
merlokk 2021-07-10 15:07:51 +03:00
commit 67d7d29d74
2 changed files with 13 additions and 7 deletions

View file

@ -5085,10 +5085,14 @@ static int CmdDesGetSessionParameters(CLIParserContext *ctx, DesfireContext *dct
if (appid && aid) {
*aid = 0x000000;
//int arg_get_u32_hexstr_def_nlen(CLIParserContext *ctx, uint8_t paramnum, uint32_t def, uint32_t *out, uint8_t nlen, bool optional);
// if (arg_get_u32_hexstr_def_nlen(ctx, appid, 0x000000, aid, 3, true))
// return PM3_ESOFT;
int res = arg_get_u32_hexstr_def_nlen(ctx, appid, 0x000000, aid, 3, true);
if (res == 0)
return PM3_ESOFT;
if (res == 2) {
PrintAndLogEx(ERR, "AID length must have 3 bytes length");
return PM3_EINVARG;
}
PrintAndLogEx(INFO, "--aid: %x", *aid);
}
DesfireSetKey(dctx, keynum, algores, key);
@ -5178,7 +5182,7 @@ static int CmdHF14ADesGetKeySettings(const char *Cmd) {
arg_str0("m", "cmode", "<plain/mac/encrypt>", "Communicaton mode: plain/mac/encrypt"),
arg_str0("c", "ccset", "<native/niso/iso>", "Communicaton command set: native/niso/iso"),
arg_str0("s", "schann", "<d40/ev1/ev2>", "Secure channel: d40/ev1/ev2"),
arg_int0(NULL, "appid", "<app id hex>", "Application ID (HEX 3 bytes)"),
arg_str0(NULL, "appid", "<app id hex>", "Application ID (HEX 3 bytes)"),
arg_param_end
};
CLIExecWithReturn(ctx, Cmd, argtable, false);

View file

@ -986,8 +986,9 @@ static void PrintKeySettingsPICC(uint8_t keysettings, uint8_t numkeys) {
PrintAndLogEx(SUCCESS, "[.%c..] CMK required for create/delete : %s", (keysettings & (1 << 2)) ? '1' : '0', (keysettings & (1 << 2)) ? _GREEN_("NO") : "YES");
PrintAndLogEx(SUCCESS, "[..%c.] Directory list access with CMK : %s", (keysettings & (1 << 1)) ? '1' : '0', (keysettings & (1 << 1)) ? _GREEN_("NO") : "YES");
PrintAndLogEx(SUCCESS, "[...%c] CMK is changeable : %s", (keysettings & (1 << 0)) ? '1' : '0', (keysettings & (1 << 0)) ? _GREEN_("YES") : "NO (frozen)");
PrintAndLogEx(SUCCESS, "");
PrintAndLogEx(SUCCESS, "\nkey count: %d", numkeys & 0x0f);
PrintAndLogEx(SUCCESS, "key count: %d", numkeys & 0x0f);
}
static void PrintKeySettingsApp(uint8_t keysettings, uint8_t numkeys) {
@ -1017,9 +1018,10 @@ static void PrintKeySettingsApp(uint8_t keysettings, uint8_t numkeys) {
PrintAndLogEx(SUCCESS, "[.%c..] AMK required for create/delete : %s", (keysettings & (1 << 2)) ? '1' : '0', (keysettings & (1 << 2)) ? "NO" : "YES");
PrintAndLogEx(SUCCESS, "[..%c.] Directory list access with AMK : %s", (keysettings & (1 << 1)) ? '1' : '0', (keysettings & (1 << 1)) ? "NO" : "YES");
PrintAndLogEx(SUCCESS, "[...%c] AMK is changeable : %s", (keysettings & (1 << 0)) ? '1' : '0', (keysettings & (1 << 0)) ? _GREEN_("YES") : "NO (frozen)");
PrintAndLogEx(SUCCESS, "");
PrintKeyType(numkeys >> 6);
PrintAndLogEx(SUCCESS, "\nkey count: %d", numkeys & 0x0f);
PrintAndLogEx(SUCCESS, "key count: %d", numkeys & 0x0f);
}
void PrintKeySettings(uint8_t keysettings, uint8_t numkeys, bool applevel) {