Skip to content

Commit 16001bc

Browse files
committed
Stringify various EMV fields
* Signed Static Application Data; field 93 * Service Code; field 5F30 * Application Discretionary Data; field 9F05 * Cardholder Name Extended; field 9F0B * Issuer Identification Number Extended (IINE); field 9F0C * Token Requestor ID; field 9F19 * Track 2 Discretionary Data; field 9F20 * Last 4 Digits of PAN; field 9F25 * Amount, Reference Currency; field 9F3A
1 parent fd42690 commit 16001bc

File tree

3 files changed

+107
-1
lines changed

3 files changed

+107
-1
lines changed

src/emv_strings.c

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,14 @@ int emv_tlv_get_info(
298298
info->format = EMV_FORMAT_B;
299299
return 0;
300300

301+
case EMV_TAG_93_SIGNED_STATIC_APPLICATION_DATA:
302+
info->tag_name = "Signed Static Application Data";
303+
info->tag_desc =
304+
"Digital signature on critical application "
305+
"parameters for SDA";
306+
info->format = EMV_FORMAT_B;
307+
return 0;
308+
301309
case EMV_TAG_94_APPLICATION_FILE_LOCATOR:
302310
info->tag_name = "Application File Locator (AFL)";
303311
info->tag_desc =
@@ -406,6 +414,14 @@ int emv_tlv_get_info(
406414
info->format = EMV_FORMAT_AN;
407415
return emv_language_preference_get_string_list(tlv->value, tlv->length, value_str, value_str_len);
408416

417+
case EMV_TAG_5F30_SERVICE_CODE:
418+
info->tag_name = "Service Code";
419+
info->tag_desc =
420+
"Service code as defined in ISO/IEC 7813 for "
421+
"track 1 and track 2";
422+
info->format = EMV_FORMAT_N;
423+
return emv_tlv_value_get_string(tlv, info->format, 3, value_str, value_str_len);
424+
409425
case EMV_TAG_5F34_APPLICATION_PAN_SEQUENCE_NUMBER:
410426
info->tag_name = "Application Primary Account Number (PAN) Sequence Number";
411427
info->tag_desc =
@@ -501,6 +517,14 @@ int emv_tlv_get_info(
501517
info->format = EMV_FORMAT_B;
502518
return emv_amount_get_string(tlv->value, tlv->length, value_str, value_str_len);
503519

520+
case EMV_TAG_9F05_APPLICATION_DISCRETIONARY_DATA:
521+
info->tag_name = "Application Discretionary Data";
522+
info->tag_desc =
523+
"Issuer or payment system specified data "
524+
"relating to the application";
525+
info->format = EMV_FORMAT_B;
526+
return 0;
527+
504528
case EMV_TAG_9F06_AID:
505529
info->tag_name = "Application Identifier (AID) - terminal";
506530
info->tag_desc =
@@ -544,6 +568,30 @@ int emv_tlv_get_info(
544568
info->format = EMV_FORMAT_B;
545569
return emv_asrpd_get_string_list(tlv->value, tlv->length, value_str, value_str_len);
546570

571+
case EMV_TAG_9F0B_CARDHOLDER_NAME_EXTENDED:
572+
info->tag_name = "Cardholder Name Extended";
573+
info->tag_desc =
574+
"Indicates the whole cardholder name when "
575+
"greater than 26 characters using the same "
576+
"coding convention as in ISO/IEC 7813";
577+
info->format = EMV_FORMAT_ANS;
578+
return emv_tlv_value_get_string(tlv, info->format, 45, value_str, value_str_len);
579+
580+
case EMV_TAG_9F0C_IINE:
581+
info->tag_name = "Issuer Identification Number Extended (IINE)";
582+
info->tag_desc =
583+
"The number that identifies the major industry "
584+
"and the card issuer and that forms the first "
585+
"part of the Primary Account "
586+
"Number (PAN).\n"
587+
"While the first 6 digits of the IINE (tag '9F0C') "
588+
"and IIN (tag '42') are the same and there is no "
589+
"need to have both data objects on the card, "
590+
"cards may have both the IIN and IINE data "
591+
"objects present.";
592+
info->format = EMV_FORMAT_N;
593+
return emv_tlv_value_get_string(tlv, info->format, 8, value_str, value_str_len);
594+
547595
case EMV_TAG_9F0D_ISSUER_ACTION_CODE_DEFAULT:
548596
info->tag_name = "Issuer Action Code (IAC) - Default";
549597
info->tag_desc =
@@ -646,13 +694,38 @@ int emv_tlv_get_info(
646694
info->format = EMV_FORMAT_ANS;
647695
return emv_tlv_value_get_string(tlv, info->format, 0, value_str, value_str_len);
648696

697+
case EMV_TAG_9F19_TOKEN_REQUESTOR_ID:
698+
info->tag_name = "Token Requestor ID";
699+
info->tag_desc =
700+
"Uniquely identifies the pairing of the Token "
701+
"Requestor with the Token Domain, as defined "
702+
"in the EMV Payment Tokenisation "
703+
"Framework";
704+
info->format = EMV_FORMAT_N;
705+
return 0;
706+
707+
case EMV_TAG_9F20_TRACK2_DISCRETIONARY_DATA:
708+
info->tag_name = "Track 2 Discretionary Data";
709+
info->tag_desc =
710+
"Discretionary part of track 2 according to ISO/IEC 7813";
711+
info->format = EMV_FORMAT_CN;
712+
return emv_tlv_value_get_string(tlv, info->format, 0, value_str, value_str_len);
713+
649714
case EMV_TAG_9F21_TRANSACTION_TIME:
650715
info->tag_name = "Transaction Time";
651716
info->tag_desc =
652717
"Local time that the transaction was authorised";
653718
info->format = EMV_FORMAT_N;
654719
return emv_time_get_string(tlv->value, tlv->length, value_str, value_str_len);
655720

721+
case EMV_TAG_9F25_LAST_4_DIGITS_OF_PAN:
722+
info->tag_name = "Last 4 Digits of PAN";
723+
info->tag_desc =
724+
"The last four digits of the PAN, as defined in "
725+
"the EMV Payment Tokenisation Framework";
726+
info->format = EMV_FORMAT_N;
727+
return emv_tlv_value_get_string(tlv, info->format, 4, value_str, value_str_len);
728+
656729
case EMV_TAG_9F26_APPLICATION_CRYPTOGRAM:
657730
info->tag_name = "Application Cryptogram";
658731
info->tag_desc =
@@ -746,6 +819,13 @@ int emv_tlv_get_info(
746819
}
747820
return emv_pos_entry_mode_get_string(tlv->value[0], value_str, value_str_len);
748821

822+
case EMV_TAG_9F3A_AMOUNT_REFERENCE_CURRENCY:
823+
info->tag_name = "Amount, Reference Currency";
824+
info->tag_desc =
825+
"Authorised amount expressed in the reference currency";
826+
info->format = EMV_FORMAT_B;
827+
return emv_amount_get_string(tlv->value, tlv->length, value_str, value_str_len);
828+
749829
case EMV_TAG_9F3B_APPLICATION_REFERENCE_CURRENCY:
750830
info->tag_name = "Application Reference Currency";
751831
info->tag_desc =

src/emv_strings.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,6 @@ int emv_ctq_get_string_list(
606606

607607
/**
608608
* Stringify Amex Contactless Reader Capabilities (field 9F6D)
609-
* @note Strings in output buffer are delimited using "\n", including the last string
610609
* @param cl_reader_caps Contactless Reader Capabilities field
611610
* @param str String buffer output
612611
* @param str_len Length of string buffer in bytes

src/emv_tags.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ __BEGIN_DECLS
112112
/// EMV tag 92 Issuer Public Key Remainder. Template 70 or 77.
113113
#define EMV_TAG_92_ISSUER_PUBLIC_KEY_REMAINDER (0x92)
114114

115+
/// EMV tag 93 Signed Static Application Data. Template 70 or 77.
116+
#define EMV_TAG_93_SIGNED_STATIC_APPLICATION_DATA (0x93)
117+
115118
/// EMV tag 94 Application File Locator (AFL). Template 77 or 80.
116119
#define EMV_TAG_94_APPLICATION_FILE_LOCATOR (0x94)
117120

@@ -151,6 +154,9 @@ __BEGIN_DECLS
151154
/// EMV tag 5F2D Language Preference. Template A5.
152155
#define EMV_TAG_5F2D_LANGUAGE_PREFERENCE (0x5F2D)
153156

157+
/// EMV tag 5F30 Service Code. Template 70 or 77.
158+
#define EMV_TAG_5F30_SERVICE_CODE (0x5F30)
159+
154160
/// EMV tag 5F34 Application Primary Account Number (PAN) Sequence Number. Template 70 or 77.
155161
#define EMV_TAG_5F34_APPLICATION_PAN_SEQUENCE_NUMBER (0x5F34)
156162

@@ -184,6 +190,9 @@ __BEGIN_DECLS
184190
/// EMV tag 9F04 Amount, Other (Binary)
185191
#define EMV_TAG_9F04_AMOUNT_OTHER_BINARY (0x9F04)
186192

193+
/// EMV tag 9F05 Application Discretionary Data. Template 70 or 77.
194+
#define EMV_TAG_9F05_APPLICATION_DISCRETIONARY_DATA (0x9F05)
195+
187196
/// EMV tag 9F06 Application Identifier (AID) - terminal
188197
#define EMV_TAG_9F06_AID (0x9F06)
189198

@@ -199,6 +208,12 @@ __BEGIN_DECLS
199208
/// EMV tag 9F0A Application Selection Registered Proprietary Data (ASRPD)
200209
#define EMV_TAG_9F0A_ASRPD (0x9F0A)
201210

211+
/// EMV tag 9F0B Cardholder Name Extended. Template 70 or 77.
212+
#define EMV_TAG_9F0B_CARDHOLDER_NAME_EXTENDED (0x9F0B)
213+
214+
/// EMV tag 9F0C Issuer Identification Number Extended (IINE). Template BF0C or 73.
215+
#define EMV_TAG_9F0C_IINE (0x9F0C)
216+
202217
/// EMV tag 9F0D Issuer Action Code (IAC) - Default. Template 70 or 77.
203218
#define EMV_TAG_9F0D_ISSUER_ACTION_CODE_DEFAULT (0x9F0D)
204219

@@ -240,9 +255,18 @@ __BEGIN_DECLS
240255
/// EMV tag 9F1F Track 1 Discretionary Data. Template 70 or 77.
241256
#define EMV_TAG_9F1F_TRACK1_DISCRETIONARY_DATA (0x9F1F)
242257

258+
/// EMV tag 9F19 Token Requestor ID. Template 70 or 77.
259+
#define EMV_TAG_9F19_TOKEN_REQUESTOR_ID (0x9F19)
260+
261+
/// EMV tag 9F20 Track 2 Discretionary Data. Template 70 or 77.
262+
#define EMV_TAG_9F20_TRACK2_DISCRETIONARY_DATA (0x9F20)
263+
243264
/// EMV tag 9F21 Transaction Time
244265
#define EMV_TAG_9F21_TRANSACTION_TIME (0x9F21)
245266

267+
/// EMV tag 9F25 Last 4 Digits of PAN. Template 70 or 77.
268+
#define EMV_TAG_9F25_LAST_4_DIGITS_OF_PAN (0x9F25)
269+
246270
/// EMV tag 9F26 Application Cryptogram. Template 77 or 80.
247271
#define EMV_TAG_9F26_APPLICATION_CRYPTOGRAM (0x9F26)
248272

@@ -273,6 +297,9 @@ __BEGIN_DECLS
273297
/// EMV tag 9F39 Point-of-Service (POS) Entry Mode
274298
#define EMV_TAG_9F39_POS_ENTRY_MODE (0x9F39)
275299

300+
/// EMV tag 9F3A Amount, Reference Currency
301+
#define EMV_TAG_9F3A_AMOUNT_REFERENCE_CURRENCY (0x9F3A)
302+
276303
/// EMV tag 9F3B Application Reference Currency. Template 70 or 77.
277304
#define EMV_TAG_9F3B_APPLICATION_REFERENCE_CURRENCY (0x9F3B)
278305

0 commit comments

Comments
 (0)