mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 21:33:47 -07:00
Accept key number from command line
This commit is contained in:
parent
a07a448220
commit
6534821365
1 changed files with 9 additions and 2 deletions
|
@ -226,7 +226,7 @@ void MifareDES_Auth1(uint8_t mode, uint8_t algo, uint8_t keyno, uint8_t *datain
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd[0] = AUTHENTICATE;
|
cmd[0] = AUTHENTICATE;
|
||||||
cmd[1] = 0x00; //keynumber
|
cmd[1] = keyno; //keynumber
|
||||||
len = DesfireAPDU(cmd, 2, resp);
|
len = DesfireAPDU(cmd, 2, resp);
|
||||||
if ( !len ) {
|
if ( !len ) {
|
||||||
if (MF_DBGLEVEL >= 1) {
|
if (MF_DBGLEVEL >= 1) {
|
||||||
|
@ -236,6 +236,13 @@ void MifareDES_Auth1(uint8_t mode, uint8_t algo, uint8_t keyno, uint8_t *datain
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( resp[2] == 0xaf ){
|
||||||
|
} else {
|
||||||
|
DbpString("Authetication failed. Invalid key number.");
|
||||||
|
OnError();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
memcpy( encRndB, resp+3, 8);
|
memcpy( encRndB, resp+3, 8);
|
||||||
|
|
||||||
des_dec(&decRndB, &encRndB, &keybytes);
|
des_dec(&decRndB, &encRndB, &keybytes);
|
||||||
|
@ -277,7 +284,7 @@ void MifareDES_Auth1(uint8_t mode, uint8_t algo, uint8_t keyno, uint8_t *datain
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TOD: Optionally, confirm ek0RndA' = RndA' to varify PICC
|
// TODO: Optionally, confirm ek0RndA' = RndA' to varify PICC
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue