]> git.zerfleddert.de Git - proxmark3-svn/blame - client/emv/emvcore.h
optimization UDOL creation. does not affect on functionality.
[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
66efdc1f 32typedef struct {
33 uint8_t CLA;
34 uint8_t INS;
35 uint8_t P1;
36 uint8_t P2;
37 uint8_t Lc;
38 uint8_t *data;
39} sAPDU;
40
41enum CardPSVendor {
42 CV_NA,
43 CV_VISA,
44 CV_MASTERCARD,
45 CV_AMERICANEXPRESS,
46 CV_JCB,
47 CV_CB,
48 CV_OTHER,
49};
50extern enum CardPSVendor GetCardPSVendor(uint8_t * AID, size_t AIDlen);
51
a2bb2735 52extern void TLVPrintFromBuffer(uint8_t *data, int datalen);
3c5fce2b 53extern void TLVPrintFromTLV(struct tlvdb *tlv);
66efdc1f 54extern void TLVPrintFromTLVLev(struct tlvdb *tlv, int level);
3c5fce2b
OM
55extern void TLVPrintAIDlistFromSelectTLV(struct tlvdb *tlv);
56
66efdc1f 57extern struct tlvdb *GetPANFromTrack2(const struct tlv *track2);
58extern struct tlvdb *GetdCVVRawFromTrack2(const struct tlv *track2);
59
3c5fce2b
OM
60extern void SetAPDULogging(bool logging);
61
62// search application
63extern int EMVSearchPSE(bool ActivateField, bool LeaveFieldON, bool decodeTLV, struct tlvdb *tlv);
64extern int EMVSearch(bool ActivateField, bool LeaveFieldON, bool decodeTLV, struct tlvdb *tlv);
65extern int EMVSelectPSE(bool ActivateField, bool LeaveFieldON, uint8_t PSENum, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw);
66extern 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);
67// select application
68extern int EMVSelectApplication(struct tlvdb *tlv, uint8_t *AID, size_t *AIDlen);
69// Get Processing Options
70extern 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);
71extern 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);
66efdc1f 72// Mastercard
73int MSCComputeCryptoChecksum(bool LeaveFieldON, uint8_t *UDOL, uint8_t UDOLlen, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv);
a2bb2735 74
75#endif
76
77
78
79
Impressum, Datenschutz