]> cvs.zerfleddert.de Git - proxmark3-svn/blame - client/emv/emvcore.h
fixing the fix: older shells don't know about &>
[proxmark3-svn] / client / emv / emvcore.h
CommitLineData
a2bb2735 1//-----------------------------------------------------------------------------
2// Copyright (C) 2017 Merlok
3//
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
6// the license.
7//-----------------------------------------------------------------------------
3c5fce2b 8// EMV core functionality
a2bb2735 9//-----------------------------------------------------------------------------
10
11#ifndef EMVCORE_H__
12#define EMVCORE_H__
13
14#include <stdio.h>
15#include <stdint.h>
16#include <stdlib.h>
17#include <inttypes.h>
3c5fce2b 18#include <string.h>
a2bb2735 19#include "util.h"
20#include "common.h"
21#include "ui.h"
3c5fce2b
OM
22#include "cmdhf14a.h"
23#include "emv/apduinfo.h"
a2bb2735 24#include "emv/tlv.h"
3c5fce2b 25#include "emv/dol.h"
a2bb2735 26#include "emv/dump.h"
27#include "emv/emv_tags.h"
28
3c5fce2b
OM
29#define APDU_RES_LEN 260
30#define APDU_AID_LEN 50
31
10d4f823 32enum TransactionType {
33 TT_MSD,
34 TT_VSDC, // not standart for contactless!!!!
35 TT_QVSDCMCHIP,
36 TT_CDA,
37};
38
66efdc1f 39typedef struct {
40 uint8_t CLA;
41 uint8_t INS;
42 uint8_t P1;
43 uint8_t P2;
44 uint8_t Lc;
45 uint8_t *data;
46} sAPDU;
47
48enum CardPSVendor {
49 CV_NA,
50 CV_VISA,
51 CV_MASTERCARD,
52 CV_AMERICANEXPRESS,
53 CV_JCB,
54 CV_CB,
55 CV_OTHER,
56};
57extern enum CardPSVendor GetCardPSVendor(uint8_t * AID, size_t AIDlen);
58
a2bb2735 59extern void TLVPrintFromBuffer(uint8_t *data, int datalen);
3c5fce2b 60extern void TLVPrintFromTLV(struct tlvdb *tlv);
66efdc1f 61extern void TLVPrintFromTLVLev(struct tlvdb *tlv, int level);
3c5fce2b
OM
62extern void TLVPrintAIDlistFromSelectTLV(struct tlvdb *tlv);
63
66efdc1f 64extern struct tlvdb *GetPANFromTrack2(const struct tlv *track2);
65extern struct tlvdb *GetdCVVRawFromTrack2(const struct tlv *track2);
66
3c5fce2b
OM
67extern void SetAPDULogging(bool logging);
68
69// search application
70extern int EMVSearchPSE(bool ActivateField, bool LeaveFieldON, bool decodeTLV, struct tlvdb *tlv);
71extern int EMVSearch(bool ActivateField, bool LeaveFieldON, bool decodeTLV, struct tlvdb *tlv);
72extern int EMVSelectPSE(bool ActivateField, bool LeaveFieldON, uint8_t PSENum, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw);
73extern 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);
74// select application
75extern int EMVSelectApplication(struct tlvdb *tlv, uint8_t *AID, size_t *AIDlen);
76// Get Processing Options
77extern 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);
78extern 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);
10d4f823 79// AC
80extern int EMVGenerateChallenge(bool LeaveFieldON, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv);
81extern 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);
66efdc1f 82// Mastercard
83int MSCComputeCryptoChecksum(bool LeaveFieldON, uint8_t *UDOL, uint8_t UDOLlen, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv);
10d4f823 84// Auth
85extern int trSDA(uint8_t *AID, size_t AIDlen, struct tlvdb *tlv);
a2bb2735 86
87#endif
88
89
90
91
Impressum, Datenschutz