]> git.zerfleddert.de Git - proxmark3-svn/blob - armsrc/emvutil.c
textual change @4m4rOk
[proxmark3-svn] / armsrc / emvutil.c
1 //-----------------------------------------------------------------------------
2 // Peter Fillmore 2015
3 // Many authors, whom made it possible
4 //
5 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
6 // at your option, any later version. See the LICENSE.txt file for the text of
7 // the license.
8 //-----------------------------------------------------------------------------
9 // various EMV related functions.
10 //-----------------------------------------------------------------------------
11 #include "emvutil.h"
12
13 #define DUMP(varname) Dbprintf("%s=", #varname);
14
15 //uint8_t PCB = 0x00; //track Protocol Control Byte externally
16
17 //util functions
18 //print detected tag name over the serial link
19 int emv_printtag(uint8_t* selected_tag, emvcard* inputcard, uint8_t* outputstring, uint8_t* outputlen)
20 {
21 //search tag list and print the match
22 //get the value of the tag
23 uint8_t tagvalue[255];
24 uint8_t tagvaluelen;
25 emv_lookuptag(selected_tag, inputcard, tagvalue, &tagvaluelen);
26 //loop through selected tag, print the value found
27 for(int i=0; i<(sizeof(EMV_TAG_LIST)/sizeof(EMV_TAG_LIST[0])); i++){
28 if(!memcmp(selected_tag, EMV_TAG_LIST[i].tag, 2)){
29 memcpy(outputstring, EMV_TAG_LIST[i].description, strlen(EMV_TAG_LIST[i].description));
30 memcpy(outputstring+(strlen(EMV_TAG_LIST[i].description)), "=", 1);
31 memcpy(outputstring+(strlen(EMV_TAG_LIST[i].description))+1, tagvalue, tagvaluelen);
32 *outputlen = strlen(EMV_TAG_LIST[i].description) + 1 + tagvaluelen;
33 break;
34 }
35 }
36 return 0;
37 }
38
39 //returns the value of the emv tag in the supplied emvcard structure
40 int emv_lookuptag(uint8_t* tag, emvcard *currentcard, uint8_t* outputval, uint8_t* outputvallen)
41 {
42 //loop through tag and return the appropriate value
43 uint8_t returnedtag[255];
44 uint8_t returnedlength = 0;
45 memset(returnedtag, 0x00, sizeof(returnedtag));
46 if(!memcmp(tag, "\x4F\x00",2)){
47 memcpy(&returnedtag, currentcard->tag_4F, currentcard->tag_4F_len);
48 returnedlength = currentcard->tag_4F_len; goto exitfunction;}
49 else if(!memcmp(tag, "\x50\x00",2)){
50 memcpy(&returnedtag, currentcard->tag_50, currentcard->tag_50_len);
51 returnedlength = currentcard->tag_50_len; goto exitfunction;}
52 else if(!memcmp(tag, "\x56\x00",2)){
53 memcpy(&returnedtag, currentcard->tag_56, currentcard->tag_56_len);
54 returnedlength = currentcard->tag_56_len; goto exitfunction;}
55 else if(!memcmp(tag, "\x57\x00",2)){
56 memcpy(&returnedtag, currentcard->tag_57, currentcard->tag_57_len);
57 returnedlength = currentcard->tag_57_len; goto exitfunction;}
58 else if(!memcmp(tag, "\x5A\x00",2)){
59 memcpy(&returnedtag, currentcard->tag_5A, currentcard->tag_5A_len);
60 returnedlength = currentcard->tag_5A_len; goto exitfunction;}
61 else if(!memcmp(tag, "\x82\x00",2)){
62 memcpy(&returnedtag, currentcard->tag_82, sizeof(currentcard->tag_82));
63 returnedlength = sizeof(currentcard->tag_82);goto exitfunction;}
64 else if(!memcmp(tag, "\x84\x00",2)){
65 memcpy(&returnedtag, currentcard->tag_84, currentcard->tag_84_len);
66 returnedlength = currentcard->tag_84_len; goto exitfunction;}
67 else if(!memcmp(tag, "\x86\x00",2)){
68 memcpy(&returnedtag, currentcard->tag_86, currentcard->tag_86_len);
69 returnedlength = currentcard->tag_86_len; goto exitfunction;}
70 else if(!memcmp(tag, "\x87\x00",2)){
71 memcpy(&returnedtag, currentcard->tag_87, sizeof(currentcard->tag_87));
72 returnedlength = sizeof(currentcard->tag_87);goto exitfunction;}
73 else if(!memcmp(tag, "\x88\x00",2)){
74 memcpy(&returnedtag, currentcard->tag_88, currentcard->tag_50_len);
75 returnedlength = sizeof(currentcard->tag_88); goto exitfunction;}
76 else if(!memcmp(tag, "\x8A\x00",2)){
77 memcpy(&returnedtag, currentcard->tag_8A, sizeof(currentcard->tag_8A));
78 returnedlength = sizeof(currentcard->tag_8A);goto exitfunction;}
79 else if(!memcmp(tag, "\x8C\x00",2)){
80 memcpy(&returnedtag, currentcard->tag_8C, currentcard->tag_8C_len);
81 returnedlength = currentcard->tag_8C_len; goto exitfunction;}
82 else if(!memcmp(tag, "\x8D\x00",2)){
83 memcpy(&returnedtag, currentcard->tag_8D, currentcard->tag_8D_len);
84 returnedlength = currentcard->tag_8D_len; goto exitfunction;}
85 else if(!memcmp(tag, "\x8E\x00",2)){
86 memcpy(&returnedtag, currentcard->tag_8E, currentcard->tag_8E_len);
87 returnedlength = currentcard->tag_8E_len; goto exitfunction;}
88 else if(!memcmp(tag, "\x8F\x00",2)){
89 memcpy(&returnedtag, currentcard->tag_8F, sizeof(currentcard->tag_8F));
90 returnedlength = sizeof(currentcard->tag_8F);goto exitfunction;}
91 else if(!memcmp(tag, "\x90\x00",2)){
92 memcpy(&returnedtag, currentcard->tag_90, currentcard->tag_90_len);
93 returnedlength = currentcard->tag_90_len; goto exitfunction;}
94 else if(!memcmp(tag, "\x92\x00",2)){
95 memcpy(&returnedtag, currentcard->tag_92, currentcard->tag_92_len);
96 returnedlength = currentcard->tag_92_len; goto exitfunction;}
97 else if(!memcmp(tag, "\x93\x00",2)){
98 memcpy(&returnedtag, currentcard->tag_93, currentcard->tag_93_len);
99 returnedlength = currentcard->tag_93_len; goto exitfunction;}
100 else if(!memcmp(tag, "\x94\x00",2)){
101 memcpy(&returnedtag, currentcard->tag_94, currentcard->tag_94_len);
102 returnedlength = currentcard->tag_94_len; goto exitfunction;}
103 else if(!memcmp(tag, "\x95\x00",2)){
104 memcpy(&returnedtag, currentcard->tag_95, sizeof(currentcard->tag_95));
105 returnedlength = sizeof(currentcard->tag_95);goto exitfunction;}
106 else if(!memcmp(tag, "\x97\x00",2)){
107 memcpy(&returnedtag, currentcard->tag_97, currentcard->tag_97_len);
108 returnedlength = currentcard->tag_97_len; goto exitfunction;}
109 else if(!memcmp(tag, "\x98\x00",2)){
110 memcpy(&returnedtag, currentcard->tag_98, sizeof(currentcard->tag_98));
111 returnedlength = sizeof(currentcard->tag_98);goto exitfunction;}
112 else if(!memcmp(tag, "\x99\x00",2)){
113 memcpy(&returnedtag, currentcard->tag_99, currentcard->tag_99_len);
114 returnedlength = currentcard->tag_99_len; goto exitfunction;}
115 else if(!memcmp(tag, "\x9A\x00",2)){
116 memcpy(&returnedtag, currentcard->tag_9A, sizeof(currentcard->tag_9A));
117 returnedlength = sizeof(currentcard->tag_9A);goto exitfunction;}
118 else if(!memcmp(tag, "\x9B\x00",2)){
119 memcpy(&returnedtag, currentcard->tag_9B, sizeof(currentcard->tag_9B));
120 returnedlength = sizeof(currentcard->tag_9B);goto exitfunction;}
121 else if(!memcmp(tag, "\x9C\x00",2)){
122 memcpy(&returnedtag, currentcard->tag_9C, sizeof(currentcard->tag_9C));
123 returnedlength = sizeof(currentcard->tag_9C);goto exitfunction;}
124 else if(!memcmp(tag, "\x9D\x00",2)){
125 memcpy(&returnedtag, currentcard->tag_9D, currentcard->tag_9D_len);
126 returnedlength = currentcard->tag_9D_len; goto exitfunction;}
127 else if(!memcmp(tag, "\x9D\x00",2)){
128 memcpy(&returnedtag, currentcard->tag_9D, currentcard->tag_9D_len);
129 returnedlength = currentcard->tag_9D_len; goto exitfunction;}
130 else if(!memcmp(tag, "\xCD\x00",2)){
131 memcpy(&returnedtag, currentcard->tag_CD, sizeof(currentcard->tag_CD));
132 returnedlength = sizeof(currentcard->tag_CD);goto exitfunction;}
133 else if(!memcmp(tag, "\xCE\x00",2)){
134 memcpy(&returnedtag, currentcard->tag_CE, sizeof(currentcard->tag_CE));
135 returnedlength = sizeof(currentcard->tag_CE);goto exitfunction;}
136 else if(!memcmp(tag, "\xCF\x00",2)){
137 memcpy(&returnedtag, currentcard->tag_CF, sizeof(currentcard->tag_CF));
138 returnedlength = sizeof(currentcard->tag_CF);goto exitfunction;}
139 else if(!memcmp(tag, "\xD7\x00",2)){
140 memcpy(&returnedtag, currentcard->tag_D7, sizeof(currentcard->tag_D7));
141 returnedlength = sizeof(currentcard->tag_D7);goto exitfunction;}
142 else if(!memcmp(tag, "\xD8\x00",2)){
143 memcpy(&returnedtag, currentcard->tag_D8, sizeof(currentcard->tag_D8));
144 returnedlength = sizeof(currentcard->tag_D8);goto exitfunction;}
145 else if(!memcmp(tag, "\xD9\x00",2)){
146 memcpy(&returnedtag, currentcard->tag_D9, currentcard->tag_D9_len);
147 returnedlength = currentcard->tag_D9_len;goto exitfunction;}
148 else if(!memcmp(tag, "\xDA\x00",2)){
149 memcpy(&returnedtag, currentcard->tag_DA, sizeof(currentcard->tag_DA));
150 returnedlength = sizeof(currentcard->tag_DA);goto exitfunction;}
151 else if(!memcmp(tag, "\xDB\x00",2)){
152 memcpy(&returnedtag, currentcard->tag_DB, sizeof(currentcard->tag_DB));
153 returnedlength = sizeof(currentcard->tag_DB);goto exitfunction;}
154 else if(!memcmp(tag, "\xDC\x00",2)){
155 memcpy(&returnedtag, currentcard->tag_DC, sizeof(currentcard->tag_DC));
156 returnedlength = sizeof(currentcard->tag_DC);goto exitfunction;}
157 else if(!memcmp(tag, "\xDD\x00",2)){
158 memcpy(&returnedtag, currentcard->tag_DD, sizeof(currentcard->tag_DD));
159 returnedlength = sizeof(currentcard->tag_DD);goto exitfunction;}
160 else if(!memcmp(tag, "\xA5\x00",2)){
161 memcpy(&returnedtag, currentcard->tag_A5, currentcard->tag_A5_len);
162 returnedlength = currentcard->tag_A5_len; goto exitfunction;}
163 else if(!memcmp(tag, "\xAF\x00",2)){
164 memcpy(&returnedtag, currentcard->tag_AF, currentcard->tag_AF_len);
165 returnedlength = currentcard->tag_AF_len; goto exitfunction;}
166 if(*tag == 0x5F){
167 if(*(tag+1) == 0x20){
168 memcpy(&returnedtag, currentcard->tag_5F20, currentcard->tag_5F20_len);
169 returnedlength = currentcard->tag_5F20_len; goto exitfunction;}
170 else if(*(tag+1) == 0x24){
171 memcpy(&returnedtag, currentcard->tag_5F24, sizeof(currentcard->tag_5F24));
172 returnedlength = sizeof(currentcard->tag_5F24);goto exitfunction;}
173 else if(*(tag+1) == 0x25){
174 memcpy(&returnedtag, currentcard->tag_5F25, sizeof(currentcard->tag_5F25));
175 returnedlength = sizeof(currentcard->tag_5F25);goto exitfunction;}
176 else if(*(tag+1) == 0x28){
177 memcpy(&returnedtag, currentcard->tag_5F28, sizeof(currentcard->tag_5F28));
178 returnedlength = sizeof(currentcard->tag_5F28);goto exitfunction;}
179 else if(*(tag+1) == 0x2A){
180 memcpy(&returnedtag, currentcard->tag_5F2A, sizeof(currentcard->tag_5F2A));
181 returnedlength = sizeof(currentcard->tag_5F2A);goto exitfunction;}
182 else if(*(tag+1) == 0x2D){
183 memcpy(&returnedtag, currentcard->tag_5F2D, currentcard->tag_5F2D_len);
184 returnedlength = currentcard->tag_5F2D_len; goto exitfunction;}
185 else if(*(tag+1) == 0x30){
186 memcpy(&returnedtag, currentcard->tag_5F30, sizeof(currentcard->tag_5F30));
187 returnedlength = sizeof(currentcard->tag_5F30);goto exitfunction;}
188 else if(*(tag+1) == 0x34){
189 memcpy(&returnedtag, currentcard->tag_5F34, sizeof(currentcard->tag_5F34));
190 returnedlength = sizeof(currentcard->tag_5F34);goto exitfunction;}
191 else if(*(tag+1) == 0x36){
192 memcpy(&returnedtag, currentcard->tag_5F36, sizeof(currentcard->tag_5F36));
193 returnedlength = sizeof(currentcard->tag_5F36);goto exitfunction;}
194 else if(*(tag+1) == 0x50){
195 memcpy(&returnedtag, currentcard->tag_5F50, currentcard->tag_5F50_len);
196 returnedlength = currentcard->tag_5F50_len; goto exitfunction;}
197 else if(*(tag+1) == 0x54){
198 memcpy(&returnedtag, currentcard->tag_5F54, currentcard->tag_5F54_len);
199 returnedlength = currentcard->tag_5F54_len; goto exitfunction;}
200 }
201 if(*tag == 0x9F) {
202 if(*(tag+1) == 0x01){
203 memcpy(&returnedtag, currentcard->tag_9F01, sizeof(currentcard->tag_9F01));
204 returnedlength = sizeof(currentcard->tag_9F01);goto exitfunction;}
205 else if(*(tag+1) == 0x02){
206 memcpy(&returnedtag, currentcard->tag_9F02, sizeof(currentcard->tag_9F02));
207 returnedlength = sizeof(currentcard->tag_9F02);goto exitfunction;}
208 else if(*(tag+1) == 0x03){
209 returnedlength = sizeof(currentcard->tag_9F03);goto exitfunction;}
210 else if(*(tag+1) == 0x04){
211 memcpy(&returnedtag, currentcard->tag_9F04, sizeof(currentcard->tag_9F04));
212 returnedlength = sizeof(currentcard->tag_9F04);goto exitfunction;}
213 else if(*(tag+1) == 0x05){
214 memcpy(&returnedtag, currentcard->tag_9F05, currentcard->tag_9F05_len);
215 returnedlength = currentcard->tag_9F05_len; goto exitfunction;}
216 else if(*(tag+1) == 0x06){
217 memcpy(&returnedtag, currentcard->tag_9F06, currentcard->tag_9F06_len);
218 returnedlength = currentcard->tag_9F06_len; goto exitfunction;}
219 else if(*(tag+1) == 0x07){
220 memcpy(&returnedtag, currentcard->tag_9F07, sizeof(currentcard->tag_9F07));
221 returnedlength = sizeof(currentcard->tag_9F07);goto exitfunction;}
222 else if(*(tag+1) == 0x08){
223 memcpy(&returnedtag, currentcard->tag_9F08, sizeof(currentcard->tag_9F08));
224 returnedlength = sizeof(currentcard->tag_9F08);goto exitfunction;}
225 else if(*(tag+1) == 0x09){
226 memcpy(&returnedtag, currentcard->tag_9F09, sizeof(currentcard->tag_9F09));
227 returnedlength = sizeof(currentcard->tag_9F09);goto exitfunction;}
228 else if(*(tag+1) == 0x0B){
229 memcpy(&returnedtag, currentcard->tag_9F0B, currentcard->tag_9F0B_len);
230 returnedlength = currentcard->tag_9F0B_len; goto exitfunction;}
231 else if(*(tag+1) == 0x0D){
232 memcpy(&returnedtag, currentcard->tag_9F0D, sizeof(currentcard->tag_9F0D));
233 returnedlength = sizeof(currentcard->tag_9F0D); goto exitfunction;}
234 else if(*(tag+1) == 0x0E){
235 memcpy(&returnedtag, currentcard->tag_9F0E, sizeof(currentcard->tag_9F0E));
236 returnedlength = sizeof(currentcard->tag_9F0E); goto exitfunction;}
237 else if(*(tag+1) == 0x0F){
238 memcpy(&returnedtag, currentcard->tag_9F0F, sizeof(currentcard->tag_9F0F));
239 returnedlength = sizeof(currentcard->tag_9F0F); goto exitfunction;}
240 else if(*(tag+1) == 0x10){
241 memcpy(&returnedtag, currentcard->tag_9F10, currentcard->tag_9F10_len);
242 returnedlength = currentcard->tag_9F10_len; goto exitfunction;}
243 else if(*(tag+1) == 0x11){
244 memcpy(&returnedtag, currentcard->tag_9F11, sizeof(currentcard->tag_9F11));
245 returnedlength = sizeof(currentcard->tag_9F11); goto exitfunction;}
246 else if(*(tag+1) == 0x12){
247 memcpy(&returnedtag, currentcard->tag_9F12, currentcard->tag_9F12_len);
248 returnedlength = currentcard->tag_9F12_len; goto exitfunction;}
249 else if(*(tag+1) == 0x1A){
250 memcpy(&returnedtag, currentcard->tag_9F1A, sizeof(currentcard->tag_9F1A));
251 returnedlength = sizeof(currentcard->tag_9F1A); goto exitfunction;}
252 else if(*(tag+1) == 0x1F){
253 memcpy(&returnedtag, currentcard->tag_9F1F, currentcard->tag_9F1F_len);
254 returnedlength = currentcard->tag_9F1F_len; goto exitfunction;}
255 else if(*(tag+1) == 0x32){
256 memcpy(&returnedtag, currentcard->tag_9F32, currentcard->tag_9F32_len);
257 returnedlength = currentcard->tag_9F32_len; goto exitfunction;}
258 else if(*(tag+1) == 0x34){
259 memcpy(&returnedtag, currentcard->tag_9F34, sizeof(currentcard->tag_9F34));
260 returnedlength = sizeof(currentcard->tag_9F34); goto exitfunction;}
261 else if(*(tag+1) == 0x35){
262 memcpy(&returnedtag, currentcard->tag_9F35, sizeof(currentcard->tag_9F35));
263 returnedlength = sizeof(currentcard->tag_9F35); goto exitfunction;}
264 else if(*(tag+1) == 0x37){
265 memcpy(&returnedtag, currentcard->tag_9F37, sizeof(currentcard->tag_9F37));
266 returnedlength = sizeof(currentcard->tag_9F37);goto exitfunction;}
267 else if(*(tag+1) == 0x38){
268 memcpy(&returnedtag, currentcard->tag_9F38, currentcard->tag_9F38_len);
269 returnedlength = currentcard->tag_9F38_len; goto exitfunction;}
270 else if(*(tag+1) == 0x44){
271 memcpy(&returnedtag, currentcard->tag_9F44, sizeof(currentcard->tag_9F44));
272 returnedlength = sizeof(currentcard->tag_9F44);goto exitfunction;}
273 else if(*(tag+1) == 0x45){
274 memcpy(&returnedtag, currentcard->tag_9F45, sizeof(currentcard->tag_9F45));
275 returnedlength = sizeof(currentcard->tag_9F45);goto exitfunction;}
276 else if(*(tag+1) == 0x46){
277 memcpy(&returnedtag, currentcard->tag_9F46, currentcard->tag_9F46_len);
278 returnedlength = currentcard->tag_9F46_len; goto exitfunction;}
279 else if(*(tag+1) == 0x47){
280 memcpy(&returnedtag, currentcard->tag_9F47, currentcard->tag_9F47_len);
281 returnedlength = currentcard->tag_9F47_len; goto exitfunction;}
282 else if(*(tag+1) == 0x48){
283 memcpy(&returnedtag, currentcard->tag_9F48, currentcard->tag_9F48_len);
284 returnedlength = currentcard->tag_9F48_len; goto exitfunction;}
285 else if(*(tag+1) == 0x49){
286 memcpy(&returnedtag, currentcard->tag_9F49, currentcard->tag_9F49_len);
287 returnedlength = currentcard->tag_9F49_len; goto exitfunction;}
288 else if(*(tag+1) == 0x4A){
289 memcpy(&returnedtag, currentcard->tag_9F4A, sizeof(currentcard->tag_9F4A));
290 returnedlength = sizeof(currentcard->tag_9F4A);goto exitfunction;}
291 else if(*(tag+1) == 0x4B){
292 memcpy(&returnedtag, currentcard->tag_9F4B, currentcard->tag_9F4B_len);
293 returnedlength = currentcard->tag_9F4B_len; goto exitfunction;}
294 else if(*(tag+1) == 0x4C){
295 memcpy(&returnedtag, currentcard->tag_9F4C, sizeof(currentcard->tag_9F4C));
296 returnedlength = sizeof(currentcard->tag_9F4C); goto exitfunction;}
297 else if(*(tag+1) == 0x60){
298 memcpy(&returnedtag, currentcard->tag_9F60, sizeof(currentcard->tag_9F60));
299 returnedlength = sizeof(currentcard->tag_9F60);goto exitfunction;}
300 else if(*(tag+1) == 0x61){
301 memcpy(&returnedtag, currentcard->tag_9F61, sizeof(currentcard->tag_9F61));
302 returnedlength = sizeof(currentcard->tag_9F61);goto exitfunction;}
303 else if(*(tag+1) == 0x62){
304 memcpy(&returnedtag, currentcard->tag_9F62, sizeof(currentcard->tag_9F62));
305 returnedlength = sizeof(currentcard->tag_9F62);goto exitfunction;}
306 else if(*(tag+1) == 0x63){
307 memcpy(&returnedtag, currentcard->tag_9F63, sizeof(currentcard->tag_9F63));
308 returnedlength = sizeof(currentcard->tag_9F63);goto exitfunction;}
309 else if(*(tag+1) == 0x64){
310 memcpy(&returnedtag, currentcard->tag_9F64, sizeof(currentcard->tag_9F64));
311 returnedlength = sizeof(currentcard->tag_9F64);goto exitfunction;}
312 else if(*(tag+1) == 0x65){
313 memcpy(&returnedtag, currentcard->tag_9F65, sizeof(currentcard->tag_9F65));
314 returnedlength = sizeof(currentcard->tag_9F65);goto exitfunction;}
315 else if(*(tag+1) == 0x66){
316 memcpy(&returnedtag, currentcard->tag_9F66, sizeof(currentcard->tag_9F66));
317 returnedlength = sizeof(currentcard->tag_9F66);goto exitfunction;}
318 else if(*(tag+1) == 0x67){
319 memcpy(&returnedtag, currentcard->tag_9F67, sizeof(currentcard->tag_9F67));
320 returnedlength = sizeof(currentcard->tag_9F67);goto exitfunction;}
321 else if(*(tag+1) == 0x68){
322 memcpy(&returnedtag, currentcard->tag_9F68, currentcard->tag_9F68_len);
323 returnedlength = currentcard->tag_9F68_len;goto exitfunction;}
324 else if(*(tag+1) == 0x69){
325 memcpy(&returnedtag, currentcard->tag_9F69, currentcard->tag_9F69_len);
326 returnedlength = currentcard->tag_9F69_len; goto exitfunction;}
327 else if(*(tag+1) == 0x6A){
328 memcpy(&returnedtag, currentcard->tag_9F6A, sizeof(currentcard->tag_9F6A));
329 returnedlength = sizeof(currentcard->tag_9F6A);goto exitfunction;}
330 else if(*(tag+1) == 0x6B){
331 memcpy(&returnedtag, currentcard->tag_9F6B, currentcard->tag_9F6B_len);
332 returnedlength = currentcard->tag_9F6B_len; goto exitfunction;}
333 else if(*(tag+1) == 0x6C){
334 memcpy(&returnedtag, currentcard->tag_9F6C, sizeof(currentcard->tag_9F6C));
335 returnedlength = sizeof(currentcard->tag_9F6C);goto exitfunction;}
336 }
337 else {
338 if(!memcmp(tag, "\x61\x00",2)){
339 memcpy(&returnedtag, currentcard->tag_61, currentcard->tag_61_len);
340 returnedlength = currentcard->tag_61_len; goto exitfunction;}
341 else if(!memcmp(tag, "\x6F\x00",2)){
342 memcpy(&returnedtag, currentcard->tag_6F, currentcard->tag_6F_len);
343 returnedlength = currentcard->tag_6F_len; goto exitfunction;}
344 else if(!memcmp(tag, "\xAF\x00",2)){
345 memcpy(&returnedtag, currentcard->tag_AF, currentcard->tag_AF_len);
346 returnedlength = currentcard->tag_AF_len; goto exitfunction;}
347 else if(!memcmp(tag, "\x70\x00",2)){
348 memcpy(&returnedtag, currentcard->tag_70, currentcard->tag_70_len);
349 returnedlength = currentcard->tag_70_len; goto exitfunction;}
350 else if(!memcmp(tag, "\x77\x00",2)){
351 memcpy(&returnedtag, currentcard->tag_77, currentcard->tag_77_len);
352 returnedlength = currentcard->tag_77_len; goto exitfunction;}
353 else if(!memcmp(tag, "\x80\x00",2)){
354 memcpy(&returnedtag, currentcard->tag_80, currentcard->tag_80_len);
355 returnedlength = currentcard->tag_80_len; goto exitfunction;}
356 else if(!memcmp(tag, "\xBF\x0C",2)){
357 memcpy(&returnedtag, currentcard->tag_BF0C, currentcard->tag_BF0C_len);
358 returnedlength = currentcard->tag_BF0C_len; goto exitfunction;}
359 else if(!memcmp(tag, "\xFF\x01",2)){ //special DF tag
360 memcpy(&returnedtag, currentcard->tag_DFName, currentcard->tag_DFName_len);
361 returnedlength = currentcard->tag_DFName_len; goto exitfunction;}
362 }
363 exitfunction: //goto label to exit search quickly once found
364 memcpy(outputval, &returnedtag, returnedlength);
365 *outputvallen = returnedlength;
366 return 0;
367 }
368
369 //function to
370 int emv_settag(uint32_t tag, uint8_t *datain, emvcard *currentcard){
371 char binarydata[255] = {0};
372
373 /*
374 // if((strlen((const char *)datain)%2) != 0){ //must be an even string
375 // return -1;
376 // }
377 // if(strlen((const char *)datain) > 255) {
378 // return -1;
379 // }
380 */
381
382 uint8_t datalen = strlen((const char *)datain) / 2; //length of datain
383 for(int i = 0; i < strlen((const char *)datain); i += 2){
384 binarydata[i/2] |= (char)hex2int(datain[i]) << 4;
385 binarydata[i/2] |= (char)hex2int(datain[i+1]);
386 }
387 Dbprintf("BINARYDATA=");
388 Dbhexdump(datalen,(uint8_t *)binarydata,false);
389
390 switch(tag){
391 case 0x4F:
392 memcpy(currentcard->tag_4F, binarydata, datalen);
393 currentcard->tag_4F_len = datalen;
394 break;
395 case 0x50:
396 memcpy(currentcard->tag_50, binarydata, datalen);
397 currentcard->tag_50_len = datalen;
398 break;
399 case 0x56:
400 memcpy(currentcard->tag_56, binarydata, datalen);
401 currentcard->tag_56_len = datalen;
402 break;
403 case 0x57:
404 memcpy(currentcard->tag_57, binarydata, datalen);
405 currentcard->tag_57_len = datalen;
406 break;
407 case 0x5a:
408 memcpy(currentcard->tag_5A, binarydata, datalen);
409 currentcard->tag_5A_len = datalen;
410 break;
411 case 0x61:
412 memcpy(currentcard->tag_61, binarydata, datalen);
413 currentcard->tag_61_len = datalen;
414 break;
415 case 0x6f:
416 memcpy(currentcard->tag_6F, binarydata, datalen);
417 currentcard->tag_6F_len = datalen;
418 break;
419 case 0x70:
420 memcpy(currentcard->tag_70, binarydata, datalen);
421 currentcard->tag_70_len = datalen;
422 break;
423 case 0x77:
424 memcpy(currentcard->tag_77, binarydata, datalen);
425 currentcard->tag_77_len = datalen;
426 break;
427 case 0x80:
428 memcpy(currentcard->tag_80, binarydata, datalen);
429 currentcard->tag_80_len = datalen;
430 break;
431 case 0x82:
432 memcpy(currentcard->tag_82, binarydata, sizeof(currentcard->tag_82));
433 break;
434 case 0x84:
435 memcpy(currentcard->tag_84, binarydata, datalen);
436 currentcard->tag_84_len = datalen;
437 break;
438 case 0x86:
439 memcpy(currentcard->tag_86, binarydata, datalen);
440 currentcard->tag_86_len = datalen;
441 break;
442 case 0x87:
443 memcpy(currentcard->tag_87, binarydata, sizeof(currentcard->tag_87));
444 break;
445 case 0x88:
446 memcpy(currentcard->tag_88, binarydata, sizeof(currentcard->tag_88));
447 break;
448 case 0x8a:
449 memcpy(currentcard->tag_8A, binarydata, sizeof(currentcard->tag_8A));
450 break;
451 case 0x8c:
452 memcpy(currentcard->tag_8C, binarydata, datalen);
453 currentcard->tag_8C_len = datalen;
454 break;
455 case 0x8d:
456 memcpy(currentcard->tag_8D, binarydata, datalen);
457 currentcard->tag_8D_len = datalen;
458 break;
459 case 0x8e:
460 memcpy(currentcard->tag_8E, binarydata, datalen);
461 currentcard->tag_8E_len = datalen;
462 break;
463 case 0x8f:
464 memcpy(currentcard->tag_8F, binarydata, sizeof(currentcard->tag_8F));
465 break;
466 case 0x90:
467 memcpy(currentcard->tag_90, binarydata, datalen);
468 currentcard->tag_90_len = datalen;
469 break;
470 case 0x91:
471 memcpy(currentcard->tag_91, binarydata, datalen);
472 currentcard->tag_91_len = datalen;
473 break;
474 case 0x92:
475 memcpy(currentcard->tag_92, binarydata, datalen);
476 currentcard->tag_92_len = datalen;
477 break;
478 case 0x93:
479 memcpy(currentcard->tag_93, binarydata, datalen);
480 currentcard->tag_93_len = datalen;
481 break;
482 case 0x94:
483 memcpy(currentcard->tag_94, binarydata, datalen);
484 currentcard->tag_94_len = datalen;
485 break;
486 case 0x95:
487 memcpy(currentcard->tag_95, binarydata, sizeof(currentcard->tag_95));
488 break;
489 case 0x97:
490 memcpy(currentcard->tag_97, binarydata, datalen);
491 currentcard->tag_97_len = datalen;
492 break;
493 case 0x98:
494 memcpy(currentcard->tag_98, binarydata, sizeof(currentcard->tag_98));
495 break;
496 case 0x99:
497 memcpy(currentcard->tag_99, binarydata, datalen);
498 currentcard->tag_99_len = datalen;
499 break;
500 case 0x9a:
501 memcpy(currentcard->tag_9A, binarydata, sizeof(currentcard->tag_9A));
502 break;
503 case 0x9b:
504 memcpy(currentcard->tag_9B, binarydata, sizeof(currentcard->tag_9B));
505 break;
506 case 0x9c:
507 memcpy(currentcard->tag_9C, binarydata, sizeof(currentcard->tag_9C));
508 break;
509 case 0x9d:
510 memcpy(currentcard->tag_9D, binarydata, datalen);
511 currentcard->tag_9D_len = datalen;
512 break;
513 case 0xa5:
514 memcpy(currentcard->tag_A5, binarydata, datalen);
515 currentcard->tag_A5_len = datalen;
516 break;
517 case 0xaf:
518 memcpy(currentcard->tag_AF, binarydata, datalen);
519 currentcard->tag_AF_len = datalen;
520 break;
521 case 0xcd:
522 memcpy(currentcard->tag_CD, binarydata, sizeof(currentcard->tag_CD));
523 break;
524 case 0xce:
525 memcpy(currentcard->tag_CE, binarydata, sizeof(currentcard->tag_CE));
526 break;
527 case 0xcf:
528 memcpy(currentcard->tag_CF, binarydata, sizeof(currentcard->tag_CF));
529 break;
530 case 0xd7:
531 memcpy(currentcard->tag_CF, binarydata, sizeof(currentcard->tag_CF));
532 break;
533 case 0xd8:
534 memcpy(currentcard->tag_CF, binarydata, sizeof(currentcard->tag_CF));
535 break;
536 case 0xd9:
537 break;
538 case 0xda:
539 memcpy(currentcard->tag_DA, binarydata, sizeof(currentcard->tag_DA));
540 break;
541 case 0xdb:
542 memcpy(currentcard->tag_DB, binarydata, sizeof(currentcard->tag_DB));
543 break;
544 case 0xdc:
545 memcpy(currentcard->tag_DB, binarydata, sizeof(currentcard->tag_DB));
546 break;
547 case 0xdd:
548 memcpy(currentcard->tag_DD, binarydata, sizeof(currentcard->tag_DD));
549 break;
550 case 0x5f20:
551 break;
552 case 0x5f24:
553 memcpy(currentcard->tag_5F24, binarydata, sizeof(currentcard->tag_5F24));
554 break;
555 case 0x5f25:
556 memcpy(currentcard->tag_5F25, binarydata, sizeof(currentcard->tag_5F25));
557 break;
558 case 0x5f28:
559 memcpy(currentcard->tag_5F28, binarydata, sizeof(currentcard->tag_5F28));
560 break;
561 case 0x5f2a:
562 memcpy(currentcard->tag_5F2A, binarydata, sizeof(currentcard->tag_5F2A));
563 break;
564 case 0x5f2d:
565 break;
566 case 0x5f30:
567 memcpy(currentcard->tag_5F30, binarydata, sizeof(currentcard->tag_5F30));
568 break;
569 case 0x5f34:
570 memcpy(currentcard->tag_5F34, binarydata, sizeof(currentcard->tag_5F34));
571 break;
572 case 0x5f36:
573 memcpy(currentcard->tag_5F36, binarydata, sizeof(currentcard->tag_5F36));
574 break;
575 case 0x5f50:
576 break;
577 case 0x5f54:
578 memcpy(currentcard->tag_5F54, binarydata, sizeof(currentcard->tag_5F54));
579 break;
580 case 0x9f01:
581 memcpy(currentcard->tag_9F01, binarydata, sizeof(currentcard->tag_9F01));
582 break;
583 case 0x9f02:
584 memcpy(currentcard->tag_9F02, binarydata, sizeof(currentcard->tag_9F02));
585 break;
586 case 0x9f03:
587 memcpy(currentcard->tag_9F03, binarydata, sizeof(currentcard->tag_9F03));
588 break;
589 case 0x9f04:
590 memcpy(currentcard->tag_9F04, binarydata, sizeof(currentcard->tag_9F04));
591 break;
592 case 0x9f05:
593 memcpy(currentcard->tag_9F05, binarydata, datalen);
594 currentcard->tag_9F05_len = datalen;
595 break;
596 case 0x9f06:
597 memcpy(currentcard->tag_9F06, binarydata, datalen);
598 currentcard->tag_9F06_len = datalen;
599 break;
600 case 0x9f07:
601 memcpy(currentcard->tag_9F07, binarydata, sizeof(currentcard->tag_9F07));
602 break;
603 case 0x9f08:
604 memcpy(currentcard->tag_9F08, binarydata, sizeof(currentcard->tag_9F08));
605 break;
606 case 0x9f09:
607 memcpy(currentcard->tag_9F09, binarydata, sizeof(currentcard->tag_9F09));
608 break;
609 case 0x9f0b:
610 memcpy(currentcard->tag_9F0B, binarydata, sizeof(currentcard->tag_9F0B));
611 break;
612 case 0x9f0d:
613 memcpy(currentcard->tag_9F0D, binarydata, sizeof(currentcard->tag_9F0D));
614 break;
615 case 0x9f0e:
616 memcpy(currentcard->tag_9F0E, binarydata, sizeof(currentcard->tag_9F0E));
617 break;
618 case 0x9f0f:
619 memcpy(currentcard->tag_9F0F, binarydata, sizeof(currentcard->tag_9F0F));
620 break;
621 case 0x9f10:
622 memcpy(currentcard->tag_9F10, binarydata, datalen);
623 currentcard->tag_9F10_len = datalen;break;
624 case 0x9f11:
625 memcpy(currentcard->tag_9F11, binarydata, sizeof(currentcard->tag_9F11));
626 break;
627 case 0x9f12:
628 memcpy(currentcard->tag_9F12, binarydata, datalen);
629 currentcard->tag_9F12_len = datalen;break;
630 case 0x9f13:
631 memcpy(currentcard->tag_9F13, binarydata, sizeof(currentcard->tag_9F13));
632 break;
633 case 0x9f14:
634 memcpy(currentcard->tag_9F14, binarydata, sizeof(currentcard->tag_9F14));
635 break;
636 case 0x9f15:
637 memcpy(currentcard->tag_9F15, binarydata, sizeof(currentcard->tag_9F15));
638 break;
639 case 0x9f16:
640 memcpy(currentcard->tag_9F16, binarydata, sizeof(currentcard->tag_9F16));
641 break;
642 case 0x9f17:
643 memcpy(currentcard->tag_9F17, binarydata, sizeof(currentcard->tag_9F17));
644 break;
645 case 0x9f18:
646 memcpy(currentcard->tag_9F18, binarydata, sizeof(currentcard->tag_9F18));
647 break;
648 case 0x9f1a:
649 memcpy(currentcard->tag_9F1A, binarydata, sizeof(currentcard->tag_9F1A));
650 break;
651 case 0x9f1b:
652 memcpy(currentcard->tag_9F1B, binarydata, sizeof(currentcard->tag_9F1B));
653 break;
654 case 0x9f1c:
655 memcpy(currentcard->tag_9F1C, binarydata, sizeof(currentcard->tag_9F1C));
656 break;
657 case 0x9f1d:
658 memcpy(currentcard->tag_9F1D, binarydata, datalen);
659 currentcard->tag_9F1D_len = datalen;break;
660 case 0x9f1e:
661 memcpy(currentcard->tag_9F1E, binarydata, sizeof(currentcard->tag_9F1E));
662 break;
663 case 0x9f1f:
664 memcpy(currentcard->tag_9F1F, binarydata, datalen);
665 currentcard->tag_9F1F_len = datalen;break;
666 case 0x9f20:
667 memcpy(currentcard->tag_9F20, binarydata, datalen);
668 currentcard->tag_9F20_len = datalen;break;
669 case 0x9f21:
670 memcpy(currentcard->tag_9F21, binarydata, sizeof(currentcard->tag_9F21));
671 break;
672 case 0x9f22:
673 memcpy(currentcard->tag_9F22, binarydata, sizeof(currentcard->tag_9F22));
674 break;
675 case 0x9f23:
676 memcpy(currentcard->tag_9F23, binarydata, sizeof(currentcard->tag_9F23));
677 break;
678 case 0x9f26:
679 memcpy(currentcard->tag_9F26, binarydata, sizeof(currentcard->tag_9F26));
680 break;
681 case 0x9f27:
682 memcpy(currentcard->tag_9F27, binarydata, sizeof(currentcard->tag_9F27));
683 break;
684 case 0x9f2d:
685 memcpy(currentcard->tag_9F2D, binarydata, datalen);
686 currentcard->tag_9F2D_len = datalen;break;
687 case 0x9f2e:
688 memcpy(currentcard->tag_9F2E, binarydata, sizeof(currentcard->tag_9F2E));
689 break;
690 case 0x9f2f:
691 memcpy(currentcard->tag_9F2F, binarydata, datalen);
692 currentcard->tag_9F2F_len = datalen;break;
693 case 0x9f32:
694 memcpy(currentcard->tag_9F32, binarydata, datalen);
695 currentcard->tag_9F32_len = datalen;break;
696 case 0x9f33:
697 memcpy(currentcard->tag_9F33, binarydata, sizeof(currentcard->tag_9F33));
698 break;
699 case 0x9f34:
700 memcpy(currentcard->tag_9F34, binarydata, sizeof(currentcard->tag_9F34));
701 break;
702 case 0x9f35:
703 memcpy(currentcard->tag_9F35, binarydata, sizeof(currentcard->tag_9F35));
704 break;
705 case 0x9f36:
706 memcpy(currentcard->tag_9F36, binarydata, sizeof(currentcard->tag_9F36));
707 break;
708 case 0x9f37:
709 memcpy(currentcard->tag_9F37, binarydata, sizeof(currentcard->tag_9F37));
710 break;
711 case 0x9f38:
712 break;
713 case 0x9f39:
714 memcpy(currentcard->tag_9F39, binarydata, sizeof(currentcard->tag_9F39));
715 break;
716 case 0x9f40:
717 memcpy(currentcard->tag_9F40, binarydata, sizeof(currentcard->tag_9F40));
718 break;
719 case 0x9f41:
720 memcpy(currentcard->tag_9F41, binarydata, sizeof(currentcard->tag_9F41));
721 break;
722 case 0x9f42:
723 memcpy(currentcard->tag_9F42, binarydata, sizeof(currentcard->tag_9F42));
724 break;
725 case 0x9f43:
726 memcpy(currentcard->tag_9F43, binarydata, sizeof(currentcard->tag_9F43));
727 break;
728 case 0x9f44:
729 memcpy(currentcard->tag_9F44, binarydata, sizeof(currentcard->tag_9F44));
730 break;
731 case 0x9f45:
732 memcpy(currentcard->tag_9F45, binarydata, sizeof(currentcard->tag_9F45));
733 break;
734 case 0x9f46:
735 memcpy(currentcard->tag_9F46, binarydata, datalen);
736 currentcard->tag_9F46_len = datalen;break;
737 case 0x9f47:
738 memcpy(currentcard->tag_9F47, binarydata, datalen);
739 currentcard->tag_9F47_len = datalen;break;
740 case 0x9f48:
741 memcpy(currentcard->tag_9F48, binarydata, datalen);
742 currentcard->tag_9F48_len = datalen;break;
743 case 0x9f49:
744 memcpy(currentcard->tag_9F49, binarydata, datalen);
745 currentcard->tag_9F49_len = datalen;break;
746 case 0x9f4a:
747 memcpy(currentcard->tag_9F4A, binarydata, sizeof(currentcard->tag_9F4A));
748 break;
749 case 0x9f4b:
750 memcpy(currentcard->tag_9F4B, binarydata, datalen);
751 currentcard->tag_9F4B_len = datalen;break;
752 case 0x9f4c:
753 memcpy(currentcard->tag_9F4C, binarydata, sizeof(currentcard->tag_9F4C));
754 break;
755 case 0x9f4d:
756 memcpy(currentcard->tag_9F4D, binarydata, sizeof(currentcard->tag_9F4D));
757 break;
758 case 0x9f4e:
759 memcpy(currentcard->tag_9F4E, binarydata, sizeof(currentcard->tag_9F4E));
760 break;
761 case 0x9f60:
762 memcpy(currentcard->tag_9F60, binarydata, sizeof(currentcard->tag_9F60));
763 break;
764 case 0x9f61:
765 memcpy(currentcard->tag_9F61, binarydata, sizeof(currentcard->tag_9F61));
766 break;
767 case 0x9f62:
768 memcpy(currentcard->tag_9F62, binarydata, sizeof(currentcard->tag_9F62));
769 break;
770 case 0x9f63:
771 memcpy(currentcard->tag_9F63, binarydata, sizeof(currentcard->tag_9F63));
772 break;
773 case 0x9f64:
774 memcpy(currentcard->tag_9F64, binarydata, sizeof(currentcard->tag_9F64));
775 break;
776 case 0x9f65:
777 memcpy(currentcard->tag_9F65, binarydata, sizeof(currentcard->tag_9F65));
778 break;
779 case 0x9f66:
780 memcpy(currentcard->tag_9F66, binarydata, sizeof(currentcard->tag_9F66));
781 break;
782 case 0x9f67:
783 memcpy(currentcard->tag_9F67, binarydata, sizeof(currentcard->tag_9F67));
784 break;
785 case 0x9f68:
786 memcpy(currentcard->tag_9F68, binarydata, datalen);
787 currentcard->tag_9F68_len = datalen;break;
788 case 0x9f69:
789 memcpy(currentcard->tag_9F69, binarydata, datalen);
790 currentcard->tag_9F69_len = datalen;break;
791 case 0x9f6a:
792 memcpy(currentcard->tag_9F6A, binarydata, sizeof(currentcard->tag_9F6A));
793 break;
794 case 0x9f6b:
795 memcpy(currentcard->tag_9F6B, binarydata, sizeof(currentcard->tag_9F6B));
796 break;
797 case 0x9f6c:
798 memcpy(currentcard->tag_9F6C, binarydata, sizeof(currentcard->tag_9F6C));
799 break;
800 case 0xbf0c:
801 memcpy(currentcard->tag_BF0C, binarydata, datalen);
802 currentcard->tag_BF0C_len = datalen;break;
803 default:
804 break;
805 }
806 return 0;
807 }
808
809 /* generates an emv template based off tag values supplied */
810 int emv_generatetemplate(uint8_t* templateval,emvcard* currentcard, uint8_t* returnedval, uint8_t* returnedlen,uint8_t numtags, ...)
811 {
812 va_list arguments;
813 uint8_t* currenttag; //value of the current tag
814 uint8_t tagval[256]; //buffer to hold the extracted tag value
815 uint8_t taglen = 0; //extracted tag length
816 uint8_t bufferval[256];
817 uint8_t counter = 0;
818 uint32_t encodedlen = 0;
819 va_start(arguments, numtags);
820 for(int x=0; x<numtags; x++){
821 currenttag = va_arg(arguments, uint8_t*);
822 emv_lookuptag(currenttag, currentcard, tagval, &taglen);
823 encode_ber_tlv_item(currenttag, (uint8_t)strlen((const char*)currenttag), tagval, (uint32_t)taglen, bufferval+counter, &encodedlen);
824 counter +=encodedlen;
825 }
826 encode_ber_tlv_item(templateval, strlen((const char*) templateval), bufferval, counter, returnedval, &encodedlen);
827 *returnedlen = encodedlen;
828 va_end(arguments);
829 return 0;
830 }
831
832 //generate a valid pdol list
833 int emv_generateDOL(uint8_t* DOL, uint8_t DOLlen,emvcard* currentcard,uint8_t* DOLoutput, uint8_t* DOLoutputlen)
834 {
835 if(!DOL || !currentcard || !DOLoutput) // null pointer checks
836 return 1;
837 //scan through the DOL list and construct the result.
838 uint8_t i = 0;
839 uint8_t DOLcounter = 0; //points to the current DOL buffer location
840 uint8_t scannedtaglen = 0; //length of a scanned tag
841 uint8_t scannedtag[2] = {0x00,0x00}; //buffer for the scanned tag
842 uint8_t DOLoutputbuffer[255];
843 uint8_t retrievedtagvallen;
844
845 memset(DOLoutputbuffer,0x00, 255); //clear the output buffer
846 while(i < DOLlen)
847 {
848 //length of DOL tag
849 if((*(DOL+i) & 0x1F) == 0x1F)
850 { scannedtaglen = 2;}
851 else
852 {scannedtaglen=1;}
853 memcpy(scannedtag, DOL+i,scannedtaglen);
854 //look up tag value and copy
855 //Dbhexdump(2,scannedtag,false);
856 emv_lookuptag(scannedtag,currentcard,&(DOLoutputbuffer[DOLcounter]),&retrievedtagvallen);
857 DOLcounter += (uint8_t)DOL[i+scannedtaglen];
858 i += scannedtaglen + 1;
859 memset(scannedtag, 0x00, 2); //clear current tag
860
861 }
862 memcpy(DOLoutput, DOLoutputbuffer, DOLcounter);
863 *DOLoutputlen = DOLcounter;
864 return 0;
865 }
866
867
868 //decode the tag inputted and fill in the supplied structure. clean up the cleanup_passpass function
869 int emv_emvtags_decode_tag(tlvtag* inputtag, emvcard* currentcard)
870 {
871 if(!inputtag || !currentcard) {
872 return 1;
873 }
874 //scan decoded tag
875 if(*(inputtag->tag) == 0x5F) {
876 if(*(inputtag->tag+1) == 0x20){
877 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F20)))
878 return 1;
879 memcpy(currentcard->tag_5F20, inputtag->value, inputtag->valuelength);
880 currentcard->tag_5F20_len = inputtag->valuelength;
881 }
882 if(*(inputtag->tag+1) == 0x24){
883 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F24)))
884 return 1;
885 memcpy(currentcard->tag_5F24, inputtag->value, sizeof(currentcard->tag_5F24));}
886 if(*(inputtag->tag+1) == 0x25){
887 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F25)))
888 return 1;
889 memcpy(currentcard->tag_5F25, inputtag->value, inputtag->valuelength);}
890 if(*(inputtag->tag+1) == 0x28){
891 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F28)))
892 return 1;
893 memcpy(currentcard->tag_5F28, inputtag->value, inputtag->valuelength);}
894 if(*(inputtag->tag+1) == 0x2A){
895 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F2A)))
896 return 1;
897 memcpy(currentcard->tag_5F2A, inputtag->value, inputtag->valuelength);}
898 if(*(inputtag->tag+1) == 0x2D){
899 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F2D)))
900 return 1;
901 memcpy(currentcard->tag_5F2D, inputtag->value, inputtag->valuelength);
902 currentcard->tag_5F2D_len = inputtag->valuelength;}
903 if(*(inputtag->tag+1) == 0x30){
904 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F30)))
905 return 1;
906 memcpy(currentcard->tag_5F30, inputtag->value, inputtag->valuelength);}
907 if(*(inputtag->tag+1) == 0x34){
908 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F34)))
909 return 1;
910 memcpy(currentcard->tag_5F34, inputtag->value, sizeof(currentcard->tag_5F34));}
911 if(*(inputtag->tag+1) == 0x36){
912 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F36)))
913 return 1;
914 memcpy(currentcard->tag_5F36, inputtag->value, sizeof(currentcard->tag_5F36));}
915 if(*(inputtag->tag+1) == 0x50){
916 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F50)))
917 return 1;
918 memcpy(currentcard->tag_5F50, inputtag->value, inputtag->valuelength);
919 currentcard->tag_5F50_len = inputtag->valuelength;}
920 if(*(inputtag->tag+1) == 0x54){
921 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F54)))
922 return 1;
923 memcpy(currentcard->tag_5F54, inputtag->value, inputtag->valuelength);
924 currentcard->tag_5F54_len = inputtag->valuelength;}
925 }
926 if(*(inputtag->tag) == 0x9F){
927 if(*(inputtag->tag+1) == 0x01){
928 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F01)))
929 return 1;
930 memcpy(currentcard->tag_9F01, inputtag->value, inputtag->valuelength);}
931 if(*(inputtag->tag+1) == 0x02){
932 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F02)))
933 return 1;
934 memcpy(currentcard->tag_9F02, inputtag->value, inputtag->valuelength);}
935 if(*(inputtag->tag+1) == 0x03){
936 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F03)))
937 return 1;
938 memcpy(currentcard->tag_9F03, inputtag->value, inputtag->valuelength);}
939 if(*(inputtag->tag+1) == 0x04){
940 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F04)))
941 return 1;
942 memcpy(currentcard->tag_9F04, inputtag->value, inputtag->valuelength);}
943 if(*(inputtag->tag+1) == 0x05){
944 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F05)))
945 return 1;
946 memcpy(currentcard->tag_9F05, inputtag->value, inputtag->valuelength);
947 currentcard->tag_9F05_len = inputtag->valuelength;}
948 if(*(inputtag->tag+1) == 0x06){
949 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F06)))
950 return 1;
951 memcpy(currentcard->tag_9F06, inputtag->value, inputtag->valuelength);
952 currentcard->tag_9F06_len = inputtag->valuelength;}
953 if(*(inputtag->tag+1) == 0x07){
954 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F07)))
955 return 1;
956 memcpy(currentcard->tag_9F07, inputtag->value, inputtag->valuelength);}
957 if(*(inputtag->tag+1) == 0x08){
958 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F08)))
959 return 1;
960 memcpy(currentcard->tag_9F08, inputtag->value, inputtag->valuelength);}
961 if(*(inputtag->tag+1) == 0x09){
962 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F09)))
963 return 1;
964 memcpy(currentcard->tag_9F09, inputtag->value, inputtag->valuelength);}
965 if(*(inputtag->tag+1) == 0x0B){
966 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F0B)))
967 return 1;
968 memcpy(currentcard->tag_9F0B, inputtag->value, inputtag->valuelength);
969 currentcard->tag_9F0B_len = inputtag->valuelength;}
970 if(*(inputtag->tag+1) == 0x0D){
971 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F0D)))
972 return 1;
973 memcpy(currentcard->tag_9F0D, inputtag->value, inputtag->valuelength);}
974 if(*(inputtag->tag+1) == 0x0E){
975 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F0E)))
976 return 1;
977 memcpy(currentcard->tag_9F0E, inputtag->value, inputtag->valuelength);}
978 if(*(inputtag->tag+1) == 0x0F){
979 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F0F)))
980 return 1;
981 memcpy(currentcard->tag_9F0F, inputtag->value, inputtag->valuelength);}
982 if(*(inputtag->tag+1) == 0x11){
983 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F11)))
984 return 1;
985 memcpy(currentcard->tag_9F11, inputtag->value, inputtag->valuelength);}
986 if(*(inputtag->tag+1) == 0x12){
987 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F12)))
988 return 1;
989 memcpy(currentcard->tag_9F12, inputtag->value, inputtag->valuelength);
990 currentcard->tag_9F12_len = inputtag->valuelength;}
991 if(*(inputtag->tag+1) == 0x13){
992 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F13)))
993 return 1;
994 memcpy(currentcard->tag_9F13, inputtag->value, inputtag->valuelength);}
995 if(*(inputtag->tag+1) == 0x14){
996 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F14)))
997 return 1;
998 memcpy(currentcard->tag_9F14, inputtag->value, inputtag->valuelength);}
999 if(*(inputtag->tag+1) == 0x15){
1000 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F15)))
1001 return 1;
1002 memcpy(currentcard->tag_9F15, inputtag->value, inputtag->valuelength);}
1003 if(*(inputtag->tag+1) == 0x16){
1004 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F16)))
1005 return 1;
1006 memcpy(currentcard->tag_9F16, inputtag->value, inputtag->valuelength);}
1007 if(*(inputtag->tag+1) == 0x17){
1008 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F17)))
1009 return 1;
1010 memcpy(currentcard->tag_9F17, inputtag->value, inputtag->valuelength);}
1011 if(*(inputtag->tag+1) == 0x18){
1012 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F18)))
1013 return 1;
1014 memcpy(currentcard->tag_9F18, inputtag->value, inputtag->valuelength);}
1015 if(*(inputtag->tag+1) == 0x1A){
1016 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F1A)))
1017 return 1;
1018 memcpy(currentcard->tag_9F1A, inputtag->value, inputtag->valuelength);}
1019 if(*(inputtag->tag+1) == 0x1B){
1020 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F1B)))
1021 return 1;
1022 memcpy(currentcard->tag_9F1B, inputtag->value, inputtag->valuelength);}
1023 if(*(inputtag->tag+1) == 0x1C){
1024 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F1C)))
1025 return 1;
1026 memcpy(currentcard->tag_9F1C, inputtag->value, inputtag->valuelength);}
1027 if(*(inputtag->tag+1) == 0x1D){
1028 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F1D)))
1029 return 1;
1030 memcpy(currentcard->tag_9F1D, inputtag->value, inputtag->valuelength);
1031 currentcard->tag_9F1D_len = inputtag->valuelength;}
1032 if(*(inputtag->tag+1) == 0x1E){
1033 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F1E)))
1034 return 1;
1035 memcpy(currentcard->tag_9F1E, inputtag->value, inputtag->valuelength);}
1036 if(*(inputtag->tag+1) == 0x1F){
1037 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F1F)))
1038 return 1;
1039 memcpy(currentcard->tag_9F1F, inputtag->value, inputtag->valuelength);
1040 currentcard->tag_9F1F_len = inputtag->valuelength;}
1041 if(*(inputtag->tag+1) == 0x32){
1042 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F32)))
1043 return 1;
1044 currentcard->tag_9F32_len = inputtag->valuelength;
1045 memcpy(currentcard->tag_9F32, inputtag->value, inputtag->valuelength);
1046 }
1047 if(*(inputtag->tag+1) == 0x34){
1048 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F34)))
1049 return 1;
1050 memcpy(currentcard->tag_9F34, inputtag->value, inputtag->valuelength);}
1051 if(*(inputtag->tag+1) == 0x35){
1052 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F35)))
1053 return 1;
1054 memcpy(currentcard->tag_9F35, inputtag->value, inputtag->valuelength);}
1055 if(*(inputtag->tag+1) == 0x37){
1056 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F37)))
1057 return 1;
1058 memcpy(currentcard->tag_9F37, inputtag->value, inputtag->valuelength);}
1059 if(*(inputtag->tag+1) == 0x38){
1060 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F38)))
1061 return 1;
1062 memcpy(currentcard->tag_9F38, inputtag->value, inputtag->valuelength);
1063 currentcard->tag_9F38_len = inputtag->valuelength;}
1064 if(*(inputtag->tag+1) == 0x44){
1065 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F44)))
1066 return 1;
1067 memcpy(currentcard->tag_9F44, inputtag->value, inputtag->valuelength);}
1068 if(*(inputtag->tag+1) == 0x45){
1069 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F45)))
1070 return 1;
1071 memcpy(currentcard->tag_9F45, inputtag->value, inputtag->valuelength);}
1072 if(*(inputtag->tag+1) == 0x46){
1073 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F46)))
1074 return 1;
1075 memcpy(currentcard->tag_9F46, inputtag->value, inputtag->valuelength);
1076 currentcard->tag_9F46_len = inputtag->valuelength;}
1077 if(*(inputtag->tag+1) == 0x47){
1078 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F47)))
1079 return 1;
1080 memcpy(currentcard->tag_9F47, inputtag->value, inputtag->valuelength);
1081 currentcard->tag_9F47_len = inputtag->valuelength;}
1082 if(*(inputtag->tag+1) == 0x48){
1083 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F48)))
1084 return 1;
1085 memcpy(currentcard->tag_9F48, inputtag->value, inputtag->valuelength);
1086 currentcard->tag_9F48_len = inputtag->valuelength;}
1087 if(*(inputtag->tag+1) == 0x49){
1088 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F49)))
1089 return 1;
1090 memcpy(currentcard->tag_9F49, inputtag->value, inputtag->valuelength);
1091 currentcard->tag_9F49_len = inputtag->valuelength;}
1092 if(*(inputtag->tag+1) == 0x4A){
1093 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F4A)))
1094 return 1;
1095 memcpy(currentcard->tag_9F4A, inputtag->value, inputtag->valuelength);}
1096 if(*(inputtag->tag+1) == 0x4B){
1097 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F4B)))
1098 return 1;
1099 memcpy(currentcard->tag_9F4B, inputtag->value, inputtag->valuelength);
1100 currentcard->tag_9F4B_len = inputtag->valuelength;}
1101 if(*(inputtag->tag+1) == 0x4C){
1102 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F4C)))
1103 return 1;
1104 memcpy(currentcard->tag_9F4C, inputtag->value, inputtag->valuelength);}
1105 if(*(inputtag->tag+1) == 0x60){
1106 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F60)))
1107 return 1;
1108 memcpy(currentcard->tag_9F60, inputtag->value, inputtag->valuelength);}
1109 if(*(inputtag->tag+1) == 0x61){
1110 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F61)))
1111 return 1;
1112 memcpy(currentcard->tag_9F61, inputtag->value, inputtag->valuelength);}
1113 if(*(inputtag->tag+1) == 0x62){
1114 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F62)))
1115 return 1;
1116 memcpy(currentcard->tag_9F62, inputtag->value, inputtag->valuelength);}
1117 if(*(inputtag->tag+1) == 0x63){
1118 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F63)))
1119 return 1;
1120 memcpy(currentcard->tag_9F63, inputtag->value, inputtag->valuelength);}
1121 if(*(inputtag->tag+1) == 0x64){
1122 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F64)))
1123 return 1;
1124 memcpy(currentcard->tag_9F64, inputtag->value, inputtag->valuelength);}
1125 if(*(inputtag->tag+1) == 0x65){
1126 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F65)))
1127 return 1;
1128 memcpy(currentcard->tag_9F65, inputtag->value, inputtag->valuelength);}
1129 if(*(inputtag->tag+1) == 0x66){
1130 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F66)))
1131 return 1;
1132 memcpy(currentcard->tag_9F66, inputtag->value, inputtag->valuelength);}
1133 if(*(inputtag->tag+1) == 0x67){
1134 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F67)))
1135 return 1;
1136 memcpy(currentcard->tag_9F67, inputtag->value, inputtag->valuelength);}
1137 if(*(inputtag->tag+1) == 0x68){
1138 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F68)))
1139 return 1;
1140 memcpy(currentcard->tag_9F68, inputtag->value, inputtag->valuelength);
1141 currentcard->tag_9F68_len = inputtag->valuelength;}
1142 if(*(inputtag->tag+1) == 0x69){
1143 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F69)))
1144 return 1;
1145 memcpy(currentcard->tag_9F69, inputtag->value, inputtag->valuelength);
1146 currentcard->tag_9F69_len = inputtag->valuelength;}
1147 if(*(inputtag->tag+1) == 0x6A){
1148 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F6A)))
1149 return 1;
1150 memcpy(currentcard->tag_9F6A, inputtag->value, inputtag->valuelength);}
1151 if(*(inputtag->tag+1) == 0x6B){
1152 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F6B)))
1153 return 1;
1154 memcpy(currentcard->tag_9F6B, inputtag->value, inputtag->valuelength);
1155 currentcard->tag_9F6B_len = inputtag->valuelength;}
1156 if(*(inputtag->tag+1) == 0x6C){
1157 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F6C)))
1158 return 1;
1159 memcpy(currentcard->tag_9F6C, inputtag->value, inputtag->valuelength);}
1160 }
1161 else
1162 {
1163 if(*(inputtag->tag) == 0xBF){ //BF0C
1164 if(*(inputtag->tag+1) == 0x0C){
1165 if(!(inputtag->valuelength <= sizeof(currentcard->tag_BF0C)))
1166 return 1;
1167 memcpy(currentcard->tag_BF0C, inputtag->value, inputtag->valuelength);
1168 currentcard->tag_BF0C_len = inputtag->valuelength;}
1169 }
1170 else if(*(inputtag->tag) == 0x4F){ //BF0C
1171 if(!(inputtag->valuelength <= sizeof(currentcard->tag_4F)))
1172 return 1;
1173 memcpy(currentcard->tag_4F, inputtag->value, inputtag->valuelength);
1174 currentcard->tag_4F_len = inputtag->valuelength;}
1175 else if(*(inputtag->tag) == 0x50){ //BF0C
1176 if(!(inputtag->valuelength <= sizeof(currentcard->tag_50)))
1177 return 1;
1178 memcpy(currentcard->tag_50, inputtag->value, inputtag->valuelength);
1179 currentcard->tag_50_len = inputtag->valuelength;
1180 }
1181 else if(*(inputtag->tag) == 0x56){ //BF0C
1182 if(!(inputtag->valuelength <= sizeof(currentcard->tag_56)))
1183 return 1;
1184 memcpy(currentcard->tag_56, inputtag->value, inputtag->valuelength);
1185 currentcard->tag_56_len = inputtag->valuelength;
1186 }
1187 else if(*(inputtag->tag) == 0x57){ //BF0C
1188 if(!(inputtag->valuelength <= sizeof(currentcard->tag_57)))
1189 return 1;
1190 memcpy(currentcard->tag_57, inputtag->value, inputtag->valuelength);
1191 currentcard->tag_57_len = inputtag->valuelength;
1192 }
1193 else if(*(inputtag->tag) == 0x5A){ //BF0C
1194 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5A)))
1195 return 1;
1196 memcpy(currentcard->tag_5A, inputtag->value, inputtag->valuelength);
1197 currentcard->tag_5A_len = inputtag->valuelength;}
1198 else if(*(inputtag->tag) == 0x61){ //BF0C
1199 if(!(inputtag->valuelength <= sizeof(currentcard->tag_61)))
1200 return 1;
1201 memcpy(currentcard->tag_61, inputtag->value, inputtag->valuelength);
1202 currentcard->tag_61_len = inputtag->valuelength;
1203 }
1204 else if(*(inputtag->tag) == 0x6F){ //BF0C
1205 memcpy(currentcard->tag_6F,inputtag->value,inputtag->valuelength);}
1206
1207 else if(*(inputtag->tag) == 0x70){ //BF0C
1208 memcpy(currentcard->tag_70,inputtag->value,inputtag->valuelength);}
1209 else if(*(inputtag->tag) == 0x77){ //BF0C
1210 memcpy(currentcard->tag_77,inputtag->value,inputtag->valuelength);}
1211 else if(*(inputtag->tag) == 0x80){ //BF0C
1212 memcpy(currentcard->tag_80,inputtag->value,inputtag->valuelength);}
1213 else if(*(inputtag->tag) == 0x82){ //BF0C
1214 if(!(inputtag->valuelength <= sizeof(currentcard->tag_82)))
1215 return 1;
1216 memcpy(currentcard->tag_82, inputtag->value, inputtag->valuelength);}
1217 else if(*(inputtag->tag) == 0x84){ //BF0C
1218 if(!(inputtag->valuelength <= sizeof(currentcard->tag_84)))
1219 return 1;
1220 memcpy(currentcard->tag_84, inputtag->value, inputtag->valuelength);
1221 currentcard->tag_84_len = inputtag->valuelength;
1222 }
1223 else if(*(inputtag->tag) == 0x86){ //BF0C
1224 if(!(inputtag->valuelength <= sizeof(currentcard->tag_86)))
1225 return 1;
1226 memcpy(currentcard->tag_86, inputtag->value, inputtag->valuelength);
1227 currentcard->tag_86_len = inputtag->valuelength;
1228 }
1229 else if(*(inputtag->tag) == 0x87){ //BF0C
1230 if(!(inputtag->valuelength <= sizeof(currentcard->tag_87)))
1231 return 1;
1232 memcpy(currentcard->tag_87, inputtag->value, inputtag->valuelength);}
1233 else if(*(inputtag->tag) == 0x88){ //BF0C
1234 if(!(inputtag->valuelength <= sizeof(currentcard->tag_88)))
1235 return 1;
1236 memcpy(currentcard->tag_88, inputtag->value, inputtag->valuelength);}
1237 else if(*(inputtag->tag) == 0x8A){ //BF0C
1238 if(!(inputtag->valuelength <= sizeof(currentcard->tag_8A)))
1239 return 1;
1240 memcpy(currentcard->tag_8A, inputtag->value, inputtag->valuelength);}
1241 else if(*(inputtag->tag) == 0x8C){ //BF0C
1242 if(!(inputtag->valuelength <= sizeof(currentcard->tag_8C)))
1243 return 1;
1244 memcpy(currentcard->tag_8C, inputtag->value, inputtag->valuelength);
1245 currentcard->tag_8C_len = inputtag->valuelength;
1246 }
1247 else if(*(inputtag->tag) == 0x8D){ //BF0C
1248 if(!(inputtag->valuelength <= sizeof(currentcard->tag_8D)))
1249 return 1;
1250 memcpy(currentcard->tag_8D, inputtag->value, inputtag->valuelength);
1251 currentcard->tag_8D_len = inputtag->valuelength;
1252 }
1253 else if(*(inputtag->tag) == 0x8E){ //BF0C
1254 if(!(inputtag->valuelength <= sizeof(currentcard->tag_8E)))
1255 return 1;
1256 memcpy(currentcard->tag_8E, inputtag->value, inputtag->valuelength);
1257 currentcard->tag_8E_len = inputtag->valuelength;
1258 }
1259 else if(*(inputtag->tag) == 0x8F){ //BF0C
1260 if(!(inputtag->valuelength <= sizeof(currentcard->tag_8F)))
1261 return 1;
1262 memcpy(currentcard->tag_8F,inputtag->value,sizeof(currentcard->tag_8F));}
1263 else if(*(inputtag->tag) == 0x90){ //BF0C
1264 if(!(inputtag->valuelength <= sizeof(currentcard->tag_90)))
1265 return 1;
1266 memcpy(currentcard->tag_90, inputtag->value, inputtag->valuelength);
1267 currentcard->tag_90_len = inputtag->valuelength;}
1268 else if(*(inputtag->tag) == 0x92){ //BF0C
1269 if(!(inputtag->valuelength <= sizeof(currentcard->tag_92)))
1270 return 1;
1271 memcpy(currentcard->tag_92, inputtag->value, inputtag->valuelength);
1272 currentcard->tag_92_len = inputtag->valuelength;}
1273 else if(*(inputtag->tag) == 0x93){ //BF0C
1274 if(!(inputtag->valuelength <= sizeof(currentcard->tag_93)))
1275 return 1;
1276 memcpy(currentcard->tag_93, inputtag->value, inputtag->valuelength);
1277 currentcard->tag_93_len = inputtag->valuelength;}
1278 else if(*(inputtag->tag) == 0x94){ //BF0C
1279 if(!(inputtag->valuelength <= sizeof(currentcard->tag_94)))
1280 return 1;
1281 memcpy(currentcard->tag_94, inputtag->value, inputtag->valuelength);
1282 currentcard->tag_94_len = inputtag->valuelength;}
1283 else if(*(inputtag->tag) == 0x95){ //BF0C
1284 if(!(inputtag->valuelength <= sizeof(currentcard->tag_95)))
1285 return 1;
1286 memcpy(currentcard->tag_95, inputtag->value, inputtag->valuelength);}
1287 else if(*(inputtag->tag) == 0x97){ //BF0C
1288 if(!(inputtag->valuelength <= sizeof(currentcard->tag_97)))
1289 return 1;
1290 memcpy(currentcard->tag_97, inputtag->value, inputtag->valuelength);
1291 currentcard->tag_97_len = inputtag->valuelength;}
1292 else if(*(inputtag->tag) == 0x98){ //BF0C
1293 if(!(inputtag->valuelength <= sizeof(currentcard->tag_98)))
1294 return 1;
1295 memcpy(currentcard->tag_98, inputtag->value, inputtag->valuelength);}
1296 else if(*(inputtag->tag) == 0x99){ //BF0C
1297 if(!(inputtag->valuelength <= sizeof(currentcard->tag_99)))
1298 return 1;
1299 memcpy(currentcard->tag_99, inputtag->value, inputtag->valuelength);
1300 currentcard->tag_99_len = inputtag->valuelength;}
1301 else if(*(inputtag->tag) == 0x9A){ //BF0C
1302 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9A)))
1303 return 1;
1304 memcpy(currentcard->tag_9A, inputtag->value, inputtag->valuelength);}
1305 else if(*(inputtag->tag) == 0x9B){ //BF0C
1306 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9B)))
1307 return 1;
1308 memcpy(currentcard->tag_9B, inputtag->value, inputtag->valuelength);}
1309 else if(*(inputtag->tag) == 0x9C){ //BF0C
1310 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9C)))
1311 return 1;
1312 memcpy(currentcard->tag_9C, inputtag->value, inputtag->valuelength);}
1313 else if(*(inputtag->tag) == 0x9D){ //BF0C
1314 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9D)))
1315 return 1;
1316 memcpy(currentcard->tag_9D, inputtag->value, inputtag->valuelength);
1317 currentcard->tag_9D_len = inputtag->valuelength;}
1318 else if(*(inputtag->tag) == 0xA5){ //BF0C
1319 if(!(inputtag->valuelength <= sizeof(currentcard->tag_A5)))
1320 return 1;
1321 memcpy(currentcard->tag_A5, inputtag->value, inputtag->valuelength);
1322 currentcard->tag_A5_len = inputtag->valuelength;}
1323 }
1324 return 0;
1325 }
1326
1327 int emv_decode_field(uint8_t* inputfield,uint16_t inputlength, emvcard *result)
1328 {
1329 uint16_t lengthcounter=0;
1330 tlvtag newtag;
1331 //copy result to the testtag
1332 if(!result){
1333 return 1;
1334 }
1335 //loop through and decode template
1336 while(lengthcounter < inputlength)
1337 {
1338 //decode the tlv tag
1339 decode_ber_tlv_item((inputfield+lengthcounter),&newtag);
1340 //write the emvcard strucutre
1341 emv_emvtags_decode_tag(&newtag,result);
1342 //move to next value and decode
1343 lengthcounter += newtag.fieldlength-1;
1344 }
1345 return 0;
1346 }
1347
1348 int emv_select(uint8_t* AID, uint8_t AID_len, void* data)
1349 {
1350 uint16_t selectCmd_len = 4 + 1 + AID_len + 1;
1351 uint8_t selectCmd[selectCmd_len];
1352
1353 selectCmd[0] = 0x00;
1354 selectCmd[1] = 0xA4;
1355 selectCmd[2] = 0x04;
1356 selectCmd[3] = 0x00;
1357 selectCmd[4] = AID_len;
1358 memcpy(&(selectCmd[5]), AID, AID_len);
1359 selectCmd[selectCmd_len-1] = 0x00;
1360 return iso14_apdu(selectCmd, selectCmd_len, data);
1361 }
1362
1363 //perform READ RECORD
1364 int emv_readrecord(uint8_t recordnumber, uint8_t sfi, void* data)
1365 {
1366 uint16_t readRecordCmd_len = 5;
1367 uint8_t readRecordCmd[readRecordCmd_len];
1368 readRecordCmd[0] = 0x00;
1369 readRecordCmd[1] = 0xB2;
1370 readRecordCmd[2] = recordnumber;
1371 readRecordCmd[3] = ((sfi << 3) | 0x04);
1372 readRecordCmd[4] = 0x00;
1373 return iso14_apdu(readRecordCmd, readRecordCmd_len, data);
1374 }
1375
1376 int emv_getprocessingoptions(uint8_t* pdol, uint8_t pdol_len, void* data)
1377 {
1378 uint16_t processingCmd_len = 4 + 1 + 2 + pdol_len + 1;
1379 uint8_t processingCmd[processingCmd_len];
1380 processingCmd[0] = 0x80;
1381 processingCmd[1] = 0xA8;
1382 processingCmd[2] = 0x00;
1383 processingCmd[3] = 0x00;
1384 processingCmd[4] = pdol_len + 2;
1385 processingCmd[5] = 0x83; //template
1386 processingCmd[6] = pdol_len;
1387 if(pdol_len > 0){
1388 memcpy(&(processingCmd[7]), pdol, pdol_len);}
1389 processingCmd[processingCmd_len-1] = 0x00;
1390 return iso14_apdu(processingCmd, processingCmd_len, data);
1391 }
1392
1393 int emv_computecryptogram(uint8_t* UDOL, uint8_t UDOL_len, void *data)
1394 {
1395 uint16_t cryptogramCmd_len = 4 + 1 + UDOL_len + 1;
1396 uint8_t cryptogramCmd[cryptogramCmd_len];
1397 cryptogramCmd[0] = 0x80;
1398 cryptogramCmd[1] = 0x2A;
1399 cryptogramCmd[2] = 0x8E;
1400 cryptogramCmd[3] = 0x80;
1401 cryptogramCmd[4] = UDOL_len;
1402 memcpy(&(cryptogramCmd[5]), UDOL, UDOL_len);
1403 cryptogramCmd[cryptogramCmd_len-1] = 0x00;
1404 return iso14_apdu(cryptogramCmd, cryptogramCmd_len, data);
1405 }
1406
1407 int emv_getchallenge(void *data)
1408 {
1409 uint16_t challengeCmd_len = 5;
1410 uint8_t challengeCmd[challengeCmd_len];
1411 challengeCmd[0] = 0x00;
1412 challengeCmd[1] = 0x84;
1413 challengeCmd[2] = 0x00;
1414 challengeCmd[3] = 0x00;
1415 challengeCmd[4] = 0x00;
1416 return iso14_apdu(challengeCmd, challengeCmd_len, data);
1417 }
1418
1419 int emv_loopback(uint8_t* transData , uint8_t transData_len, void *data)
1420 {
1421 uint16_t loopbackCmd_len = 4 + 1 + transData_len + 1;
1422 uint8_t loopbackCmd[loopbackCmd_len];
1423 loopbackCmd[0] = 0x00;
1424 loopbackCmd[1] = 0xEE;
1425 loopbackCmd[2] = 0x00;
1426 loopbackCmd[3] = 0x00;
1427 loopbackCmd[4] = loopbackCmd_len;
1428 memcpy(&(loopbackCmd[5]), transData, transData_len);
1429 return iso14_apdu(loopbackCmd, loopbackCmd_len, data);
1430 }
1431
1432 //generateAC
1433 int emv_generateAC(uint8_t refcontrolparam, uint8_t* cdolinput, uint8_t cdolinputlen, void* data)
1434 {
1435 uint16_t acCmd_len = 4 + 1 + cdolinputlen + 1;
1436 uint8_t acCmd[acCmd_len];
1437 acCmd[0] = 0x80;
1438 acCmd[1] = 0xAE;
1439 acCmd[2] = refcontrolparam;
1440 acCmd[3] = 0x00;
1441 acCmd[4] = cdolinputlen;
1442 memcpy(&(acCmd[5]), cdolinput, cdolinputlen);
1443 acCmd[acCmd_len-1] = 0x00;
1444 Dbhexdump(acCmd_len, acCmd,false);
1445 return iso14_apdu(acCmd, acCmd_len, data);
1446 }
1447
1448 int emv_decodeAFL(uint8_t* AFL, uint8_t AFLlen ){
1449 return 0;
1450 }
1451
1452 //ICEMAN: move to client
1453 //Print out AIP Bit meanings
1454 int emv_decodeAIP(uint8_t* AIP)
1455 {
1456 if ((AIP[0] & AIP_SDA_SUPPORTED) == AIP_SDA_SUPPORTED) Dbprintf("SDA supported");
1457 if ((AIP[0] & AIP_DDA_SUPPORTED) == AIP_DDA_SUPPORTED) Dbprintf("DDA supported");
1458 if ((AIP[0] & AIP_CARDHOLDER_VERIFICATION) == AIP_CARDHOLDER_VERIFICATION) Dbprintf("Cardholder verification is supported");
1459 if ((AIP[0] & AIP_TERMINAL_RISK) == AIP_TERMINAL_RISK) Dbprintf("Terminal risk management is to be performed");
1460 if ((AIP[0] & AIP_ISSUER_AUTH) == AIP_ISSUER_AUTH) Dbprintf("Issuer authentication is supported ");
1461 if ((AIP[0] & AIP_CDA_SUPPORTED) == AIP_CDA_SUPPORTED) Dbprintf("CDA supported");
1462 if ((AIP[1] & AIP_CHIP_SUPPORTED) == AIP_CHIP_SUPPORTED) Dbprintf("Chip supported");
1463 if ((AIP[1] & AIP_MSR_SUPPORTED) == AIP_MSR_SUPPORTED) Dbprintf("MSR supported");
1464 return 0;
1465 }
1466
1467 //ICEMAN: move to client
1468 int emv_decodeCVM(uint8_t* CVM, uint8_t CVMlen)
1469 {
1470 uint8_t counter = 0;
1471 uint32_t amountX = 0;
1472 uint32_t amountY = 0;
1473 amountX = bytes_to_num(CVM, 4);
1474 amountY = bytes_to_num(CVM+4, 4);
1475 counter +=8;
1476 while (counter < CVMlen)
1477 {
1478 if ((CVM[counter] & 0x40) == 0x40){
1479 if ((CVM[counter] & 0x3F)== 0x00){ Dbprintf("Fail CVM processing");}
1480 if ((CVM[counter] & 0x3F) == 0x01){ Dbprintf("Plaintext PIN verification performed by ICC");}
1481 if ((CVM[counter] & 0x3F) == 0x02){ Dbprintf("Enciphered PIN verified online");}
1482 if ((CVM[counter] & 0x3F) == 0x03){ Dbprintf("Plaintext PIN verification performed by ICC and signature (paper)");}
1483 if ((CVM[counter] & 0x3F) == 0x04){ Dbprintf("Enciphered PIN verification performed by ICC");}
1484 if ((CVM[counter] & 0x3F) == 0x05){ Dbprintf("Enciphered PIN verification performed by ICC and signature (paper)");}
1485 if ((CVM[counter] & 0x3F) == 0x30){ Dbprintf("Signature (paper)");}
1486 // iceman, wrong masked used? changed from 0x3f -> 0x7f
1487 if ((CVM[counter] & 0x7F) == 0x40){ Dbprintf("No CVM required");}
1488 counter +=2;
1489 } else {
1490 Dbprintf("Fail cardholder verification if this CVM is unsuccessful");
1491 counter +=2;
1492 }
1493 if (CVM[counter+1] == 0x00){ Dbprintf("Always");}
1494 if (CVM[counter+1] == 0x01){ Dbprintf("If unattended cash");}
1495 if (CVM[counter+1] == 0x02){ Dbprintf("If not unattended cash and not manual cash and not purchase with cashback");}
1496 if (CVM[counter+1] == 0x03){ Dbprintf("If terminal supports the CVM");}
1497 if (CVM[counter+1] == 0x04){ Dbprintf("If manual cash");}
1498 if (CVM[counter+1] == 0x05){ Dbprintf("If purchase with cashback");}
1499 if (CVM[counter+1] == 0x06){ Dbprintf("If transaction is in the application currency and is under %" PRIu32 " value", amountX);}
1500 if (CVM[counter+1] == 0x07){ Dbprintf("If transaction is in the application currency and is over %" PRIu32 " value", amountX);}
1501 if (CVM[counter+1] == 0x08){ Dbprintf("If transaction is in the application currency and is under %" PRIu32 " value", amountY);}
1502 if (CVM[counter+1] == 0x09){ Dbprintf("If transaction is in the application currency and is over %" PRIu32 " value", amountY);}
1503 }
1504 return 0;
1505 }
1506 //simulate a emvcard card
1507 //input is a structure containing values to simulate
1508 //clones an EMV card
1509 void emvsnoop() {
1510 //states
1511 int cardSTATE = EMVEMUL_NOFIELD;
1512 int vHf = 0;
1513 int res;
1514 uint16_t len = 0;
1515 uint8_t* receivedCmd = BigBuf_malloc(MAX_MIFARE_FRAME_SIZE);
1516 uint8_t par[MAX_MIFARE_PARITY_SIZE] = {0x00};
1517 uint8_t rATQA[] = {0x04,0x00};
1518 uint8_t rUIDBCC[] = {0x8F,0x2F,0x27,0xE1, 0x66};
1519 uint8_t rSAK[] = {0x28, 0xB4, 0xFC};
1520
1521 iso14443a_setup(FPGA_HF_ISO14443A_TAGSIM_LISTEN);
1522 bool finished = FALSE;
1523
1524 while (!BUTTON_PRESS() && !finished){
1525 WDT_HIT();
1526 //find reader field
1527 if(cardSTATE == EMVEMUL_NOFIELD){
1528 vHf = (33000 * AvgAdc(ADC_CHAN_HF)) >> 10;
1529 if(vHf > EMV_MINFIELDV){
1530 cardSTATE_TO_IDLE();
1531 LED_A_ON();
1532 }
1533 }
1534 if(cardSTATE == EMVEMUL_NOFIELD) continue;
1535
1536 //get data
1537
1538 res = EmGetCmd(receivedCmd, &len, par);
1539 if(res == 2) { //field is off
1540 cardSTATE = EMVEMUL_NOFIELD;
1541 LEDsoff();
1542 continue;
1543 }
1544 else if(res==1){
1545 break; // button press
1546 }
1547
1548 if(len==1 && ((receivedCmd[0] == 0x26 && cardSTATE != EMVEMUL_HALTED) || receivedCmd[0] == 0x52)){
1549 EmSendCmdEx(rATQA, sizeof(rATQA), (receivedCmd[0] == 0x52));
1550 cardSTATE = EMVEMUL_SELECT1;
1551 continue;
1552 }
1553 switch(cardSTATE){
1554 case EMVEMUL_NOFIELD:
1555 case EMVEMUL_HALTED:
1556 case EMVEMUL_IDLE:{
1557 break;
1558 }
1559 case EMVEMUL_SELECT1:{
1560 //select all
1561 if(len==2 && (receivedCmd[0] == 0x93 && receivedCmd[1] == 0x20)) {
1562 EmSendCmd(rUIDBCC, sizeof(rUIDBCC));
1563 break;
1564 }
1565 if(len==2 && (receivedCmd[0] == 0x93 && receivedCmd[1] == 0x70 && memcmp(&receivedCmd[2], rUIDBCC, 4) == 0)) {
1566 EmSendCmd(rSAK, sizeof(rSAK));
1567 break;
1568 }
1569 }
1570 }
1571 }
1572 FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
1573 LEDsoff();
1574 }
1575
1576 //ICEMAN: move to client
1577 //dump the current card to the console
1578 void dumpCard(emvcard* currentcard){
1579 DUMP(currentcard->ATQA);
1580 Dbhexdump(sizeof(currentcard->ATQA), currentcard->ATQA, false);
1581 DUMP(currentcard->UID);
1582 Dbhexdump(currentcard->UID_len, currentcard->UID, false);
1583 DUMP(currentcard->SAK);
1584 Dbhexdump(1, &currentcard->SAK, false);
1585 DUMP(currentcard->ATS);
1586 Dbhexdump(currentcard->ATS_len, currentcard->ATS, false);
1587 DUMP(currentcard->tag_4F);
1588 Dbhexdump(currentcard->tag_4F_len, currentcard->tag_4F, false);
1589 DUMP(currentcard->tag_50);
1590 Dbhexdump(currentcard->tag_50_len, currentcard->tag_50, false);
1591 DUMP(currentcard->tag_56);
1592 Dbhexdump(currentcard->tag_56_len, currentcard->tag_56, false);
1593 DUMP(currentcard->tag_57);
1594 Dbhexdump(currentcard->tag_57_len, currentcard->tag_57, false);
1595 DUMP(currentcard->tag_5A);
1596 Dbhexdump(currentcard->tag_5A_len, currentcard->tag_5A, false);
1597 DUMP(currentcard->tag_82);
1598 Dbhexdump(sizeof(currentcard->tag_82), currentcard->tag_82, false);
1599 DUMP(currentcard->tag_84);
1600 Dbhexdump(currentcard->tag_84_len, currentcard->tag_84, false);
1601 DUMP(currentcard->tag_86);
1602 Dbhexdump(currentcard->tag_86_len, currentcard->tag_86, false);
1603 DUMP(currentcard->tag_87);
1604 Dbhexdump(1, currentcard->tag_87, false);
1605 DUMP(currentcard->tag_88);
1606 Dbhexdump(1, currentcard->tag_88, false);
1607 DUMP(currentcard->tag_8A);
1608 Dbhexdump(2, currentcard->tag_8A, false);
1609 DUMP(currentcard->tag_8C);
1610 Dbhexdump(currentcard->tag_8C_len, currentcard->tag_8C, false);
1611 DUMP(currentcard->tag_8D);
1612 Dbhexdump(currentcard->tag_8D_len, currentcard->tag_8D, false);
1613 DUMP(currentcard->tag_8E);
1614 Dbhexdump(currentcard->tag_8E_len, currentcard->tag_8E, false);
1615 DUMP(currentcard->tag_8F);
1616 Dbhexdump(1, currentcard->tag_8F, false);
1617 DUMP(currentcard->tag_90);
1618 Dbhexdump(currentcard->tag_90_len, currentcard->tag_90, false);
1619 DUMP(currentcard->tag_92);
1620 Dbhexdump(currentcard->tag_92_len, currentcard->tag_92, false);
1621 DUMP(currentcard->tag_93);
1622 Dbhexdump(currentcard->tag_93_len, currentcard->tag_93, false);
1623 DUMP(currentcard->tag_94);
1624 Dbhexdump(currentcard->tag_94_len, currentcard->tag_94, false);
1625 DUMP(currentcard->tag_95);
1626 Dbhexdump(5, currentcard->tag_95, false);
1627 DUMP(currentcard->tag_97);
1628 Dbhexdump(currentcard->tag_97_len, currentcard->tag_97, false);
1629 DUMP(currentcard->tag_98);
1630 Dbhexdump(20, currentcard->tag_98, false);
1631 DUMP(currentcard->tag_99);
1632 Dbhexdump(currentcard->tag_99_len, currentcard->tag_99, false);
1633 DUMP(currentcard->tag_9A);
1634 Dbhexdump(3, currentcard->tag_9A, false);
1635 DUMP(currentcard->tag_9B);
1636 Dbhexdump(2, currentcard->tag_9B, false);
1637 DUMP(currentcard->tag_9C);
1638 Dbhexdump(1, currentcard->tag_9C, false);
1639 DUMP(currentcard->tag_9D);
1640 Dbhexdump(currentcard->tag_9D_len, currentcard->tag_9D, false);
1641 DUMP(currentcard->tag_CD);
1642 Dbhexdump(3, currentcard->tag_CD, false);
1643 DUMP(currentcard->tag_CE);
1644 Dbhexdump(3, currentcard->tag_CE, false);
1645 DUMP(currentcard->tag_CF);
1646 Dbhexdump(3, currentcard->tag_CF, false);
1647 DUMP(currentcard->tag_D7);
1648 Dbhexdump(3, currentcard->tag_D7, false);
1649 DUMP(currentcard->tag_D8);
1650 Dbhexdump(2, currentcard->tag_D8, false);
1651 DUMP(currentcard->tag_D9);
1652 Dbhexdump(currentcard->tag_D9_len, currentcard->tag_D9, false);
1653 DUMP(currentcard->tag_DA);
1654 Dbhexdump(2, currentcard->tag_DA, false);
1655 DUMP(currentcard->tag_DB);
1656 Dbhexdump(2, currentcard->tag_DB, false);
1657 DUMP(currentcard->tag_DC);
1658 Dbhexdump(2, currentcard->tag_DC, false);
1659 DUMP(currentcard->tag_DD);
1660 Dbhexdump(2, currentcard->tag_DD, false);
1661 DUMP(currentcard->tag_AF);
1662 Dbhexdump(currentcard->tag_AF_len, currentcard->tag_AF, false);
1663 DUMP(currentcard->tag_5F20);
1664 Dbhexdump(currentcard->tag_5F20_len, currentcard->tag_5F20, false);
1665 DUMP(currentcard->tag_5F24);
1666 Dbhexdump(3, currentcard->tag_5F24, false);
1667 DUMP(currentcard->tag_5F25);
1668 Dbhexdump(3, currentcard->tag_5F25, false);
1669 DUMP(currentcard->tag_5F28);
1670 Dbhexdump(2, currentcard->tag_5F28, false);
1671 DUMP(currentcard->tag_5F2A);
1672 Dbhexdump(2, currentcard->tag_5F2A, false);
1673 DUMP(currentcard->tag_5F2D);
1674 Dbhexdump(currentcard->tag_5F2D_len, currentcard->tag_5F2D, false);
1675 DUMP(currentcard->tag_5F30);
1676 Dbhexdump(3, currentcard->tag_5F30, false);
1677 DUMP(currentcard->tag_5F34);
1678 Dbhexdump(1, currentcard->tag_5F34, false);
1679 DUMP(currentcard->tag_5F36);
1680 Dbhexdump(2, currentcard->tag_5F36, false);
1681 DUMP(currentcard->tag_5F50);
1682 Dbhexdump(currentcard->tag_5F50_len, currentcard->tag_5F50, false);
1683 DUMP(currentcard->tag_5F54);
1684 Dbhexdump(currentcard->tag_5F54_len, currentcard->tag_5F54, false);
1685 DUMP(currentcard->tag_9F01);
1686 Dbhexdump(6, currentcard->tag_9F01, false);
1687 DUMP(currentcard->tag_9F02);
1688 Dbhexdump(6, currentcard->tag_9F02, false);
1689 DUMP(currentcard->tag_9F03);
1690 Dbhexdump(6, currentcard->tag_9F03, false);
1691 DUMP(currentcard->tag_9F04);
1692 Dbhexdump(4, currentcard->tag_9F04, false);
1693 DUMP(currentcard->tag_9F05);
1694 Dbhexdump(currentcard->tag_9F05_len, currentcard->tag_9F05, false);
1695 DUMP(currentcard->tag_9F06);
1696 Dbhexdump(currentcard->tag_9F06_len, currentcard->tag_9F06, false);
1697 DUMP(currentcard->tag_9F07);
1698 Dbhexdump(2, currentcard->tag_9F07, false);
1699 DUMP(currentcard->tag_9F08);
1700 Dbhexdump(2, currentcard->tag_9F08, false);
1701 DUMP(currentcard->tag_9F09);
1702 Dbhexdump(2, currentcard->tag_9F09, false);
1703 DUMP(currentcard->tag_9F0B);
1704 Dbhexdump(currentcard->tag_9F0B_len, currentcard->tag_9F0B, false);
1705 DUMP(currentcard->tag_9F0D);
1706 Dbhexdump(5, currentcard->tag_9F0D, false);
1707 DUMP(currentcard->tag_9F0E);
1708 Dbhexdump(5, currentcard->tag_9F0E, false);
1709 DUMP(currentcard->tag_9F0F);
1710 Dbhexdump(5, currentcard->tag_9F0F, false);
1711 DUMP(currentcard->tag_9F10);
1712 Dbhexdump(currentcard->tag_9F10_len, currentcard->tag_9F10, false);
1713 DUMP(currentcard->tag_9F11);
1714 Dbhexdump(1, currentcard->tag_9F11, false);
1715 DUMP(currentcard->tag_9F12);
1716 Dbhexdump(currentcard->tag_9F12_len, currentcard->tag_9F12, false);
1717 DUMP(currentcard->tag_9F13);
1718 Dbhexdump(2, currentcard->tag_9F13, false);
1719 DUMP(currentcard->tag_9F14);
1720 Dbhexdump(1, currentcard->tag_9F14, false);
1721 DUMP(currentcard->tag_9F15);
1722 Dbhexdump(2, currentcard->tag_9F15, false);
1723 DUMP(currentcard->tag_9F16);
1724 Dbhexdump(15, currentcard->tag_9F16, false);
1725 DUMP(currentcard->tag_9F17);
1726 Dbhexdump(1, currentcard->tag_9F17, false);
1727 DUMP(currentcard->tag_9F18);
1728 Dbhexdump(4, currentcard->tag_9F18, false);
1729 DUMP(currentcard->tag_9F1A);
1730 Dbhexdump(2, currentcard->tag_9F1A, false);
1731 DUMP(currentcard->tag_9F1B);
1732 Dbhexdump(4, currentcard->tag_9F1B, false);
1733 DUMP(currentcard->tag_9F1C);
1734 Dbhexdump(8, currentcard->tag_9F1C, false);
1735 DUMP(currentcard->tag_9F1D);
1736 Dbhexdump(currentcard->tag_9F1D_len, currentcard->tag_9F1D, false);
1737 DUMP(currentcard->tag_9F1E);
1738 Dbhexdump(8, currentcard->tag_9F1E, false);
1739 DUMP(currentcard->tag_9F1F);
1740 Dbhexdump(currentcard->tag_9F1F_len, currentcard->tag_9F1F, false);
1741 DUMP(currentcard->tag_9F20);
1742 Dbhexdump(currentcard->tag_9F20_len, currentcard->tag_9F20, false);
1743 DUMP(currentcard->tag_9F21);
1744 Dbhexdump(3, currentcard->tag_9F1E, false);
1745 DUMP(currentcard->tag_9F22);
1746 Dbhexdump(1, currentcard->tag_9F22, false);
1747 DUMP(currentcard->tag_9F23);
1748 Dbhexdump(1, currentcard->tag_9F23, false);
1749 DUMP(currentcard->tag_9F26);
1750 Dbhexdump(8, currentcard->tag_9F26, false);
1751 DUMP(currentcard->tag_9F27);
1752 Dbhexdump(1, currentcard->tag_9F27, false);
1753 DUMP(currentcard->tag_9F2D);
1754 Dbhexdump(currentcard->tag_9F2D_len, currentcard->tag_9F2D, false);
1755 DUMP(currentcard->tag_9F2E);
1756 Dbhexdump(3, currentcard->tag_9F2E, false);
1757 DUMP(currentcard->tag_9F2F);
1758 Dbhexdump(currentcard->tag_9F2F_len, currentcard->tag_9F2F, false);
1759 DUMP(currentcard->tag_9F32);
1760 Dbhexdump(currentcard->tag_9F32_len, currentcard->tag_9F32, false);
1761 DUMP(currentcard->tag_9F33);
1762 Dbhexdump(3, currentcard->tag_9F33, false);
1763 DUMP(currentcard->tag_9F34);
1764 Dbhexdump(3, currentcard->tag_9F34, false);
1765 DUMP(currentcard->tag_9F35);
1766 Dbhexdump(1, currentcard->tag_9F35, false);
1767 DUMP(currentcard->tag_9F36);
1768 Dbhexdump(2, currentcard->tag_9F36, false);
1769 DUMP(currentcard->tag_9F37);
1770 Dbhexdump(4, currentcard->tag_9F37, false);
1771 DUMP(currentcard->tag_9F38);
1772 Dbhexdump(currentcard->tag_9F38_len, currentcard->tag_9F38, false);
1773 DUMP(currentcard->tag_9F39);
1774 Dbhexdump(1, currentcard->tag_9F39, false);
1775 DUMP(currentcard->tag_9F39);
1776 Dbhexdump(1, currentcard->tag_9F39, false);
1777 DUMP(currentcard->tag_9F40);
1778 Dbhexdump(5, currentcard->tag_9F40, false);
1779 DUMP(currentcard->tag_9F41);
1780 Dbhexdump(4, currentcard->tag_9F41, false);
1781 DUMP(currentcard->tag_9F42);
1782 Dbhexdump(2, currentcard->tag_9F42, false);
1783 DUMP(currentcard->tag_9F43);
1784 Dbhexdump(4, currentcard->tag_9F43, false);
1785 DUMP(currentcard->tag_9F44);
1786 Dbhexdump(1, currentcard->tag_9F44, false);
1787 DUMP(currentcard->tag_9F45);
1788 Dbhexdump(2, currentcard->tag_9F45, false);
1789 DUMP(currentcard->tag_9F46);
1790 Dbhexdump(currentcard->tag_9F46_len, currentcard->tag_9F46, false);
1791 DUMP(currentcard->tag_9F47);
1792 Dbhexdump(currentcard->tag_9F47_len, currentcard->tag_9F47, false);
1793 DUMP(currentcard->tag_9F48);
1794 Dbhexdump(currentcard->tag_9F48_len, currentcard->tag_9F48, false);
1795 DUMP(currentcard->tag_9F49);
1796 Dbhexdump(currentcard->tag_9F49_len, currentcard->tag_9F49, false);
1797 DUMP(currentcard->tag_9F4A);
1798 Dbhexdump(1, currentcard->tag_9F4A, false);
1799 DUMP(currentcard->tag_9F4B);
1800 Dbhexdump(currentcard->tag_9F4B_len, currentcard->tag_9F4B, false);
1801 DUMP(currentcard->tag_9F4C);
1802 Dbhexdump(8, currentcard->tag_9F4C, false);
1803 DUMP(currentcard->tag_9F4D);
1804 Dbhexdump(2, currentcard->tag_9F4D, false);
1805 DUMP(currentcard->tag_9F4E);
1806 Dbhexdump(255, currentcard->tag_9F4E, false);
1807 DUMP(currentcard->tag_9F60);
1808 Dbhexdump(2, currentcard->tag_9F60, false);
1809 DUMP(currentcard->tag_9F61);
1810 Dbhexdump(2, currentcard->tag_9F61, false);
1811 DUMP(currentcard->tag_9F62);
1812 Dbhexdump(6, currentcard->tag_9F62, false);
1813 DUMP(currentcard->tag_9F63);
1814 Dbhexdump(6, currentcard->tag_9F63, false);
1815 DUMP(currentcard->tag_9F64);
1816 Dbhexdump(1, currentcard->tag_9F64, false);
1817 DUMP(currentcard->tag_9F65);
1818 Dbhexdump(2, currentcard->tag_9F65, false);
1819 DUMP(currentcard->tag_9F66);
1820 Dbhexdump(2, currentcard->tag_9F66, false);
1821 DUMP(currentcard->tag_9F67);
1822 Dbhexdump(1, currentcard->tag_9F67, false);
1823 DUMP(currentcard->tag_9F68);
1824 Dbhexdump(currentcard->tag_9F68_len, currentcard->tag_9F68, false);
1825 DUMP(currentcard->tag_9F69);
1826 Dbhexdump(currentcard->tag_9F69_len, currentcard->tag_9F69, false);
1827 DUMP(currentcard->tag_9F6A);
1828 Dbhexdump(8, currentcard->tag_9F6A, false);
1829 DUMP(currentcard->tag_9F6B);
1830 Dbhexdump(currentcard->tag_9F6B_len, currentcard->tag_9F6B, false);
1831 DUMP(currentcard->tag_9F6C);
1832 Dbhexdump(2, currentcard->tag_9F6C, false);
1833 DUMP(currentcard->tag_61);
1834 Dbhexdump(currentcard->tag_61_len, currentcard->tag_61, false);
1835 DUMP(currentcard->tag_A5);
1836 Dbhexdump(currentcard->tag_A5_len, currentcard->tag_A5, false);
1837 DUMP(currentcard->tag_DFNAME);
1838 Dbhexdump(currentcard->tag_DFNAME_len, currentcard->tag_DFNAME, false);
1839 DUMP(currentcard->tag_70);
1840 Dbhexdump(currentcard->tag_70_len, currentcard->tag_70, false);
1841 DUMP(currentcard->tag_77);
1842 Dbhexdump(currentcard->tag_77_len, currentcard->tag_77, false);
1843 DUMP(currentcard->tag_80);
1844 Dbhexdump(currentcard->tag_80_len, currentcard->tag_80, false);
1845 DUMP(currentcard->tag_91);
1846 Dbhexdump(currentcard->tag_91_len, currentcard->tag_91, false);
1847 DUMP(currentcard->tag_BF0C);
1848 Dbhexdump(currentcard->tag_BF0C_len, currentcard->tag_BF0C, false);
1849 DUMP(currentcard->tag_DFName);
1850 Dbhexdump(currentcard->tag_DFName_len, currentcard->tag_DFName, false);
1851 }
1852
1853
Impressum, Datenschutz