Move custom polling frame generation logic to client
This commit is contained in:
1 parent
a9cba02514
commit
7f5e1c9657
5 files changed
+105
-88
No files matched your search
+21
-7
@@ -41,7 +41,20 @@
|
||||
#include "mbedtls/ecc_point_compression.h"
|
||||
#include "mbedtls/gcm.h"
|
||||
|
||||
uint8_t ecpData[] = { 0x6a, 0x01, 0x00, 0x00, 0x04 };
|
||||
static const iso14a_polling_frame WUPA_FRAME = {
|
||||
.frame={ 0x52 },
|
||||
.frame_length=1,
|
||||
.last_byte_bits=7,
|
||||
.extra_delay=0,
|
||||
};
|
||||
|
||||
static const iso14a_polling_frame ECP_VAS_ONLY_FRAME = {
|
||||
.frame={0x6a, 0x01, 0x00, 0x00, 0x02, 0xe4, 0xd2},
|
||||
.frame_length=7,
|
||||
.last_byte_bits=8,
|
||||
.extra_delay=0,
|
||||
};
|
||||
|
||||
uint8_t aid[] = { 0x4f, 0x53, 0x45, 0x2e, 0x56, 0x41, 0x53, 0x2e, 0x30, 0x31 };
|
||||
uint8_t getVasUrlOnlyP2 = 0x00;
|
||||
uint8_t getVasFullReqP2 = 0x01;
|
||||
@@ -336,12 +349,13 @@ static int DecryptVASCryptogram(uint8_t *pidHash, uint8_t *cryptogram, size_t cr
|
||||
static int VASReader(uint8_t *pidHash, const char *url, size_t urlLen, uint8_t *cryptogram, size_t *cryptogramLen, bool verbose) {
|
||||
clearCommandBuffer();
|
||||
|
||||
uint16_t flags = ISO14A_RAW | ISO14A_CONNECT | ISO14A_NO_SELECT | ISO14A_APPEND_CRC | ISO14A_NO_DISCONNECT;
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, flags, sizeof(ecpData), 0, ecpData, sizeof(ecpData));
|
||||
iso14a_polling_parameters polling_parameters = {
|
||||
.frames={ WUPA_FRAME, ECP_VAS_ONLY_FRAME },
|
||||
.frame_count=2,
|
||||
.extra_timeout=250
|
||||
};
|
||||
|
||||
msleep(160);
|
||||
|
||||
if (SelectCard14443A_4(false, false, NULL) != PM3_SUCCESS) {
|
||||
if (SelectCard14443A_4_WithParameters(false, false, NULL, &polling_parameters) != PM3_SUCCESS) {
|
||||
PrintAndLogEx(FAILED, "No card in field");
|
||||
return PM3_ECARDEXCHANGE;
|
||||
}
|
||||
@@ -349,7 +363,7 @@ static int VASReader(uint8_t *pidHash, const char *url, size_t urlLen, uint8_t *
|
||||
uint16_t status = 0;
|
||||
size_t resLen = 0;
|
||||
uint8_t selectResponse[APDU_RES_LEN] = {0};
|
||||
Iso7816Select(CC_CONTACTLESS, true, true, aid, sizeof(aid), selectResponse, APDU_RES_LEN, &resLen, &status);
|
||||
Iso7816Select(CC_CONTACTLESS, false, true, aid, sizeof(aid), selectResponse, APDU_RES_LEN, &resLen, &status);
|
||||
|
||||
if (status != 0x9000) {
|
||||
PrintAndLogEx(FAILED, "Card doesn't support VAS");
|
||||
|
||||
Reference in new issue
Block a user