mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-02-19 00:36:05 +08:00
select works (somehow)
This commit is contained in:
parent
2fa6c4643e
commit
ecfcc21ded
2 changed files with 26 additions and 0 deletions
|
|
@ -28,6 +28,7 @@
|
|||
#include "iso7816/iso7816core.h" // APDU logging
|
||||
#include "util_posix.h" // msleep
|
||||
#include "mifare/desfire_crypto.h"
|
||||
#include "mifare/desfirecore.h"
|
||||
#include "crapto1/crapto1.h"
|
||||
#include "fileutils.h"
|
||||
#include "mifare/mifaredefault.h" // default keys
|
||||
|
|
@ -5218,11 +5219,31 @@ static int CmdHF14ADesGetAIDs(const char *Cmd) {
|
|||
uint8_t cmdKDFAlgo = arg_get_int_def(ctx, 9, 0);
|
||||
CLIGetHexWithReturn(ctx, 10, kdfInput, &kdfInputLen);
|
||||
*/
|
||||
// SetAPDULogging(APDULogging);
|
||||
SetAPDULogging(true);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
uint8_t key[24] = {0};
|
||||
DesfireContext dctx;
|
||||
DesfireSetKey(&dctx, 1, T_DES, key);
|
||||
dctx.cmdChannel = DCCNativeISO;
|
||||
|
||||
|
||||
//size_t len = 0;
|
||||
uint16_t sw = 0;
|
||||
//uint8_t buf[APDU_RES_LEN] = {0};
|
||||
|
||||
int res = DesfireSelectAIDHex(&dctx, 0x000000, false, 0);
|
||||
if (res != 0 || sw != 0x9000) {
|
||||
PrintAndLogEx(ERR, "Desfire select " _RED_("error") ". Card returns 0x%02x", sw);
|
||||
DropField();
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
DropField();
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -231,6 +231,11 @@ int DesfireSelectAIDHex(DesfireContext *ctx, uint32_t aid1, bool select_two, uin
|
|||
data[0] = aid1 & 0xff;
|
||||
data[1] = (aid1 >> 8) & 0xff;
|
||||
data[2] = (aid1 >> 16) & 0xff;
|
||||
|
||||
data[3] = aid2 & 0xff;
|
||||
data[4] = (aid2 >> 8) & 0xff;
|
||||
data[5] = (aid2 >> 16) & 0xff;
|
||||
|
||||
return DesfireSelectAID(ctx, data, (select_two) ? &data[3] : NULL);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue