NFC fap: EMV protocol added

This commit is contained in:
Methodius
2024-01-11 18:11:54 +09:00
parent 3959827fd4
commit e9454b629b
11 changed files with 281 additions and 7 deletions
+2
View File
@@ -22,6 +22,7 @@ env.Append(
File("protocols/mf_ultralight/mf_ultralight.h"),
File("protocols/mf_classic/mf_classic.h"),
File("protocols/mf_desfire/mf_desfire.h"),
File("protocols/emv/emv.h"),
File("protocols/slix/slix.h"),
File("protocols/st25tb/st25tb.h"),
# Pollers
@@ -32,6 +33,7 @@ env.Append(
File("protocols/mf_ultralight/mf_ultralight_poller.h"),
File("protocols/mf_classic/mf_classic_poller.h"),
File("protocols/mf_desfire/mf_desfire_poller.h"),
File("protocols/emv/emv_poller.h"),
File("protocols/st25tb/st25tb_poller.h"),
# Listeners
File("protocols/iso14443_3a/iso14443_3a_listener.h"),
+2 -2
View File
@@ -41,8 +41,8 @@ typedef struct {
bool app_started;
char name[32];
bool name_found;
uint8_t card_number[10];
uint8_t card_number_len;
uint8_t pan[10];
uint8_t pan_len;
uint8_t exp_month;
uint8_t exp_year;
uint16_t country_code;
+4 -4
View File
@@ -186,8 +186,8 @@ static bool emv_decode_response(const uint8_t* buff, uint16_t len, EmvApplicatio
// 0xD0 delimits PAN from expiry (YYMM)
for(int x = 1; x < tlen; x++) {
if(buff[i + x + 1] > 0xD0) {
memcpy(app->card_number, &buff[i], x + 1);
app->card_number_len = x + 1;
memcpy(app->pan, &buff[i], x + 1);
app->pan_len = x + 1;
app->exp_year = (buff[i + x + 1] << 4) | (buff[i + x + 2] >> 4);
app->exp_month = (buff[i + x + 2] << 4) | (buff[i + x + 3] >> 4);
break;
@@ -213,8 +213,8 @@ static bool emv_decode_response(const uint8_t* buff, uint16_t len, EmvApplicatio
break;
}
case EMV_TAG_PAN:
memcpy(app->card_number, &buff[i], tlen);
app->card_number_len = tlen;
memcpy(app->pan, &buff[i], tlen);
app->pan_len = tlen;
success = true;
break;
case EMV_TAG_EXP_DATE: