remove old
This commit is contained in:
1 parent
02512f274b
commit
85a65fc080
1 file changed
-107
@@ -3256,113 +3256,6 @@ static int CmdHF14ADesAuth(const char *Cmd) {
|
||||
|
||||
DropField();
|
||||
return res;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
//DropFieldDesfire();
|
||||
uint8_t keylength = 8;
|
||||
|
||||
CLIParserContext *ctx;
|
||||
CLIParserInit(&ctx, "hf mfdes auth",
|
||||
"Authenticates MIFARE DESFire using Key",
|
||||
"hf mfdes auth -m 3 -t 4 -a 808301 -n 0 -k 00000000000000000000000000000000 -> AES,keynumber 0, aid 0x803201\n"
|
||||
"hf mfdes auth -m 2 -t 2 -a 000000 -n 1 -k 00000000000000000000000000000000 -> 3DES,keynumber 1, aid 0x000000\n"
|
||||
"hf mfdes auth -m 1 -t 1 -a 000000 -n 2 -k 0000000000000000 -> DES,keynumber 2, aid 0x000000\n"
|
||||
"hf mfdes auth -m 1 -t 1 -a 000000 -n 0 -> DES, defaultkey, aid 0x000000\n"
|
||||
"hf mfdes auth -m 2 -t 2 -a 000000 -n 0 -> 3DES, defaultkey, aid 0x000000\n"
|
||||
"hf mfdes auth -m 3 -t 4 -a 000000 -n 0 -> 3K3DES, defaultkey, aid 0x000000\n"
|
||||
"hf mfdes auth -m 3 -t 4 -a 000000 -n 0 -> AES, defaultkey, aid 0x000000"
|
||||
);
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
arg_int0("m", "type", "<type>", "Auth type (1=normal, 2=iso, 3=aes)"),
|
||||
arg_int0("t", "algo", "<algo>", "Crypt algo (1=DES, 2=3DES(2K2DES), 3=3K3DES, 4=AES)"),
|
||||
arg_strx0("a", "aid", "<aid>", "AID used for authentification (HEX 3 bytes)"),
|
||||
arg_int0("n", "keyno", "<keyno>", "Key number used for authentification"),
|
||||
arg_str0("k", "key", "<Key>", "Key for checking (HEX 8-24 bytes)"),
|
||||
arg_int0("d", "kdf", "<kdf>", "Key Derivation Function (KDF) (0=None, 1=AN10922, 2=Gallagher)"),
|
||||
arg_str0("i", "kdfi", "<kdfi>", "KDF input (HEX 1-31 bytes)"),
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
|
||||
uint8_t cmdAuthMode = arg_get_int_def(ctx, 1, 0);
|
||||
uint8_t cmdAuthAlgo = arg_get_int_def(ctx, 2, 0);
|
||||
|
||||
int aidlength = 3;
|
||||
uint8_t aid[3] = {0};
|
||||
CLIGetHexWithReturn(ctx, 3, aid, &aidlength);
|
||||
swap24(aid);
|
||||
uint8_t cmdKeyNo = arg_get_int_def(ctx, 4, 0);
|
||||
|
||||
uint8_t key[24] = {0};
|
||||
int keylen = 0;
|
||||
CLIGetHexWithReturn(ctx, 5, key, &keylen);
|
||||
|
||||
uint8_t cmdKDFAlgo = arg_get_int_def(ctx, 6, 0);
|
||||
// Get KDF input
|
||||
uint8_t kdfInput[31] = {0};
|
||||
int kdfInputLen = 0;
|
||||
CLIGetHexWithReturn(ctx, 7, kdfInput, &kdfInputLen);
|
||||
|
||||
CLIParserFree(ctx);
|
||||
|
||||
if (cmdAuthAlgo == MFDES_ALGO_AES) {
|
||||
if (keylen == 0) {
|
||||
keylen = 16;
|
||||
memcpy(key, aesdefaultkeys[0], keylen);
|
||||
}
|
||||
keylength = 16;
|
||||
} else if (cmdAuthAlgo == MFDES_ALGO_3DES) {
|
||||
if (keylen == 0) {
|
||||
keylen = 16;
|
||||
memcpy(key, aesdefaultkeys[0], keylen);
|
||||
}
|
||||
keylength = 16;
|
||||
} else if (cmdAuthAlgo == MFDES_ALGO_DES) {
|
||||
if (keylen == 0) {
|
||||
keylen = 8;
|
||||
memcpy(key, desdefaultkeys[0], keylen);
|
||||
}
|
||||
keylength = 8;
|
||||
} else if (cmdAuthAlgo == MFDES_ALGO_3K3DES) {
|
||||
if (keylen == 0) {
|
||||
keylen = 24;
|
||||
memcpy(key, k3kdefaultkeys[0], keylen);
|
||||
}
|
||||
keylength = 24;
|
||||
}
|
||||
|
||||
if ((keylen < 8) || (keylen > 24)) {
|
||||
PrintAndLogEx(ERR, "Specified key must have %d bytes length.", keylen);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
if (keylen != keylength) {
|
||||
PrintAndLogEx(WARNING, "Key must include %d HEX symbols", keylength);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
// AID
|
||||
if (aidlength != 3) {
|
||||
PrintAndLogEx(WARNING, "aid must include %d HEX symbols", 3);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
mfdes_auth_res_t rpayload;
|
||||
int error = desfire_authenticate(cmdAuthMode, cmdAuthAlgo, aid, key, cmdKeyNo, cmdKDFAlgo, kdfInputLen, kdfInput, &rpayload);
|
||||
if (error == PM3_SUCCESS) {
|
||||
PrintAndLogEx(SUCCESS, " Key : " _GREEN_("%s"), sprint_hex(key, keylength));
|
||||
PrintAndLogEx(SUCCESS, " SESSION : " _GREEN_("%s"), sprint_hex(rpayload.sessionkey, keylength));
|
||||
PrintAndLogEx(INFO, "-------------------------------------------------------------");
|
||||
} else {
|
||||
AuthToError(error);
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
PrintAndLogEx(INFO, "-------------------------------------------------------------");
|
||||
return PM3_SUCCESS;*/
|
||||
}
|
||||
|
||||
static int CmdHF14ADesSetConfiguration(const char *Cmd) {
|
||||
|
||||
Reference in new issue
Block a user