mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-26 03:39:58 -07:00
application interchange profile parse added
This commit is contained in:
@@ -82,7 +82,6 @@ bool emv_load(EmvData* data, FlipperFormat* ff, uint32_t version) {
|
||||
flipper_format_read_string(ff, "Application name", temp_str);
|
||||
strcpy(app->application_name, furi_string_get_cstr(temp_str));
|
||||
|
||||
//Read label
|
||||
flipper_format_read_string(ff, "Application label", temp_str);
|
||||
strcpy(app->application_label, furi_string_get_cstr(temp_str));
|
||||
|
||||
@@ -98,6 +97,10 @@ bool emv_load(EmvData* data, FlipperFormat* ff, uint32_t version) {
|
||||
|
||||
if(!flipper_format_read_hex(ff, "AID", app->aid, aid_len)) break;
|
||||
|
||||
if(!flipper_format_read_hex(
|
||||
ff, "Application interchange profile", app->application_interchange_profile, 2))
|
||||
break;
|
||||
|
||||
if(!flipper_format_read_hex(ff, "Country code", (uint8_t*)&app->country_code, 2)) break;
|
||||
|
||||
if(!flipper_format_read_hex(ff, "Currency code", (uint8_t*)&app->currency_code, 2)) break;
|
||||
@@ -151,6 +154,10 @@ bool emv_save(const EmvData* data, FlipperFormat* ff) {
|
||||
|
||||
if(!flipper_format_write_hex(ff, "AID", app.aid, aid_len)) break;
|
||||
|
||||
if(!flipper_format_write_hex(
|
||||
ff, "Application interchange profile", app.application_interchange_profile, 2))
|
||||
break;
|
||||
|
||||
if(!flipper_format_write_hex(ff, "Country code", (uint8_t*)&app.country_code, 2)) break;
|
||||
|
||||
if(!flipper_format_write_hex(ff, "Currency code", (uint8_t*)&app.currency_code, 2)) break;
|
||||
|
||||
@@ -12,6 +12,7 @@ extern "C" {
|
||||
|
||||
#define EMV_TAG_AID 0x4F
|
||||
#define EMV_TAG_PRIORITY 0x87
|
||||
#define EMV_TAG_APPL_INTERCHANGE_PROFILE 0x82
|
||||
#define EMV_TAG_PDOL 0x9F38
|
||||
#define EMV_TAG_APPL_LABEL 0x50
|
||||
#define EMV_TAG_APPL_NAME 0x9F12
|
||||
@@ -79,6 +80,7 @@ typedef struct {
|
||||
uint8_t priority;
|
||||
uint8_t aid[16];
|
||||
uint8_t aid_len;
|
||||
uint8_t application_interchange_profile[2];
|
||||
char application_name[16 + 1];
|
||||
char application_label[16 + 1];
|
||||
char cardholder_name[24 + 1];
|
||||
|
||||
@@ -115,6 +115,16 @@ static bool
|
||||
success = true;
|
||||
FURI_LOG_T(TAG, "found EMV_TAG_APP_PRIORITY %X: %d", tag, app->priority);
|
||||
break;
|
||||
case EMV_TAG_APPL_INTERCHANGE_PROFILE:
|
||||
furi_check(tlen == 2);
|
||||
memcpy(app->application_interchange_profile, &buff[i], tlen);
|
||||
success = true;
|
||||
FURI_LOG_T(TAG, "found EMV_TAG_APPL_INTERCHANGE_PROFILE %x: ", tag);
|
||||
for(size_t x = 0; x < tlen; x++) {
|
||||
FURI_LOG_RAW_T("%02X ", app->application_interchange_profile[x]);
|
||||
}
|
||||
FURI_LOG_RAW_T("\r\n");
|
||||
break;
|
||||
case EMV_TAG_APPL_LABEL:
|
||||
memcpy(app->application_label, &buff[i], tlen);
|
||||
app->application_label[tlen] = '\0';
|
||||
|
||||
Reference in New Issue
Block a user