]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/emv/emv_tags.c
Emv scan (#691)
[proxmark3-svn] / client / emv / emv_tags.c
index 80b4c29da8e8821438acf8a3d7fc42225e9b86f7..eed77e761b0c3c756d080d1fac4cc73f507d1495 100644 (file)
@@ -177,6 +177,7 @@ static const struct emv_tag emv_tags[] = {
        { 0x01  , "", EMV_TAG_STRING }, // string for headers
        { 0x02  , "Raw data", }, // data
        { 0x20  , "Cardholder Verification Results (CVR)", EMV_TAG_CVR }, // not standard!
+       { 0x21  , "Input list for Offline Data Authentication" }, // not standard! data for "Offline Data Authentication" come from "read records" command. (EMV book3 10.3)
 
        // EMV
        { 0x41  , "Country code and national data" },
@@ -266,10 +267,12 @@ static const struct emv_tag emv_tags[] = {
        { 0x9f65, "PCVC3(Track2)" },
        { 0x9f66, "PUNATC(Track2) / Terminal Transaction Qualifiers (TTQ)", EMV_TAG_BITMASK, &EMV_TTQ },
        { 0x9f67, "NATC(Track2) / MSD Offset" },
+       { 0x9f68, "Cardholder verification method list (PayPass)" },
        { 0x9f69, "Card Authentication Related Data" },
        { 0x9f6a, "Unpredictable Number", EMV_TAG_NUMERIC },
        { 0x9f6b, "Track 2 Data" },
        { 0x9f6c, "Card Transaction Qualifiers (CTQ)", EMV_TAG_BITMASK, &EMV_CTQ },
+       { 0x9f6e, "Form Factor Indicator" },
        { 0xa5  , "File Control Information (FCI) Proprietary Template" },
        { 0xbf0c, "File Control Information (FCI) Issuer Discretionary Data" },
        { 0xdf20, "Issuer Proprietary Bitmap (IPB)" },
@@ -483,20 +486,20 @@ static void emv_tag_dump_cid(const struct tlv *tlv, const struct emv_tag *tag, F
        }
        
        PRINT_INDENT(level);
-       if ((tlv->value[0] & 0xC0) == 0x00)     fprintf(f, "\tAC1: AAC (Transaction declined)\n");
-       if ((tlv->value[0] & 0xC0) == 0x40)     fprintf(f, "\tAC1: TC (Transaction approved)\n");
-       if ((tlv->value[0] & 0xC0) == 0x80)     fprintf(f, "\tAC1: ARQC (Online authorisation requested)\n");
-       if ((tlv->value[0] & 0xC0) == 0xC0)     fprintf(f, "\tAC1: RFU\n");
+       if ((tlv->value[0] & EMVAC_AC_MASK) == EMVAC_AAC)               fprintf(f, "\tAC1: AAC (Transaction declined)\n");
+       if ((tlv->value[0] & EMVAC_AC_MASK) == EMVAC_TC)                fprintf(f, "\tAC1: TC (Transaction approved)\n");
+       if ((tlv->value[0] & EMVAC_AC_MASK) == EMVAC_ARQC)              fprintf(f, "\tAC1: ARQC (Online authorisation requested)\n");
+       if ((tlv->value[0] & EMVAC_AC_MASK) == EMVAC_AC_MASK)   fprintf(f, "\tAC1: RFU\n");
 
-       if ((tlv->value[0] & 0x08) != 0x00) {
+       if (tlv->value[0] & EMVCID_ADVICE) {
                PRINT_INDENT(level);
                fprintf(f, "\tAdvice required!\n");
        }
 
-       if ((tlv->value[0] & 0x07) != 0x00) {
+       if (tlv->value[0] & EMVCID_REASON_MASK) {
                PRINT_INDENT(level);
                fprintf(f, "\tReason/advice/referral code: ");
-               switch((tlv->value[0] & 0x07)) {
+               switch((tlv->value[0] & EMVCID_REASON_MASK)) {
                        case 0:
                                fprintf(f, "No information given\n");
                                break;
@@ -510,7 +513,7 @@ static void emv_tag_dump_cid(const struct tlv *tlv, const struct emv_tag *tag, F
                                fprintf(f, "Issuer authentication failed\n");
                                break;
                        default:
-                               fprintf(f, "\tRFU: %2x\n", (tlv->value[0] & 0x07));
+                               fprintf(f, "\tRFU: %2x\n", (tlv->value[0] & EMVCID_REASON_MASK));
                                break;
                }
        }
@@ -683,3 +686,17 @@ bool emv_tag_dump(const struct tlv *tlv, FILE *f, int level)
 
        return true;
 }
+
+char *emv_get_tag_name(const struct tlv *tlv)
+{
+       static char *defstr = "";
+       
+       if (!tlv) 
+               return defstr;
+
+       const struct emv_tag *tag = emv_get_tag(tlv);
+       if (tag)
+               return tag->name;
+       
+       return defstr;
+}
Impressum, Datenschutz