mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-13 02:34:48 +08:00
rem: remove emv implementations from peter fillmore. There is a better one on client side.
This commit is contained in:
parent
9d4d8b6e2c
commit
fcbb559b63
8 changed files with 2 additions and 3504 deletions
|
@ -44,12 +44,12 @@ APP_CFLAGS = -DWITH_CRC \
|
|||
SRC_LCD = fonts.c LCD.c
|
||||
SRC_LF = lfops.c hitag2.c hitagS.c lfsampling.c pcf7931.c lfdemod.c
|
||||
SRC_ISO15693 = iso15693.c iso15693tools.c
|
||||
SRC_ISO14443a = iso14443a.c mifareutil.c mifarecmd.c mifaresniff.c epa.c
|
||||
SRC_ISO14443a = iso14443a.c mifareutil.c mifarecmd.c mifaresniff.c epa.c mifaresim.c
|
||||
SRC_ISO14443b = iso14443b.c
|
||||
SRC_FELICA = felica.c
|
||||
SRC_CRAPTO1 = crypto1.c des.c aes.c desfire_key.c desfire_crypto.c mifaredesfire.c
|
||||
SRC_CRC = iso14443crc.c crc.c crc16.c crc32.c
|
||||
SRC_EMV = tlv.c emvdataels.c emvutil.c emvcmd.c
|
||||
#SRC_EMV = tlv.c emvdataels.c emvutil.c emvcmd.c
|
||||
SRC_ICLASS = iclass.c optimized_cipher.c
|
||||
SRC_LEGIC = legicrf.c legic_prng.c
|
||||
SRC_FLASH = flash.c
|
||||
|
|
245
armsrc/emvcard.h
245
armsrc/emvcard.h
|
@ -1,245 +0,0 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Peter Fillmore 2014
|
||||
// code derived off merloks mifare code
|
||||
//
|
||||
//
|
||||
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
|
||||
// at your option, any later version. See the LICENSE.txt file for the text of
|
||||
// the license.
|
||||
//-----------------------------------------------------------------------------
|
||||
// structure to hold EMV card and terminal parameters
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef __EMVCARD_H
|
||||
#define __EMVCARD_H
|
||||
|
||||
//structure to hold received/set tag values
|
||||
//variable data inputs have length specifiers
|
||||
typedef struct {
|
||||
//ISO14443-A card stuff
|
||||
uint8_t ATQA[2]; //Answer to Request
|
||||
uint8_t UID_len;
|
||||
uint8_t UID[10];
|
||||
uint8_t SAK;
|
||||
uint8_t ATS_len; //Answer to select
|
||||
uint8_t ATS[256];
|
||||
//ATS
|
||||
uint8_t TL;
|
||||
uint8_t T0;
|
||||
uint8_t TA1;
|
||||
uint8_t TB1;
|
||||
uint8_t TC1;
|
||||
uint8_t* historicalbytes;
|
||||
//PPS response
|
||||
uint8_t PPSS;
|
||||
//SFI 2 record 1
|
||||
uint8_t tag_4F_len; //length of AID
|
||||
uint8_t tag_4F[16]; //Application Identifier (AID)
|
||||
uint8_t tag_50_len; //length of application label
|
||||
uint8_t tag_50[16]; //Application Label
|
||||
uint8_t tag_56_len; //track1 length
|
||||
uint8_t tag_56[76]; //Track 1 Data
|
||||
uint8_t tag_57_len; //track2 equiv len
|
||||
uint8_t tag_57[19]; //Track 2 Equivalent Data
|
||||
uint8_t tag_5A_len; //PAN length
|
||||
uint8_t tag_5A[10]; //Application Primary Account Number (PAN)
|
||||
//uint8_t tag_6F[]; //File Control Information (FCI) Template
|
||||
//uint8_t tag_70[255]; //Record Template
|
||||
//uint8_t tag_77[]; //Response Message Template Format 2
|
||||
//uint8_t tag_80[]; //Response Message Template Format 1
|
||||
uint8_t tag_82[2]; //Application Interchange Profile AIP
|
||||
//uint8_t tag_83[]; //Command Template
|
||||
uint8_t tag_84_len;
|
||||
uint8_t tag_84[16]; //DF Name
|
||||
uint8_t tag_86_len;
|
||||
uint8_t tag_86[261]; //Issuer Script Command
|
||||
uint8_t tag_87[1]; //Application Priority Indicator
|
||||
uint8_t tag_88[1]; //Short File Identifier
|
||||
uint8_t tag_8A[2]; //Authorisation Response Code
|
||||
uint8_t tag_8C_len;
|
||||
uint8_t tag_8C[252]; //CDOL1
|
||||
uint8_t tag_8D_len;
|
||||
uint8_t tag_8D[252]; //CDOL2
|
||||
uint8_t tag_8E_len;
|
||||
uint8_t tag_8E[252]; //Cardholder Verification Method (CVM) List
|
||||
uint8_t tag_8F[1]; //Certification Authority Public Key Index
|
||||
uint8_t tag_90_len;
|
||||
uint8_t tag_90[255]; //ssuer Public Key Certificate
|
||||
uint8_t tag_92_len;
|
||||
uint8_t tag_92[255]; //Issuer Public Key Remainder
|
||||
uint8_t tag_93_len;
|
||||
uint8_t tag_93[255]; //Signed Static Application Data
|
||||
uint8_t tag_94_len;
|
||||
uint8_t tag_94[252]; //Application File Locator AFL
|
||||
uint8_t tag_95[5]; //Terminal Verification Results
|
||||
uint8_t tag_97_len;
|
||||
uint8_t tag_97[252]; //Transaction Certificate Data Object List (TDOL)
|
||||
uint8_t tag_98[20]; //Transaction Certificate (TC) Hash Value
|
||||
//assume 20 bytes, change after testing
|
||||
uint8_t tag_99_len;
|
||||
uint8_t tag_99[20]; //Transaction Personal Identification Number (PIN) Data
|
||||
uint8_t tag_9A[3]; //Transaction Date
|
||||
uint8_t tag_9B[2]; //Transaction Status Information
|
||||
uint8_t tag_9C[1]; //Transaction Type
|
||||
uint8_t tag_9D_len;
|
||||
uint8_t tag_9D[16]; //Directory Definition File
|
||||
|
||||
uint8_t tag_CD[3]; //Card Issuer Action Codes Paypass
|
||||
uint8_t tag_CE[3];
|
||||
uint8_t tag_CF[3];
|
||||
|
||||
uint8_t tag_D7[3]; //Application Control (PayPass)
|
||||
uint8_t tag_D8[2]; //Application Interchange Profile (PayPass)
|
||||
uint8_t tag_D9_len; //Application File Locator (PayPass)
|
||||
uint8_t tag_D9[16];
|
||||
uint8_t tag_DA[2]; //Static CVC3track1
|
||||
uint8_t tag_DB[2]; //Static CVC3track2
|
||||
uint8_t tag_DC[2]; //IVCVC3 CVC3track1
|
||||
uint8_t tag_DD[2]; //IVCVC3 CVC3track2
|
||||
|
||||
uint8_t tag_AF_len;
|
||||
uint8_t tag_AF[255]; //Proprietary Information
|
||||
|
||||
uint8_t tag_5F20_len;
|
||||
uint8_t tag_5F20[26]; //Cardholder Name
|
||||
uint8_t tag_5F24[3]; //Application Expiry Date
|
||||
uint8_t tag_5F25[3]; //Application Effective Date YYMMDD
|
||||
uint8_t tag_5F28[2]; //Issuer Country Code
|
||||
uint8_t tag_5F2A[2]; //Transaction Currency Code
|
||||
uint8_t tag_5F2D_len;
|
||||
uint8_t tag_5F2D[8]; //Language Preference
|
||||
uint8_t tag_5F30[2]; //Service Code
|
||||
uint8_t tag_5F34[1]; //Application Primary Account Number (PAN) Sequence Number
|
||||
uint8_t tag_5F36[2]; //ATC
|
||||
uint8_t tag_5F50_len;
|
||||
uint8_t tag_5F50[255]; //Issuer URL
|
||||
uint8_t tag_5F54_len;
|
||||
uint8_t tag_5F54[11]; //Bank Identifier Code (BIC)
|
||||
uint8_t tag_9F01[6]; //Acquirer Identifier
|
||||
uint8_t tag_9F02[6]; // Amount, Authorised (Numeric)
|
||||
uint8_t tag_9F03[6]; //Amount, Other (Numeric)
|
||||
uint8_t tag_9F04[4]; //Amount, Other (Binary)
|
||||
uint8_t tag_9F05_len;
|
||||
uint8_t tag_9F05[32]; //Application Discretionary Data
|
||||
uint8_t tag_9F06_len;
|
||||
uint8_t tag_9F06[16]; //AID terminal
|
||||
uint8_t tag_9F07[2]; //Application Usage Control
|
||||
uint8_t tag_9F08[2]; //Application Version Number
|
||||
uint8_t tag_9F09[2]; //Application Version Number
|
||||
//uint8_t tag_9F0A[2]
|
||||
uint8_t tag_9F0B_len;
|
||||
uint8_t tag_9F0B[45]; //Cardholder Name Extended
|
||||
uint8_t tag_9F0D[5]; //Issuer Action Code - Default
|
||||
uint8_t tag_9F0E[5]; //Issuer Action Code - Denial
|
||||
uint8_t tag_9F0F[5]; //Issuer Action Code - Online
|
||||
uint8_t tag_9F10_len; //Issuer Application Data
|
||||
uint8_t tag_9F10[32];
|
||||
uint8_t tag_9F11[1]; //Issuer Code Table Index
|
||||
uint8_t tag_9F12_len;
|
||||
uint8_t tag_9F12[255]; //Application Preferred Name
|
||||
uint8_t tag_9F13[2]; //Last Online Application Transaction Counter (ATC) Registerjk
|
||||
uint8_t tag_9F14[1]; //Lower Consecutive Offline Limit
|
||||
uint8_t tag_9F15[2]; //Merchant Category Code
|
||||
uint8_t tag_9F16[15]; //Merchant Identifier
|
||||
uint8_t tag_9F17[1]; //Personal Identification Number (PIN) Try Counter
|
||||
uint8_t tag_9F18[4]; //Issuer Script Identifier
|
||||
//uint8_t tag_9F19[]
|
||||
uint8_t tag_9F1A[2]; //Terminal Country Code
|
||||
uint8_t tag_9F1B[4]; //Terminal Floor Limit
|
||||
uint8_t tag_9F1C[8]; //Terminal Identification
|
||||
uint8_t tag_9F1D_len;
|
||||
uint8_t tag_9F1D[8]; //Terminal Risk Management Data
|
||||
uint8_t tag_9F1E[8]; //Interface Device (IFD) Serial Number
|
||||
uint8_t tag_9F1F_len;
|
||||
uint8_t tag_9F1F[255]; //Track 1 Discretionary Data
|
||||
uint8_t tag_9F20_len;
|
||||
uint8_t tag_9F20[255]; //Track 2 DD
|
||||
uint8_t tag_9F21[3]; //Transaction Time
|
||||
uint8_t tag_9F22[1]; //Certification Authority Public Key Index
|
||||
uint8_t tag_9F23[1]; //Upper Consecutive Offline Limit
|
||||
//uint8_t tag_9F24
|
||||
//uint8_t tag_9F25
|
||||
uint8_t tag_9F26[8]; //Application Cryptogram
|
||||
uint8_t tag_9F27[1]; //Cryptogram Information Data
|
||||
//uint8_t tag_9F28
|
||||
//uint8_t tag_9F29
|
||||
//uint8_t tag_9F2A
|
||||
//uint8_t tag_9F2B
|
||||
//uint8_t tag_9F2C
|
||||
uint8_t tag_9F2D_len;
|
||||
uint8_t tag_9F2D[255]; //Integrated Circuit Card (ICC) PIN Encipherment Public Key Certificate
|
||||
uint8_t tag_9F2E[3]; //Integrated Circuit Card (ICC) PIN Encipherment Public Key Exponent
|
||||
uint8_t tag_9F2F_len;
|
||||
uint8_t tag_9F2F[255]; //Integrated Circuit Card (ICC) PIN Encipherment Public Key Remainder
|
||||
//uint8_t tag_9F30
|
||||
//uint8_t tag_9F31
|
||||
uint8_t tag_9F32_len;
|
||||
uint8_t tag_9F32[3]; //Issuer Public Key Exponent
|
||||
uint8_t tag_9F33[3]; //Terminal Capabilities
|
||||
uint8_t tag_9F34[3]; //Cardholder Verification Method (CVM) Results
|
||||
uint8_t tag_9F35[1]; //Terminal Type
|
||||
uint8_t tag_9F36[2]; //Application Transaction Counter (ATC)
|
||||
uint8_t tag_9F37[8]; //Unpredictable Number
|
||||
uint8_t tag_9F38_len;
|
||||
uint8_t tag_9F38[255]; //PDOL
|
||||
uint8_t tag_9F39[1]; //Point-of-Service (POS) Entry Mode
|
||||
uint8_t tag_9F40[5]; //Additional Terminal Capabilities
|
||||
uint8_t tag_9F41[4]; //Transaction Sequence Counter
|
||||
uint8_t tag_9F42[2]; //Application Currency Code
|
||||
uint8_t tag_9F43[4]; //Application Reference Currency Exponent
|
||||
uint8_t tag_9F44[1]; //Application Currency Exponent
|
||||
uint8_t tag_9F45[2]; //Data Authentication Code
|
||||
uint8_t tag_9F46_len;
|
||||
uint8_t tag_9F46[255]; //ICC Public Key Certificate
|
||||
uint8_t tag_9F47_len;
|
||||
uint8_t tag_9F47[3]; //ICC Public Key Exponent
|
||||
uint8_t tag_9F48_len;
|
||||
uint8_t tag_9F48[255]; //ICC Public Key Remainder
|
||||
uint8_t tag_9F49_len;
|
||||
uint8_t tag_9F49[252];
|
||||
uint8_t tag_9F4A[1]; //SDA Tag list
|
||||
uint8_t tag_9F4B_len;
|
||||
uint8_t tag_9F4B[255]; //Signed Dynamic Application Data
|
||||
uint8_t tag_9F4C[8]; //ICC Dynamic Number
|
||||
uint8_t tag_9F4D[2]; //Log Entry
|
||||
uint8_t tag_9F4E[255]; //Merchant Name and Location
|
||||
//9F50-9F7F are payment system specific
|
||||
uint8_t tag_9F60[2]; //CVC3 track1
|
||||
uint8_t tag_9F61[2]; //CVC3 track2
|
||||
uint8_t tag_9F62[6]; //Track 1 Bit Map for CVC3 (PCVC3TRACK1)
|
||||
uint8_t tag_9F63[6]; //Track 1 Bit Map for UN and ATC (PUNATCTRACK1)
|
||||
uint8_t tag_9F64[1]; //Track 1 Number of ATC Digits (NATCTRACK1)
|
||||
uint8_t tag_9F65[2]; //rack 2 Bit Map for CVC3 (PCVC3TRACK2)
|
||||
uint8_t tag_9F66[4]; //Track 2 Bit Map for UN and ATC (PUNATCTRACK2), or VISA card type
|
||||
uint8_t tag_9F67[1]; //Track 2 Number of ATC Digits (NATCTRACK2)
|
||||
uint8_t tag_9F68_len;
|
||||
uint8_t tag_9F68[252]; //Mag Stripe CVM List
|
||||
uint8_t tag_9F69_len;
|
||||
uint8_t tag_9F69[255]; //Unpredictable Number Data Object List (UDOL)
|
||||
uint8_t tag_9F6A[8]; //Unpredictable Number (Numeric)
|
||||
uint8_t tag_9F6B_len;
|
||||
uint8_t tag_9F6B[19]; //track 2 data
|
||||
uint8_t tag_9F6C[2]; //Mag Stripe Application Version Number(Card)
|
||||
//template holders
|
||||
uint8_t tag_61_len;
|
||||
uint8_t tag_61[255]; //Application template
|
||||
uint8_t tag_6F_len;
|
||||
uint8_t tag_6F[255]; //6F template
|
||||
uint8_t tag_A5_len;
|
||||
uint8_t tag_A5[255]; //A5 template
|
||||
uint8_t tag_DFNAME_len;
|
||||
uint8_t tag_DFNAME[255]; //A5 template
|
||||
uint8_t tag_70_len;
|
||||
uint8_t tag_70[255]; //70 template
|
||||
uint8_t tag_77_len;
|
||||
uint8_t tag_77[255]; //77 template
|
||||
uint8_t tag_80_len;
|
||||
uint8_t tag_80[255]; //80 template
|
||||
uint8_t tag_91_len; //Issuer Authentication Data
|
||||
uint8_t tag_91[16];
|
||||
uint8_t tag_BF0C_len;
|
||||
uint8_t tag_BF0C[222]; //File Control Information (FCI) Issuer Discretionary Data
|
||||
uint8_t tag_DFName[16];
|
||||
uint8_t tag_DFName_len;
|
||||
} emvcard;
|
||||
|
||||
#endif //__EMVCARD_H
|
1114
armsrc/emvcmd.c
1114
armsrc/emvcmd.c
File diff suppressed because it is too large
Load diff
|
@ -1,33 +0,0 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// Peter Fillmore -2012
|
||||
// Based off MIFARECMD code
|
||||
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
|
||||
// at your option, any later version. See the LICENSE.txt file for the text of
|
||||
// the license.
|
||||
//-----------------------------------------------------------------------------
|
||||
// Routines to support EMV Transactions.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef __EMVCMD_H
|
||||
#define __EMVCMD_H
|
||||
|
||||
#include "proxmark3.h"
|
||||
#include "common.h"
|
||||
#include "apps.h"
|
||||
#include "util.h"
|
||||
#include "string.h"
|
||||
#include "iso14443crc.h"
|
||||
#include "iso14443a.h"
|
||||
#include "emvutil.h"
|
||||
#include "emvdataels.h"
|
||||
#include "emvcard.h"
|
||||
|
||||
#define VISA_DCVV 0
|
||||
#define VISA_CVN17 1
|
||||
#define VISA_FDDA 2
|
||||
#define VISA_EMV 3
|
||||
|
||||
#define MASTERCARD_MSR 0
|
||||
#define MASTERCARD_MCHIP 1
|
||||
|
||||
#endif
|
|
@ -1,104 +0,0 @@
|
|||
// ICEMAN 2017, this file looks similar to emvdataels.h headerfile.
|
||||
//Data elements for EMV transactions.
|
||||
|
||||
#include "emvdataels.h"
|
||||
|
||||
const uint8_t AID_VISA[] = {0xa0,0x00,0x00,0x00,0x03};
|
||||
const uint8_t AID_VISA_DB[] = {0xa0,0x00,0x00,0x00,0x03,0x10,0x10};
|
||||
const uint8_t AID_VISA_C[] = {0xa0,0x00,0x00,0x00,0x03,0x10,0x10,0x01};
|
||||
const uint8_t AID_VISA_D[] = {0xa0,0x00,0x00,0x00,0x03,0x10,0x10,0x02};
|
||||
const uint8_t AID_VISA_E[] = {0xa0,0x00,0x00,0x00,0x03,0x20,0x10};
|
||||
const uint8_t AID_VISA_I[] = {0xa0,0x00,0x00,0x00,0x03,0x30,0x10};
|
||||
const uint8_t AID_VISA_P[] = {0xa0,0x00,0x00,0x00,0x03,0x80,0x10};
|
||||
const uint8_t AID_VISA_ATM[]= {0xa0,0x00,0x00,0x00,0x03,0x99,0x99,0x10};
|
||||
const uint8_t AID_MASTERCARD[]= {0xa0,0x00,0x00,0x00,0x04,0x10,0x10};
|
||||
const uint8_t AID_MAESTRO[] = {0xa0,0x00,0x00,0x00,0x04,0x30,0x60};
|
||||
const uint8_t AID_MAESTRO_UK[]= {0xa0,0x00,0x00,0x00,0x05,0x00,0x01};
|
||||
const uint8_t AID_MAESTRO_TEST[]={0xb0,0x12,0x34,0x56,0x78};
|
||||
const uint8_t AID_SELF_SERVICE[]={0xa0,0x00,0x00,0x00,0x24,0x01};
|
||||
const uint8_t AID_AMEX[] = {0xa0,0x00,0x00,0x00,0x25};
|
||||
const uint8_t AID_EXPRESSPAY[]= {0xa0,0x00,0x00,0x00,0x25,0x01,0x07,0x01};
|
||||
const uint8_t AID_LINK[] = {0xa0,0x00,0x00,0x00,0x29,0x10,0x10};
|
||||
const uint8_t AID_ALIAS[] = {0xa0,0x00,0x00,0x00,0x29,0x10,0x10};
|
||||
|
||||
//Master data file for PSE
|
||||
//const uint8_t DF_PSE[] = {0x32, 0x50, 0x41, 0x59, 0x2E, 0x53, 0x59, 0x53, 0x2E, 0x44, 0x44, 0x46, 0x30, 0x31};
|
||||
const uint8_t DF_PSE[] = {0x32, 0x50, 0x41, 0x59, 0x2E, 0x53, 0x59, 0x53, 0x2E, 0x44, 0x44, 0x46, 0x30, 0x31};
|
||||
|
||||
//TAGS
|
||||
|
||||
//SW1 return values
|
||||
const uint8_t SW1_RESPONSE_BYTES[] = {0x61};
|
||||
const uint8_t SW1_WRONG_LENGTH[] = {0x6c};
|
||||
const uint8_t SW12_OK[] = {0x90,0x00};
|
||||
const uint8_t SW12_NOT_SUPPORTED[] = {0x6a,0x81};
|
||||
const uint8_t SW12_NOT_FOUND[] = {0x6a,0x82};
|
||||
const uint8_t SW12_COND_NOT_SAT[] = {0x69,0x83};
|
||||
const uint8_t PIN_BLOCKED[] = {0x69,0x84};
|
||||
const uint8_t PIN_BLOCKED2[] = {0x69,0x84};
|
||||
const uint8_t PIN_WRONG[] = {0x63};
|
||||
|
||||
const tagdescription_t EMV_TAG_LIST[62] = {
|
||||
{"\x4f\x00","Application Identifier (AID)"},
|
||||
{"\x50\x00","Application Label"},
|
||||
{"\x57\x00","Track 2 Equivalent Data"},
|
||||
{"\x5a\x00","Application Primary Account Number (PAN)"},
|
||||
{"\x6f\x00","File Control Information (FCI) Template"},
|
||||
{"\x70\x00","Record Template"},
|
||||
{"\x77\x00","response message template format 2"},
|
||||
{"\x80\x00","response message template format 1"},
|
||||
{"\x82\x00","application interchange profile"},
|
||||
{"\x83\x00","command template"},
|
||||
{"\x84\x00","df name"},
|
||||
{"\x86\x00","issuer script command"},
|
||||
{"\x87\x00","application priority indicator"},
|
||||
{"\x88\x00","short file identifier"},
|
||||
{"\x8a\x00","authorisation response code"},
|
||||
{"\x8c\x00","card risk management data object list 1 (cdol1)"},
|
||||
{"\x8d\x00","card risk management data object list 2 (cdol2)"},
|
||||
{"\x8e\x00","cardholder verification method (cvm) list"},
|
||||
{"\x8f\x00","certification authority public key index"},
|
||||
{"\x93\x00","signed static application data"},
|
||||
{"\x94\x00","application file locator"},
|
||||
{"\x95\x00","terminal verification results"},
|
||||
{"\x97\x00","transaction certificate data object list (tdol)",},
|
||||
{"\x9c\x00","transaction type"},
|
||||
{"\x9d\x00","directory definition file"},
|
||||
{"\xa5\x00","proprietary information"},
|
||||
{"\x5f\x20","cardholder name"},
|
||||
{"\x5f\x24","application expiration date yymmdd"},
|
||||
{"\x5f\x25","application effective date yymmdd"},
|
||||
{"\x5f\x28","issuer country code"},
|
||||
{"\x5f\x2a","transaction currency code"},
|
||||
{"\x5f\x2d","language preference"},
|
||||
{"\x5f\x30","service code"},
|
||||
{"\x5f\x34","application primary account number (pan) sequence number"},
|
||||
{"\x5f\x50","issuer url"},
|
||||
{"\x92\x00","issuer public key remainder"},
|
||||
{"\x9a\x00","transaction date"},
|
||||
{"\x9f\x02","amount, authorised (numeric)"},
|
||||
{"\x9f\x03","amount, other (numeric)"},
|
||||
{"\x9f\x04","amount, other (binary)"},
|
||||
{"\x9f\x05","application discretionary data"},
|
||||
{"\x9f\x07","application usage control"},
|
||||
{"\x9f\x08","application version number"},
|
||||
{"\x9f\x0d","issuer action code - default"},
|
||||
{"\x9f\x0e","issuer action code - denial"},
|
||||
{"\x9f\x0f","issuer action code - online"},
|
||||
{"\x9f\x11","issuer code table index"},
|
||||
{"\x9f\x12","application preferred name"},
|
||||
{"\x9f\x1a","terminal country code"},
|
||||
{"\x9f\x1f","track 1 discretionary data"},
|
||||
{"\x9f\x20","track 2 discretionary data"},
|
||||
{"\x9f\x26","application cryptogram"},
|
||||
{"\x9f\x32","issuer public key exponent"},
|
||||
{"\x9f\x36","application transaction counter"},
|
||||
{"\x9f\x37","unpredictable number"},
|
||||
{"\x9f\x38","processing options data object list (pdol)"},
|
||||
{"\x9f\x42","application currency code"},
|
||||
{"\x9f\x44","application currency exponent"},
|
||||
{"\x9f\x4a","static data authentication tag list"},
|
||||
{"\x9f\x4d","log entry"},
|
||||
{"\x9f\x66","card production life cycle"},
|
||||
{"\xbf\x0c","file control information (fci) issuer discretionary data"}
|
||||
};
|
|
@ -1,59 +0,0 @@
|
|||
//Data elements for EMV transactions.
|
||||
#ifndef __EMVDATAELS_H
|
||||
#define __EMVDATAELS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
//Known AIDs
|
||||
typedef struct {
|
||||
uint8_t tag[2];
|
||||
char description[255];
|
||||
} __attribute__((__packed__)) tagdescription_t;
|
||||
|
||||
//Known AIDs
|
||||
extern const uint8_t AID_VISA[5];
|
||||
extern const uint8_t AID_VISA_DB[7];
|
||||
extern const uint8_t AID_VISA_C[8];
|
||||
extern const uint8_t AID_VISA_D[8];
|
||||
extern const uint8_t AID_VISA_E[7];
|
||||
extern const uint8_t AID_VISA_I[7];
|
||||
extern const uint8_t AID_VISA_P[7];
|
||||
extern const uint8_t AID_VISA_ATM[8];
|
||||
extern const uint8_t AID_MASTERCARD[7];
|
||||
extern const uint8_t AID_MAESTRO[7];
|
||||
extern const uint8_t AID_MAESTRO_UK[7];
|
||||
extern const uint8_t AID_MAESTRO_TEST[5];
|
||||
extern const uint8_t AID_SELF_SERVICE[6];
|
||||
extern const uint8_t AID_AMEX[5];
|
||||
extern const uint8_t AID_EXPRESSPAY[8];
|
||||
extern const uint8_t AID_LINK[7];
|
||||
extern const uint8_t AID_ALIAS[7];
|
||||
|
||||
//Master data file for PSE
|
||||
extern const uint8_t DF_PSE[14];
|
||||
extern const uint8_t SW1_RESPONSE_BYTES[1];
|
||||
extern const uint8_t SW1_WRONG_LENGTH[1];
|
||||
extern const uint8_t SW12_OK[2];
|
||||
extern const uint8_t SW12_NOT_SUPPORTED[2];
|
||||
extern const uint8_t SW12_NOT_FOUND[2];
|
||||
extern const uint8_t SW12_COND_NOT_SAT[2];
|
||||
extern const uint8_t PIN_BLOCKED[2];
|
||||
extern const uint8_t PIN_BLOCKED2[2];
|
||||
extern const uint8_t PIN_WRONG[1];
|
||||
|
||||
extern const tagdescription_t EMV_TAG_LIST[62]; //SW1 return values
|
||||
|
||||
//AIP bitmasks details
|
||||
#define AIP_CHIP_SUPPORTED 0x80
|
||||
#define AIP_MSR_SUPPORTED 0x40
|
||||
|
||||
#define AIP_SDA_SUPPORTED 0x40
|
||||
#define AIP_DDA_SUPPORTED 0x20
|
||||
#define AIP_CARDHOLDER_VERIFICATION 0x10
|
||||
#define AIP_TERMINAL_RISK 0x08
|
||||
#define AIP_ISSUER_AUTH 0x04
|
||||
#define AIP_CDA_SUPPORTED 0x01
|
||||
|
||||
//human readable error messages
|
||||
//file structure, read from AFL
|
||||
#endif //__EMVDATAELS_H
|
1871
armsrc/emvutil.c
1871
armsrc/emvutil.c
File diff suppressed because it is too large
Load diff
|
@ -1,76 +0,0 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Peter Fillmore 2014
|
||||
// code derived off merloks mifare code
|
||||
//
|
||||
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
|
||||
// at your option, any later version. See the LICENSE.txt file for the text of
|
||||
// the license.
|
||||
//-----------------------------------------------------------------------------
|
||||
// code for work with EMV cards.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef __EMVUTIL_H
|
||||
#define __EMVUTIL_H
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
#include "proxmark3.h"
|
||||
#include "apps.h"
|
||||
#include "tlv.h"
|
||||
#include "util.h"
|
||||
#include "string.h"
|
||||
#include "BigBuf.h"
|
||||
#include "iso14443crc.h"
|
||||
#include "iso14443a.h"
|
||||
#include "emvdataels.h" //EMV data elements
|
||||
#include "emvtags.h" //EMV card structure
|
||||
|
||||
// mifare 4bit card answers
|
||||
// reader voltage field detector
|
||||
#define EMV_MINFIELDV 4000
|
||||
|
||||
//EMV emulator states need to update
|
||||
#define EMVEMUL_NOFIELD 0
|
||||
#define EMVEMUL_IDLE 1
|
||||
#define EMVEMUL_SELECT1 2
|
||||
#define EMVEMUL_SELECT2 3
|
||||
#define EMVEMUL_SELECT3 4
|
||||
#define EMVEMUL_AUTH1 5
|
||||
#define EMVEMUL_AUTH2 6
|
||||
#define EMVEMUL_WORK 7
|
||||
#define EMVEMUL_HALTED 8
|
||||
#define EMVEMUL_ACK 9
|
||||
|
||||
//functions
|
||||
//int emv_sendapdu( uint8_t cla, uint8_t ins, uint8_t p1, uint8_t p2, uint8_t lc, uint8_t* data, uint8_t le);
|
||||
int emv_select(uint8_t* AID, uint8_t AID_len, void* data);
|
||||
int emv_selectPPSE();
|
||||
int emv_readrecord(uint8_t recordnumber, uint8_t sfi, void* data);
|
||||
int emv_getprocessingoptions(uint8_t* pdol, uint8_t pdol_len, void* data);
|
||||
int emv_computecryptogram(uint8_t* UDOL, uint8_t UDOL_len, void *data);
|
||||
//return 8 8byte ICC random number.
|
||||
int emv_getchallenge(void *data);
|
||||
int emv_loopback(uint8_t* transData , uint8_t transData_len, void *data);
|
||||
int emv_generateAC(uint8_t refcontrolparam, uint8_t* cdolinput, uint8_t cdolinputlen, void* data);
|
||||
int emv_decodeAFL(uint8_t* AFL, uint8_t AFLlen);
|
||||
int emv_decodeAIP(uint8_t* AIP);
|
||||
int emv_decodeCVM(uint8_t* CVM, uint8_t CVMlen);
|
||||
|
||||
//emulator
|
||||
void EMVsim();
|
||||
|
||||
//utils
|
||||
int emv_printtag(uint8_t* selected_tag, emvcard* inputcard, uint8_t* outputstring, uint8_t* outputlen);
|
||||
int emv_decode_field(uint8_t* inputfield,uint16_t inputlength, emvcard *result);
|
||||
int emv_emvtags_decode_tag(tlvtag* inputtag, emvcard* currentcard);
|
||||
//look up a tag in the current structure
|
||||
int emv_lookuptag(uint8_t* tag, emvcard* currentcard, uint8_t* outputval, uint8_t* outputvallen);
|
||||
//set a tag from external impurt
|
||||
int emv_settag(uint32_t tag, uint8_t *datain, emvcard *currentcard) ;
|
||||
void dumpCard(emvcard* currentcard);
|
||||
|
||||
//generate a valid PDOL list from the returned card value, used in get processing options
|
||||
int emv_generateDOL(uint8_t* DOL, uint8_t DOLlen,emvcard* currentcard, uint8_t* DOLoutput, uint8_t* DOLoutputlen);
|
||||
|
||||
int emv_generatetemplate(uint8_t* templateval,emvcard* currentcard, uint8_t* returnedval, uint8_t* returnedlen, uint8_t numtags, ...);
|
||||
#endif
|
Loading…
Reference in a new issue