Skip to content

Commit ab98641

Browse files
committed
Define PSE and PPSE strings
These definitions can be used to stringify DF Name (field 84) as well as by the TAL.
1 parent fad8d4a commit ab98641

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

src/emv_fields.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828

2929
__BEGIN_DECLS
3030

31+
// Payment System Environment strings
32+
#define EMV_PSE "1PAY.SYS.DDF01" ///< Payment System Environment (PSE)
33+
#define EMV_PPSE "2PAY.SYS.DDF01" ///< Proximity Payment System Environment (PPSE)
34+
3135
// Application Priority Indicator
3236
// See EMV 4.4 Book 1, 12.2.3, table 13
3337
#define EMV_APP_PRIORITY_INDICATOR_MASK (0x0F)

src/emv_strings.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,15 @@ int emv_tlv_get_info(
222222
"Identifies the name of the Dedicated File (DF) as described "
223223
"in ISO/IEC 7816-4";
224224
info->format = EMV_FORMAT_B;
225+
if ((tlv->length == strlen(EMV_PSE) && strncmp((const char*)tlv->value, EMV_PSE, strlen(EMV_PSE))) ||
226+
(tlv->length == strlen(EMV_PPSE) && strncmp((const char*)tlv->value, EMV_PPSE, strlen(EMV_PPSE)))
227+
) {
228+
if (value_str_len > tlv->length) {
229+
memcpy(value_str, tlv->value, tlv->length);
230+
value_str[tlv->length] = 0;
231+
}
232+
return 0;
233+
}
225234
return emv_aid_get_string(tlv->value, tlv->length, value_str, value_str_len);
226235

227236
case EMV_TAG_87_APPLICATION_PRIORITY_INDICATOR:

src/emv_tal.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ int emv_tal_read_pse(
5050
)
5151
{
5252
int r;
53-
const uint8_t PSE[] = "1PAY.SYS.DDF01";
5453
uint8_t fci[EMV_RAPDU_DATA_MAX];
5554
size_t fci_len = sizeof(fci);
5655
uint16_t sw1sw2;
@@ -66,8 +65,8 @@ int emv_tal_read_pse(
6665
// SELECT Payment System Environment (PSE) Directory Definition File (DDF)
6766
// See EMV 4.4 Book 1, 12.2.2
6867
// See EMV 4.4 Book 1, 12.3.2
69-
emv_debug_info("SELECT %s", PSE);
70-
r = emv_ttl_select_by_df_name(ttl, PSE, sizeof(PSE) - 1, fci, &fci_len, &sw1sw2);
68+
emv_debug_info("SELECT %s", EMV_PSE);
69+
r = emv_ttl_select_by_df_name(ttl, EMV_PSE, strlen(EMV_PSE), fci, &fci_len, &sw1sw2);
7170
if (r) {
7271
emv_debug_trace_msg("emv_ttl_select_by_df_name() failed; r=%d", r);
7372

0 commit comments

Comments
 (0)