]> git.zerfleddert.de Git - proxmark3-svn/blame - armsrc/emvcard.h
FIX: mental note to self, don't forget to adjust messages to new logic
[proxmark3-svn] / armsrc / emvcard.h
CommitLineData
9206d3b0 1//-----------------------------------------------------------------------------
2// Peter Fillmore 2014
3// code derived off merloks mifare code
4//
5//
6// This code is licensed to you under the terms of the GNU GPL, version 2 or,
7// at your option, any later version. See the LICENSE.txt file for the text of
8// the license.
9//-----------------------------------------------------------------------------
10// structure to hold EMV card and terminal parameters
11//-----------------------------------------------------------------------------
12#ifndef __EMVCARD_H
13#define __EMVCARD_H
14
15//structure to hold received/set tag values
16//variable data inputs have length specifiers
17typedef struct {
18 //ISO14443-A card stuff
19 uint8_t ATQA[2]; //Answer to Request
20 uint8_t UID_len;
21 uint8_t UID[10];
22 uint8_t SAK;
23 uint8_t ATS_len; //Answer to select
24 uint8_t ATS[256];
25 //ATS
26 uint8_t TL;
27 uint8_t T0;
28 uint8_t TA1;
29 uint8_t TB1;
30 uint8_t TC1;
31 uint8_t* historicalbytes;
32 //PPS response
33 uint8_t PPSS;
34 //SFI 2 record 1
35 uint8_t tag_4F_len; //length of AID
36 uint8_t tag_4F[16]; //Application Identifier (AID)
37 uint8_t tag_50_len; //length of application label
38 uint8_t tag_50[16]; //Application Label
39 uint8_t tag_56_len; //track1 length
40 uint8_t tag_56[76]; //Track 1 Data
41 uint8_t tag_57_len; //track2 equiv len
42 uint8_t tag_57[19]; //Track 2 Equivalent Data
43 uint8_t tag_5A_len; //PAN length
44 uint8_t tag_5A[10]; //Application Primary Account Number (PAN)
45 //uint8_t tag_6F[]; //File Control Information (FCI) Template
46 //uint8_t tag_70[255]; //Record Template
47 //uint8_t tag_77[]; //Response Message Template Format 2
48 //uint8_t tag_80[]; //Response Message Template Format 1
49 uint8_t tag_82[2]; //Application Interchange Profile AIP
50 //uint8_t tag_83[]; //Command Template
51 uint8_t tag_84_len;
52 uint8_t tag_84[16]; //DF Name
53 uint8_t tag_86_len;
54 uint8_t tag_86[261]; //Issuer Script Command
55 uint8_t tag_87[1]; //Application Priority Indicator
56 uint8_t tag_88[1]; //Short File Identifier
57 uint8_t tag_8A[2]; //Authorisation Response Code
58 uint8_t tag_8C_len;
59 uint8_t tag_8C[252]; //CDOL1
60 uint8_t tag_8D_len;
61 uint8_t tag_8D[252]; //CDOL2
62 uint8_t tag_8E_len;
63 uint8_t tag_8E[252]; //Cardholder Verification Method (CVM) List
64 uint8_t tag_8F[1]; //Certification Authority Public Key Index
65 uint8_t tag_90_len;
66 uint8_t tag_90[255]; //ssuer Public Key Certificate
67 uint8_t tag_92_len;
68 uint8_t tag_92[255]; //Issuer Public Key Remainder
69 uint8_t tag_93_len;
70 uint8_t tag_93[255]; //Signed Static Application Data
71 uint8_t tag_94_len;
72 uint8_t tag_94[252]; //Application File Locator AFL
73 uint8_t tag_95[5]; //Terminal Verification Results
74 uint8_t tag_97_len;
75 uint8_t tag_97[252]; //Transaction Certificate Data Object List (TDOL)
76 uint8_t tag_98[20]; //Transaction Certificate (TC) Hash Value
77 //assume 20 bytes, change after testing
78 uint8_t tag_99_len;
79 uint8_t tag_99[20]; //Transaction Personal Identification Number (PIN) Data
80 uint8_t tag_9A[3]; //Transaction Date
81 uint8_t tag_9B[2]; //Transaction Status Information
82 uint8_t tag_9C[1]; //Transaction Type
83 uint8_t tag_9D_len;
84 uint8_t tag_9D[16]; //Directory Definition File
85
86 uint8_t tag_CD[3]; //Card Issuer Action Codes Paypass
87 uint8_t tag_CE[3];
88 uint8_t tag_CF[3];
89
90 uint8_t tag_D7[3]; //Application Control (PayPass)
91 uint8_t tag_D8[2]; //Application Interchange Profile (PayPass)
92 uint8_t tag_D9_len; //Application File Locator (PayPass)
93 uint8_t tag_D9[16];
94 uint8_t tag_DA[2]; //Static CVC3track1
95 uint8_t tag_DB[2]; //Static CVC3track2
96 uint8_t tag_DC[2]; //IVCVC3 CVC3track1
97 uint8_t tag_DD[2]; //IVCVC3 CVC3track2
98
99 uint8_t tag_AF_len;
100 uint8_t tag_AF[255]; //Proprietary Information
101
102 uint8_t tag_5F20_len;
103 uint8_t tag_5F20[26]; //Cardholder Name
104 uint8_t tag_5F24[3]; //Application Expiry Date
105 uint8_t tag_5F25[3]; //Application Effective Date YYMMDD
106 uint8_t tag_5F28[2]; //Issuer Country Code
107 uint8_t tag_5F2A[2]; //Transaction Currency Code
108 uint8_t tag_5F2D_len;
109 uint8_t tag_5F2D[8]; //Language Preference
110 uint8_t tag_5F30[2]; //Service Code
111 uint8_t tag_5F34[1]; //Application Primary Account Number (PAN) Sequence Number
112 uint8_t tag_5F36[2]; //ATC
113 uint8_t tag_5F50_len;
114 uint8_t tag_5F50[255]; //Issuer URL
115 uint8_t tag_5F54_len;
116 uint8_t tag_5F54[11]; //Bank Identifier Code (BIC)
117 uint8_t tag_9F01[6]; //Acquirer Identifier
118 uint8_t tag_9F02[6]; // Amount, Authorised (Numeric)
119 uint8_t tag_9F03[6]; //Amount, Other (Numeric)
120 uint8_t tag_9F04[4]; //Amount, Other (Binary)
121 uint8_t tag_9F05_len;
122 uint8_t tag_9F05[32]; //Application Discretionary Data
123 uint8_t tag_9F06_len;
124 uint8_t tag_9F06[16]; //AID terminal
125 uint8_t tag_9F07[2]; //Application Usage Control
126 uint8_t tag_9F08[2]; //Application Version Number
127 uint8_t tag_9F09[2]; //Application Version Number
128 //uint8_t tag_9F0A[2]
129 uint8_t tag_9F0B_len;
130 uint8_t tag_9F0B[45]; //Cardholder Name Extended
131 uint8_t tag_9F0D[5]; //Issuer Action Code - Default
132 uint8_t tag_9F0E[5]; //Issuer Action Code - Denial
133 uint8_t tag_9F0F[5]; //Issuer Action Code - Online
134 uint8_t tag_9F10_len; //Issuer Application Data
135 uint8_t tag_9F10[32];
136 uint8_t tag_9F11[1]; //Issuer Code Table Index
137 uint8_t tag_9F12_len;
138 uint8_t tag_9F12[255]; //Application Preferred Name
139 uint8_t tag_9F13[2]; //Last Online Application Transaction Counter (ATC) Registerjk
140 uint8_t tag_9F14[1]; //Lower Consecutive Offline Limit
141 uint8_t tag_9F15[2]; //Merchant Category Code
142 uint8_t tag_9F16[15]; //Merchant Identifier
143 uint8_t tag_9F17[1]; //Personal Identification Number (PIN) Try Counter
144 uint8_t tag_9F18[4]; //Issuer Script Identifier
145 //uint8_t tag_9F19[]
146 uint8_t tag_9F1A[2]; //Terminal Country Code
147 uint8_t tag_9F1B[4]; //Terminal Floor Limit
148 uint8_t tag_9F1C[8]; //Terminal Identification
149 uint8_t tag_9F1D_len;
150 uint8_t tag_9F1D[8]; //Terminal Risk Management Data
151 uint8_t tag_9F1E[8]; //Interface Device (IFD) Serial Number
152 uint8_t tag_9F1F_len;
153 uint8_t tag_9F1F[255]; //Track 1 Discretionary Data
154 uint8_t tag_9F20_len;
155 uint8_t tag_9F20[255]; //Track 2 DD
156 uint8_t tag_9F21[3]; //Transaction Time
157 uint8_t tag_9F22[1]; //Certification Authority Public Key Index
158 uint8_t tag_9F23[1]; //Upper Consecutive Offline Limit
159 //uint8_t tag_9F24
160 //uint8_t tag_9F25
161 uint8_t tag_9F26[8]; //Application Cryptogram
162 uint8_t tag_9F27[1]; //Cryptogram Information Data
163 //uint8_t tag_9F28
164 //uint8_t tag_9F29
165 //uint8_t tag_9F2A
166 //uint8_t tag_9F2B
167 //uint8_t tag_9F2C
168 uint8_t tag_9F2D_len;
169 uint8_t tag_9F2D[255]; //Integrated Circuit Card (ICC) PIN Encipherment Public Key Certificate
170 uint8_t tag_9F2E[3]; //Integrated Circuit Card (ICC) PIN Encipherment Public Key Exponent
171 uint8_t tag_9F2F_len;
172 uint8_t tag_9F2F[255]; //Integrated Circuit Card (ICC) PIN Encipherment Public Key Remainder
173 //uint8_t tag_9F30
174 //uint8_t tag_9F31
175 uint8_t tag_9F32_len;
176 uint8_t tag_9F32[3]; //Issuer Public Key Exponent
177 uint8_t tag_9F33[3]; //Terminal Capabilities
178 uint8_t tag_9F34[3]; //Cardholder Verification Method (CVM) Results
179 uint8_t tag_9F35[1]; //Terminal Type
180 uint8_t tag_9F36[2]; //Application Transaction Counter (ATC)
181 uint8_t tag_9F37[4]; //Unpredictable Number
182 uint8_t tag_9F38_len;
183 uint8_t tag_9F38[255]; //PDOL
184 uint8_t tag_9F39[1]; //Point-of-Service (POS) Entry Mode
185 uint8_t tag_9F40[5]; //Additional Terminal Capabilities
186 uint8_t tag_9F41[4]; //Transaction Sequence Counter
187 uint8_t tag_9F42[2]; //Application Currency Code
188 uint8_t tag_9F43[4]; //Application Reference Currency Exponent
189 uint8_t tag_9F44[1]; //Application Currency Exponent
190 uint8_t tag_9F45[2]; //Data Authentication Code
191 uint8_t tag_9F46_len;
192 uint8_t tag_9F46[255]; //ICC Public Key Certificate
193 uint8_t tag_9F47_len;
194 uint8_t tag_9F47[3]; //ICC Public Key Exponent
195 uint8_t tag_9F48_len;
196 uint8_t tag_9F48[255]; //ICC Public Key Remainder
197 uint8_t tag_9F49_len;
198 uint8_t tag_9F49[252];
199 uint8_t tag_9F4A[1]; //SDA Tag list
200 uint8_t tag_9F4B_len;
201 uint8_t tag_9F4B[255]; //Signed Dynamic Application Data
202 uint8_t tag_9F4C[8]; //ICC Dynamic Number
203 uint8_t tag_9F4D[2]; //Log Entry
204 uint8_t tag_9F4E[255]; //Merchant Name and Location
205 //9F50-9F7F are payment system specific
206 uint8_t tag_9F60[2]; //CVC3 track1
207 uint8_t tag_9F61[2]; //CVC3 track2
208 uint8_t tag_9F62[6]; //Track 1 Bit Map for CVC3 (PCVC3TRACK1)
209 uint8_t tag_9F63[6]; //Track 1 Bit Map for UN and ATC (PUNATCTRACK1)
210 uint8_t tag_9F64[1]; //Track 1 Number of ATC Digits (NATCTRACK1)
211 uint8_t tag_9F65[2]; //rack 2 Bit Map for CVC3 (PCVC3TRACK2)
212 uint8_t tag_9F66[2]; //Track 2 Bit Map for UN and ATC (PUNATCTRACK2), or VISA card type
213 uint8_t tag_9F67[1]; //Track 2 Number of ATC Digits (NATCTRACK2)
214 uint8_t tag_9F68_len;
215 uint8_t tag_9F68[252]; //Mag Stripe CVM List
216 uint8_t tag_9F69_len;
217 uint8_t tag_9F69[255]; //Unpredictable Number Data Object List (UDOL)
218 uint8_t tag_9F6A[8]; //Unpredictable Number (Numeric)
219 uint8_t tag_9F6B_len;
220 uint8_t tag_9F6B[19]; //track 2 data
221 uint8_t tag_9F6C[2]; //Mag Stripe Application Version Number(Card)
222 //template holders
223 uint8_t tag_61_len;
224 uint8_t tag_61[255]; //Application template
225 uint8_t tag_6F_len;
226 uint8_t tag_6F[255]; //6F template
227 uint8_t tag_A5_len;
228 uint8_t tag_A5[255]; //A5 template
229 uint8_t tag_DFNAME_len;
230 uint8_t tag_DFNAME[255]; //A5 template
231 uint8_t tag_70_len;
232 uint8_t tag_70[255]; //70 template
233 uint8_t tag_77_len;
234 uint8_t tag_77[255]; //77 template
235 uint8_t tag_80_len;
236 uint8_t tag_80[255]; //80 template
237 uint8_t tag_91_len; //Issuer Authentication Data
238 uint8_t tag_91[16];
239 uint8_t tag_BF0C_len;
240 uint8_t tag_BF0C[222]; //File Control Information (FCI) Issuer Discretionary Data
241 uint8_t tag_DFName[16];
242 uint8_t tag_DFName_len;
243}emvtags;
244
245#endif //__EMVCARD_H
Impressum, Datenschutz