]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/emv/emvcore.h
Update list of known EMV AIDs. Source: https://www.eftlab.co.uk/index.php/site-map...
[proxmark3-svn] / client / emv / emvcore.h
index d8b6a5c77278201701c5218a0ff3de3a6ae63a0d..010315ba9a19f77024e6801ac0e12ad4119eb8e9 100644 (file)
 #include "emv_pk.h"
 #include "emv_pki.h"
 
-#define APDU_RES_LEN 260
-#define APDU_AID_LEN 50
+// maximum APDU lengths. Long APDUs not yet supported/needed
+#define APDU_DATA_LEN      255
+#define APDU_COMMAND_LEN   (4 + 1 + APDU_DATA_LEN + 1)
+#define APDU_RESPONSE_LEN  (256 + 2)
 
 typedef enum {
        ECC_CONTACTLESS,
@@ -45,15 +47,6 @@ enum TransactionType {
 };
 extern char *TransactionTypeStr[];
 
-typedef struct {
-       uint8_t CLA;
-       uint8_t INS;
-       uint8_t P1;
-       uint8_t P2;
-       uint8_t Lc;
-       uint8_t *data;
-} sAPDU;
-
 enum CardPSVendor {
        CV_NA,
        CV_VISA,
@@ -61,11 +54,13 @@ enum CardPSVendor {
        CV_AMERICANEXPRESS,
        CV_JCB,
        CV_CB,
+       CV_SWITCH,
+       CV_DINERS,
        CV_OTHER,
 };
 extern enum CardPSVendor GetCardPSVendor(uint8_t * AID, size_t AIDlen);
 
-extern void TLVPrintFromBuffer(uint8_t *data, int datalen);
+extern bool TLVPrintFromBuffer(uint8_t *data, int datalen);
 extern void TLVPrintFromTLV(struct tlvdb *tlv);
 extern void TLVPrintFromTLVLev(struct tlvdb *tlv, int level);
 extern void TLVPrintAIDlistFromSelectTLV(struct tlvdb *tlv);
@@ -76,11 +71,10 @@ extern struct tlvdb *GetdCVVRawFromTrack2(const struct tlv *track2);
 extern void SetAPDULogging(bool logging);
 
 // exchange
-extern int EMVExchange(EMVCommandChannel channel, bool LeaveFieldON, sAPDU apdu, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv);
-
+extern int EMVExchange(EMVCommandChannel channel, bool LeaveFieldON, uint8_t *APDU, int APDU_len, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv);
 
 // search application
-extern int EMVSearchPSE(EMVCommandChannel channel, bool ActivateField, bool LeaveFieldON, bool decodeTLV, struct tlvdb *tlv);
+extern int EMVSearchPSE(EMVCommandChannel channel, bool ActivateField, bool LeaveFieldON, uint8_t PSENum, bool decodeTLV, struct tlvdb *tlv);
 extern int EMVSearch(EMVCommandChannel channel, bool ActivateField, bool LeaveFieldON, bool decodeTLV, struct tlvdb *tlv);
 extern int EMVSelectPSE(EMVCommandChannel channel, bool ActivateField, bool LeaveFieldON, uint8_t PSENum, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw);
 extern int EMVSelect(EMVCommandChannel channel, bool ActivateField, bool LeaveFieldON, uint8_t *AID, size_t AIDLen, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv);
@@ -103,6 +97,7 @@ extern int trCDA(struct tlvdb *tlv, struct tlvdb *ac_tlv, struct tlv *pdol_data_
 
 extern int RecoveryCertificates(struct tlvdb *tlvRoot, json_t *root);
 
+extern struct emv_pk *get_ca_pk(struct tlvdb *db);
 #endif
 
 
Impressum, Datenschutz