[FL-1595] Add EMV tags (#625)
* nfc: add expiration date tag to emv parser * nfc: add expiration date save and display * nfc: add long apdu test command
This commit is contained in:
@@ -214,13 +214,18 @@ uint16_t emv_prepare_read_sfi_record(uint8_t* dest, uint8_t sfi, uint8_t record_
|
||||
}
|
||||
|
||||
bool emv_decode_read_sfi_record(uint8_t* buff, uint16_t len, EmvApplication* app) {
|
||||
bool pan_parsed = false;
|
||||
for(uint16_t i = 0; i < len; i++) {
|
||||
if(buff[i] == EMV_TAG_PAN) {
|
||||
memcpy(app->card_number, &buff[i + 2], 8);
|
||||
return true;
|
||||
pan_parsed = true;
|
||||
} else if((buff[i] << 8 | buff[i + 1]) == EMV_TAG_EXP_DATE) {
|
||||
i += 3;
|
||||
app->exp_year = buff[i++];
|
||||
app->exp_month = buff[i++];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return pan_parsed;
|
||||
}
|
||||
|
||||
uint16_t emv_select_ppse_ans(uint8_t* buff) {
|
||||
|
@@ -16,6 +16,8 @@
|
||||
#define EMV_TAG_CARD_NUM 0x57
|
||||
#define EMV_TAG_PAN 0x5A
|
||||
#define EMV_TAG_AFL 0x94
|
||||
#define EMV_TAG_EXP_DATE 0x5F24
|
||||
#define EMV_TAG_CARDHOLDER_NAME 0x5F20
|
||||
|
||||
typedef struct {
|
||||
uint16_t tag;
|
||||
@@ -35,6 +37,9 @@ typedef struct {
|
||||
uint8_t aid_len;
|
||||
char name[32];
|
||||
uint8_t card_number[8];
|
||||
uint8_t exp_month;
|
||||
uint8_t exp_year;
|
||||
char crdholder_name[32];
|
||||
APDU pdol;
|
||||
APDU afl;
|
||||
} EmvApplication;
|
||||
|
Reference in New Issue
Block a user