]>
cvs.zerfleddert.de Git - proxmark3-svn/blob - client/emv/emvcore.h
1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2017 Merlok
4 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
5 // at your option, any later version. See the LICENSE.txt file for the text of
7 //-----------------------------------------------------------------------------
8 // EMV core functionality
9 //-----------------------------------------------------------------------------
23 #include "emv/apduinfo.h"
27 #include "emv/emv_tags.h"
29 #define APDU_RES_LEN 260
30 #define APDU_AID_LEN 50
32 enum TransactionType
{
34 TT_VSDC
, // not standart for contactless!!!!
57 extern enum CardPSVendor
GetCardPSVendor(uint8_t * AID
, size_t AIDlen
);
59 extern void TLVPrintFromBuffer(uint8_t *data
, int datalen
);
60 extern void TLVPrintFromTLV(struct tlvdb
*tlv
);
61 extern void TLVPrintFromTLVLev(struct tlvdb
*tlv
, int level
);
62 extern void TLVPrintAIDlistFromSelectTLV(struct tlvdb
*tlv
);
64 extern struct tlvdb
*GetPANFromTrack2(const struct tlv
*track2
);
65 extern struct tlvdb
*GetdCVVRawFromTrack2(const struct tlv
*track2
);
67 extern void SetAPDULogging(bool logging
);
70 extern int EMVSearchPSE(bool ActivateField
, bool LeaveFieldON
, bool decodeTLV
, struct tlvdb
*tlv
);
71 extern int EMVSearch(bool ActivateField
, bool LeaveFieldON
, bool decodeTLV
, struct tlvdb
*tlv
);
72 extern int EMVSelectPSE(bool ActivateField
, bool LeaveFieldON
, uint8_t PSENum
, uint8_t *Result
, size_t MaxResultLen
, size_t *ResultLen
, uint16_t *sw
);
73 extern int EMVSelect(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
);
75 extern int EMVSelectApplication(struct tlvdb
*tlv
, uint8_t *AID
, size_t *AIDlen
);
76 // Get Processing Options
77 extern int EMVGPO(bool LeaveFieldON
, uint8_t *PDOL
, size_t PDOLLen
, uint8_t *Result
, size_t MaxResultLen
, size_t *ResultLen
, uint16_t *sw
, struct tlvdb
*tlv
);
78 extern int EMVReadRecord(bool LeaveFieldON
, uint8_t SFI
, uint8_t SFIrec
, uint8_t *Result
, size_t MaxResultLen
, size_t *ResultLen
, uint16_t *sw
, struct tlvdb
*tlv
);
80 extern int EMVGenerateChallenge(bool LeaveFieldON
, uint8_t *Result
, size_t MaxResultLen
, size_t *ResultLen
, uint16_t *sw
, struct tlvdb
*tlv
);
81 extern int EMVAC(bool LeaveFieldON
, uint8_t RefControl
, uint8_t *CDOL
, size_t CDOLLen
, uint8_t *Result
, size_t MaxResultLen
, size_t *ResultLen
, uint16_t *sw
, struct tlvdb
*tlv
);
83 int MSCComputeCryptoChecksum(bool LeaveFieldON
, uint8_t *UDOL
, uint8_t UDOLlen
, uint8_t *Result
, size_t MaxResultLen
, size_t *ResultLen
, uint16_t *sw
, struct tlvdb
*tlv
);
85 extern int trSDA(uint8_t *AID
, size_t AIDlen
, struct tlvdb
*tlv
);