mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
fix so authenticated session works with reading a file
This commit is contained in:
parent
4853704920
commit
f83fa37b86
1 changed files with 9 additions and 4 deletions
|
@ -2548,24 +2548,29 @@ static int CmdHF14ADesDeleteApp(const char *Cmd) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int selectfile(uint8_t *aid, uint32_t fileno, uint8_t *cs) {
|
static int selectfile(uint8_t *aid, uint8_t fileno, uint8_t *cs) {
|
||||||
if (handler_desfire_select_application(aid) != PM3_SUCCESS) {
|
if (handler_desfire_select_application(aid) != PM3_SUCCESS) {
|
||||||
PrintAndLogEx(ERR, _RED_(" Couldn't select aid."));
|
PrintAndLogEx(ERR, _RED_(" Couldn't select aid."));
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint8_t filesettings[20] = {0};
|
uint8_t filesettings[20] = {0};
|
||||||
uint32_t fileset_len = 0;
|
uint32_t fileset_len = 0;
|
||||||
int res = handler_desfire_filesettings(fileno, filesettings, &fileset_len);
|
int res = handler_desfire_filesettings(fileno, filesettings, &fileset_len);
|
||||||
|
if (res != PM3_SUCCESS) return res;
|
||||||
|
|
||||||
if (tag->session_key != NULL) {
|
if (tag->session_key != NULL) {
|
||||||
|
|
||||||
|
uint8_t keyno = tag->authenticated_key_no;
|
||||||
|
if (currentauth[keyno].keyno == keyno) {
|
||||||
|
|
||||||
mfdes_auth_res_t rpayload;
|
mfdes_auth_res_t rpayload;
|
||||||
uint8_t keyno = (uint8_t)((filesettings[0] >> 4) & 0xF);
|
|
||||||
if (keyno != 0xE && currentauth[keyno].keyno == keyno) {
|
|
||||||
if (handler_desfire_auth(¤tauth[keyno], &rpayload) != PM3_SUCCESS) {
|
if (handler_desfire_auth(¤tauth[keyno], &rpayload) != PM3_SUCCESS) {
|
||||||
PrintAndLogEx(ERR, _RED_(" Couldn't authenticate key."));
|
PrintAndLogEx(ERR, _RED_(" Couldn't authenticate key."));
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (keyno != 0xE) {
|
} else if (keyno != 0xE) {
|
||||||
PrintAndLogEx(ERR, _RED_(" Please authenticate first."));
|
PrintAndLogEx(ERR, _RED_(" Please authenticate first."));
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue