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