mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-24 01:28:11 -07:00
cardholder name parsing prepared
This commit is contained in:
@@ -77,11 +77,11 @@ bool emv_load(EmvData* data, FlipperFormat* ff, uint32_t version) {
|
||||
EmvApplication* app = &data->emv_application;
|
||||
|
||||
flipper_format_read_string(ff, "Application name", temp_str);
|
||||
strcpy(app->name, furi_string_get_cstr(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->label, furi_string_get_cstr(temp_str));
|
||||
strcpy(app->application_label, furi_string_get_cstr(temp_str));
|
||||
|
||||
uint32_t pan_len;
|
||||
if(!flipper_format_read_uint32(ff, "PAN length", &pan_len, 1)) break;
|
||||
@@ -131,9 +131,10 @@ bool emv_save(const EmvData* data, FlipperFormat* ff) {
|
||||
|
||||
if(!flipper_format_write_comment_cstr(ff, "EMV specific data:\n")) break;
|
||||
|
||||
if(!flipper_format_write_string_cstr(ff, "Application name", app.name)) break;
|
||||
if(!flipper_format_write_string_cstr(ff, "Application name", app.application_name)) break;
|
||||
|
||||
if(!flipper_format_write_string_cstr(ff, "Application label", app.label)) break;
|
||||
if(!flipper_format_write_string_cstr(ff, "Application label", app.application_label))
|
||||
break;
|
||||
|
||||
uint32_t pan_len = app.pan_len;
|
||||
if(!flipper_format_write_uint32(ff, "PAN length", &pan_len, 1)) break;
|
||||
|
||||
@@ -78,8 +78,9 @@ typedef struct {
|
||||
uint8_t priority;
|
||||
uint8_t aid[16];
|
||||
uint8_t aid_len;
|
||||
char name[16 + 1];
|
||||
char label[16 + 1];
|
||||
char application_name[16 + 1];
|
||||
char application_label[16 + 1];
|
||||
char cardholder_name[24 + 1];
|
||||
uint8_t pan[10]; // card_number
|
||||
uint8_t pan_len;
|
||||
uint8_t exp_day;
|
||||
|
||||
@@ -116,17 +116,17 @@ static bool
|
||||
FURI_LOG_T(TAG, "found EMV_TAG_APP_PRIORITY %X: %d", tag, app->priority);
|
||||
break;
|
||||
case EMV_TAG_APPL_LABEL:
|
||||
memcpy(app->label, &buff[i], tlen);
|
||||
app->label[tlen] = '\0';
|
||||
memcpy(app->application_label, &buff[i], tlen);
|
||||
app->application_label[tlen] = '\0';
|
||||
success = true;
|
||||
FURI_LOG_T(TAG, "found EMV_TAG_APPL_LABEL %x: %s", tag, app->label);
|
||||
FURI_LOG_T(TAG, "found EMV_TAG_APPL_LABEL %x: %s", tag, app->application_label);
|
||||
break;
|
||||
case EMV_TAG_APPL_NAME:
|
||||
furi_check(tlen < sizeof(app->name));
|
||||
memcpy(app->name, &buff[i], tlen);
|
||||
app->name[tlen] = '\0';
|
||||
furi_check(tlen < sizeof(app->application_name));
|
||||
memcpy(app->application_name, &buff[i], tlen);
|
||||
app->application_name[tlen] = '\0';
|
||||
success = true;
|
||||
FURI_LOG_T(TAG, "found EMV_TAG_APPL_NAME %x: %s", tag, app->name);
|
||||
FURI_LOG_T(TAG, "found EMV_TAG_APPL_NAME %x: %s", tag, app->application_name);
|
||||
break;
|
||||
case EMV_TAG_APPL_EFFECTIVE:
|
||||
app->effective_year = buff[i];
|
||||
@@ -190,11 +190,11 @@ static bool
|
||||
break;
|
||||
}
|
||||
case EMV_TAG_CARDHOLDER_NAME: {
|
||||
char name[27];
|
||||
memcpy(name, &buff[i], tlen);
|
||||
name[tlen] = '\0';
|
||||
if(strlen(app->cardholder_name) > tlen) break;
|
||||
memcpy(app->cardholder_name, &buff[i], tlen);
|
||||
app->cardholder_name[tlen] = '\0';
|
||||
success = true;
|
||||
FURI_LOG_T(TAG, "found EMV_TAG_CARDHOLDER_NAME %x: %s", tag, name);
|
||||
FURI_LOG_T(TAG, "found EMV_TAG_CARDHOLDER_NAME %x: %s", tag, app->cardholder_name);
|
||||
break;
|
||||
}
|
||||
case EMV_TAG_PAN:
|
||||
|
||||
Reference in New Issue
Block a user