]> cvs.zerfleddert.de Git - proxmark3-svn/blob - armsrc/emvutil.c
CHG: testing to set 460800 baudrate as default, if it fails, go to 115200 baudrate...
[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 int EMV_DBGLEVEL = EMV_DBG_ALL;
16 //uint8_t PCB = 0x00; //track Protocol Control Byte externally
17
18 //util functions
19 //print detected tag name over the serial link
20 int emv_printtag(uint8_t* selected_tag, emvtags* inputcard, uint8_t* outputstring, uint8_t* outputlen)
21 {
22 //search tag list and print the match
23 //get the value of the tag
24 uint8_t tagvalue[255];
25 uint8_t tagvaluelen;
26 emv_lookuptag(selected_tag, inputcard, tagvalue, &tagvaluelen);
27 //loop through selected tag, print the value found
28 for(int i=0; i<(sizeof(EMV_TAG_LIST)/sizeof(EMV_TAG_LIST[0])); i++){
29 if(!memcmp(selected_tag, EMV_TAG_LIST[i].tag, 2)){
30 memcpy(outputstring, EMV_TAG_LIST[i].description, strlen(EMV_TAG_LIST[i].description));
31 memcpy(outputstring+(strlen(EMV_TAG_LIST[i].description)), "=", 1);
32 memcpy(outputstring+(strlen(EMV_TAG_LIST[i].description))+1, tagvalue, tagvaluelen);
33 *outputlen = strlen(EMV_TAG_LIST[i].description) + 1 + tagvaluelen;
34 break;
35 }
36 }
37 return 0;
38 }
39
40 //returns the value of the emv tag in the supplied emvtags structure
41 int emv_lookuptag(uint8_t* tag, emvtags *currentcard, uint8_t* outputval, uint8_t* outputvallen)
42 {
43 //loop through tag and return the appropriate value
44 uint8_t returnedtag[255];
45 uint8_t returnedlength;
46 memset(returnedtag, 0x00, sizeof(returnedtag));
47 if(!memcmp(tag, "\x4F\x00",2)){
48 memcpy(&returnedtag, currentcard->tag_4F, currentcard->tag_4F_len);
49 returnedlength = currentcard->tag_4F_len; goto exitfunction;}
50 else if(!memcmp(tag, "\x50\x00",2)){
51 memcpy(&returnedtag, currentcard->tag_50, currentcard->tag_50_len);
52 returnedlength = currentcard->tag_50_len; goto exitfunction;}
53 else if(!memcmp(tag, "\x56\x00",2)){
54 memcpy(&returnedtag, currentcard->tag_56, currentcard->tag_56_len);
55 returnedlength = currentcard->tag_56_len; goto exitfunction;}
56 else if(!memcmp(tag, "\x57\x00",2)){
57 memcpy(&returnedtag, currentcard->tag_57, currentcard->tag_57_len);
58 returnedlength = currentcard->tag_57_len; goto exitfunction;}
59 else if(!memcmp(tag, "\x5A\x00",2)){
60 memcpy(&returnedtag, currentcard->tag_5A, currentcard->tag_5A_len);
61 returnedlength = currentcard->tag_5A_len; goto exitfunction;}
62 else if(!memcmp(tag, "\x82\x00",2)){
63 memcpy(&returnedtag, currentcard->tag_82, sizeof(currentcard->tag_82));
64 returnedlength = sizeof(currentcard->tag_82);goto exitfunction;}
65 else if(!memcmp(tag, "\x84\x00",2)){
66 memcpy(&returnedtag, currentcard->tag_84, currentcard->tag_84_len);
67 returnedlength = currentcard->tag_84_len; goto exitfunction;}
68 else if(!memcmp(tag, "\x86\x00",2)){
69 memcpy(&returnedtag, currentcard->tag_86, currentcard->tag_86_len);
70 returnedlength = currentcard->tag_86_len; goto exitfunction;}
71 else if(!memcmp(tag, "\x87\x00",2)){
72 memcpy(&returnedtag, currentcard->tag_87, sizeof(currentcard->tag_87));
73 returnedlength = sizeof(currentcard->tag_87);goto exitfunction;}
74 else if(!memcmp(tag, "\x88\x00",2)){
75 memcpy(&returnedtag, currentcard->tag_88, currentcard->tag_50_len);
76 returnedlength = sizeof(currentcard->tag_88); goto exitfunction;}
77 else if(!memcmp(tag, "\x8A\x00",2)){
78 memcpy(&returnedtag, currentcard->tag_8A, sizeof(currentcard->tag_8A));
79 returnedlength = sizeof(currentcard->tag_8A);goto exitfunction;}
80 else if(!memcmp(tag, "\x8C\x00",2)){
81 memcpy(&returnedtag, currentcard->tag_8C, currentcard->tag_8C_len);
82 returnedlength = currentcard->tag_8C_len; goto exitfunction;}
83 else if(!memcmp(tag, "\x8D\x00",2)){
84 memcpy(&returnedtag, currentcard->tag_8D, currentcard->tag_8D_len);
85 returnedlength = currentcard->tag_8D_len; goto exitfunction;}
86 else if(!memcmp(tag, "\x8E\x00",2)){
87 memcpy(&returnedtag, currentcard->tag_8E, currentcard->tag_8E_len);
88 returnedlength = currentcard->tag_8E_len; goto exitfunction;}
89 else if(!memcmp(tag, "\x8F\x00",2)){
90 memcpy(&returnedtag, currentcard->tag_8F, sizeof(currentcard->tag_8F));
91 returnedlength = sizeof(currentcard->tag_8F);goto exitfunction;}
92 else if(!memcmp(tag, "\x90\x00",2)){
93 memcpy(&returnedtag, currentcard->tag_90, currentcard->tag_90_len);
94 returnedlength = currentcard->tag_90_len; goto exitfunction;}
95 else if(!memcmp(tag, "\x92\x00",2)){
96 memcpy(&returnedtag, currentcard->tag_92, currentcard->tag_92_len);
97 returnedlength = currentcard->tag_92_len; goto exitfunction;}
98 else if(!memcmp(tag, "\x93\x00",2)){
99 memcpy(&returnedtag, currentcard->tag_93, currentcard->tag_93_len);
100 returnedlength = currentcard->tag_93_len; goto exitfunction;}
101 else if(!memcmp(tag, "\x94\x00",2)){
102 memcpy(&returnedtag, currentcard->tag_94, currentcard->tag_94_len);
103 returnedlength = currentcard->tag_94_len; goto exitfunction;}
104 else if(!memcmp(tag, "\x95\x00",2)){
105 memcpy(&returnedtag, currentcard->tag_95, sizeof(currentcard->tag_95));
106 returnedlength = sizeof(currentcard->tag_95);goto exitfunction;}
107 else if(!memcmp(tag, "\x97\x00",2)){
108 memcpy(&returnedtag, currentcard->tag_97, currentcard->tag_97_len);
109 returnedlength = currentcard->tag_97_len; goto exitfunction;}
110 else if(!memcmp(tag, "\x98\x00",2)){
111 memcpy(&returnedtag, currentcard->tag_98, sizeof(currentcard->tag_98));
112 returnedlength = sizeof(currentcard->tag_98);goto exitfunction;}
113 else if(!memcmp(tag, "\x99\x00",2)){
114 memcpy(&returnedtag, currentcard->tag_99, currentcard->tag_99_len);
115 returnedlength = currentcard->tag_99_len; goto exitfunction;}
116 else if(!memcmp(tag, "\x9A\x00",2)){
117 memcpy(&returnedtag, currentcard->tag_9A, sizeof(currentcard->tag_9A));
118 returnedlength = sizeof(currentcard->tag_9A);goto exitfunction;}
119 else if(!memcmp(tag, "\x9B\x00",2)){
120 memcpy(&returnedtag, currentcard->tag_9B, sizeof(currentcard->tag_9B));
121 returnedlength = sizeof(currentcard->tag_9B);goto exitfunction;}
122 else if(!memcmp(tag, "\x9C\x00",2)){
123 memcpy(&returnedtag, currentcard->tag_9C, sizeof(currentcard->tag_9C));
124 returnedlength = sizeof(currentcard->tag_9C);goto exitfunction;}
125 else if(!memcmp(tag, "\x9D\x00",2)){
126 memcpy(&returnedtag, currentcard->tag_9D, currentcard->tag_9D_len);
127 returnedlength = currentcard->tag_9D_len; goto exitfunction;}
128 else if(!memcmp(tag, "\x9D\x00",2)){
129 memcpy(&returnedtag, currentcard->tag_9D, currentcard->tag_9D_len);
130 returnedlength = currentcard->tag_9D_len; goto exitfunction;}
131 else if(!memcmp(tag, "\xCD\x00",2)){
132 memcpy(&returnedtag, currentcard->tag_CD, sizeof(currentcard->tag_CD));
133 returnedlength = sizeof(currentcard->tag_CD);goto exitfunction;}
134 else if(!memcmp(tag, "\xCE\x00",2)){
135 memcpy(&returnedtag, currentcard->tag_CE, sizeof(currentcard->tag_CE));
136 returnedlength = sizeof(currentcard->tag_CE);goto exitfunction;}
137 else if(!memcmp(tag, "\xCF\x00",2)){
138 memcpy(&returnedtag, currentcard->tag_CF, sizeof(currentcard->tag_CF));
139 returnedlength = sizeof(currentcard->tag_CF);goto exitfunction;}
140 else if(!memcmp(tag, "\xD7\x00",2)){
141 memcpy(&returnedtag, currentcard->tag_D7, sizeof(currentcard->tag_D7));
142 returnedlength = sizeof(currentcard->tag_D7);goto exitfunction;}
143 else if(!memcmp(tag, "\xD8\x00",2)){
144 memcpy(&returnedtag, currentcard->tag_D8, sizeof(currentcard->tag_D8));
145 returnedlength = sizeof(currentcard->tag_D8);goto exitfunction;}
146 else if(!memcmp(tag, "\xD9\x00",2)){
147 memcpy(&returnedtag, currentcard->tag_D9, currentcard->tag_D9_len);
148 returnedlength = currentcard->tag_D9_len;goto exitfunction;}
149 else if(!memcmp(tag, "\xDA\x00",2)){
150 memcpy(&returnedtag, currentcard->tag_DA, sizeof(currentcard->tag_DA));
151 returnedlength = sizeof(currentcard->tag_DA);goto exitfunction;}
152 else if(!memcmp(tag, "\xDB\x00",2)){
153 memcpy(&returnedtag, currentcard->tag_DB, sizeof(currentcard->tag_DB));
154 returnedlength = sizeof(currentcard->tag_DB);goto exitfunction;}
155 else if(!memcmp(tag, "\xDC\x00",2)){
156 memcpy(&returnedtag, currentcard->tag_DC, sizeof(currentcard->tag_DC));
157 returnedlength = sizeof(currentcard->tag_DC);goto exitfunction;}
158 else if(!memcmp(tag, "\xDD\x00",2)){
159 memcpy(&returnedtag, currentcard->tag_DD, sizeof(currentcard->tag_DD));
160 returnedlength = sizeof(currentcard->tag_DD);goto exitfunction;}
161 else if(!memcmp(tag, "\xA5\x00",2)){
162 memcpy(&returnedtag, currentcard->tag_A5, currentcard->tag_A5_len);
163 returnedlength = currentcard->tag_A5_len; goto exitfunction;}
164 else if(!memcmp(tag, "\xAF\x00",2)){
165 memcpy(&returnedtag, currentcard->tag_AF, currentcard->tag_AF_len);
166 returnedlength = currentcard->tag_AF_len; goto exitfunction;}
167 if(*tag == 0x5F){
168 if(*(tag+1) == 0x20){
169 memcpy(&returnedtag, currentcard->tag_5F20, currentcard->tag_5F20_len);
170 returnedlength = currentcard->tag_5F20_len; goto exitfunction;}
171 else if(*(tag+1) == 0x24){
172 memcpy(&returnedtag, currentcard->tag_5F24, sizeof(currentcard->tag_5F24));
173 returnedlength = sizeof(currentcard->tag_5F24);goto exitfunction;}
174 else if(*(tag+1) == 0x25){
175 memcpy(&returnedtag, currentcard->tag_5F25, sizeof(currentcard->tag_5F25));
176 returnedlength = sizeof(currentcard->tag_5F25);goto exitfunction;}
177 else if(*(tag+1) == 0x28){
178 memcpy(&returnedtag, currentcard->tag_5F28, sizeof(currentcard->tag_5F28));
179 returnedlength = sizeof(currentcard->tag_5F28);goto exitfunction;}
180 else if(*(tag+1) == 0x2A){
181 memcpy(&returnedtag, currentcard->tag_5F2A, sizeof(currentcard->tag_5F2A));
182 returnedlength = sizeof(currentcard->tag_5F2A);goto exitfunction;}
183 else if(*(tag+1) == 0x2D){
184 memcpy(&returnedtag, currentcard->tag_5F2D, currentcard->tag_5F2D_len);
185 returnedlength = currentcard->tag_5F2D_len; goto exitfunction;}
186 else if(*(tag+1) == 0x30){
187 memcpy(&returnedtag, currentcard->tag_5F30, sizeof(currentcard->tag_5F30));
188 returnedlength = sizeof(currentcard->tag_5F30);goto exitfunction;}
189 else if(*(tag+1) == 0x34){
190 memcpy(&returnedtag, currentcard->tag_5F34, sizeof(currentcard->tag_5F34));
191 returnedlength = sizeof(currentcard->tag_5F34);goto exitfunction;}
192 else if(*(tag+1) == 0x36){
193 memcpy(&returnedtag, currentcard->tag_5F36, sizeof(currentcard->tag_5F36));
194 returnedlength = sizeof(currentcard->tag_5F36);goto exitfunction;}
195 else if(*(tag+1) == 0x50){
196 memcpy(&returnedtag, currentcard->tag_5F50, currentcard->tag_5F50_len);
197 returnedlength = currentcard->tag_5F50_len; goto exitfunction;}
198 else if(*(tag+1) == 0x54){
199 memcpy(&returnedtag, currentcard->tag_5F54, currentcard->tag_5F54_len);
200 returnedlength = currentcard->tag_5F54_len; goto exitfunction;}
201 }
202 if(*tag == 0x9F) {
203 if(*(tag+1) == 0x01){
204 memcpy(&returnedtag, currentcard->tag_9F01, sizeof(currentcard->tag_9F01));
205 returnedlength = sizeof(currentcard->tag_9F01);goto exitfunction;}
206 else if(*(tag+1) == 0x02){
207 memcpy(&returnedtag, currentcard->tag_9F02, sizeof(currentcard->tag_9F02));
208 returnedlength = sizeof(currentcard->tag_9F02);goto exitfunction;}
209 else if(*(tag+1) == 0x03){
210 returnedlength = sizeof(currentcard->tag_9F03);goto exitfunction;}
211 else if(*(tag+1) == 0x04){
212 memcpy(&returnedtag, currentcard->tag_9F04, sizeof(currentcard->tag_9F04));
213 returnedlength = sizeof(currentcard->tag_9F04);goto exitfunction;}
214 else if(*(tag+1) == 0x05){
215 memcpy(&returnedtag, currentcard->tag_9F05, currentcard->tag_9F05_len);
216 returnedlength = currentcard->tag_9F05_len; goto exitfunction;}
217 else if(*(tag+1) == 0x06){
218 memcpy(&returnedtag, currentcard->tag_9F06, currentcard->tag_9F06_len);
219 returnedlength = currentcard->tag_9F06_len; goto exitfunction;}
220 else if(*(tag+1) == 0x07){
221 memcpy(&returnedtag, currentcard->tag_9F07, sizeof(currentcard->tag_9F07));
222 returnedlength = sizeof(currentcard->tag_9F07);goto exitfunction;}
223 else if(*(tag+1) == 0x08){
224 memcpy(&returnedtag, currentcard->tag_9F08, sizeof(currentcard->tag_9F08));
225 returnedlength = sizeof(currentcard->tag_9F08);goto exitfunction;}
226 else if(*(tag+1) == 0x09){
227 memcpy(&returnedtag, currentcard->tag_9F09, sizeof(currentcard->tag_9F09));
228 returnedlength = sizeof(currentcard->tag_9F09);goto exitfunction;}
229 else if(*(tag+1) == 0x0B){
230 memcpy(&returnedtag, currentcard->tag_9F0B, currentcard->tag_9F0B_len);
231 returnedlength = currentcard->tag_9F0B_len; goto exitfunction;}
232 else if(*(tag+1) == 0x0D){
233 memcpy(&returnedtag, currentcard->tag_9F0D, sizeof(currentcard->tag_9F0D));
234 returnedlength = sizeof(currentcard->tag_9F0D);goto exitfunction;}
235 else if(*(tag+1) == 0x0E){
236 memcpy(&returnedtag, currentcard->tag_9F0E, sizeof(currentcard->tag_9F0E));
237 returnedlength = sizeof(currentcard->tag_9F0E);goto exitfunction;}
238 else if(*(tag+1) == 0x0F){
239 memcpy(&returnedtag, currentcard->tag_9F0F, sizeof(currentcard->tag_9F0F));
240 returnedlength = sizeof(currentcard->tag_9F0F);goto exitfunction;}
241 else if(*(tag+1) == 0x10){
242 memcpy(&returnedtag, currentcard->tag_9F10, currentcard->tag_9F10_len);
243 returnedlength = currentcard->tag_9F10_len;goto exitfunction;}
244 else if(*(tag+1) == 0x11){
245 memcpy(&returnedtag, currentcard->tag_9F11, sizeof(currentcard->tag_9F11));
246 returnedlength = sizeof(currentcard->tag_9F11);goto exitfunction;}
247 else if(*(tag+1) == 0x12){
248 memcpy(&returnedtag, currentcard->tag_9F12, currentcard->tag_9F12_len);
249 returnedlength = currentcard->tag_9F12_len;goto exitfunction;}
250 else if(*(tag+1) == 0x1A){
251 memcpy(&returnedtag, currentcard->tag_9F1A, sizeof(currentcard->tag_9F1A));
252 goto exitfunction;}
253 else if(*(tag+1) == 0x1F){
254 memcpy(&returnedtag, currentcard->tag_9F1F, currentcard->tag_9F1F_len);
255 returnedlength = currentcard->tag_9F1F_len; goto exitfunction;}
256 else if(*(tag+1) == 0x32){
257 memcpy(&returnedtag, currentcard->tag_9F32, currentcard->tag_9F32_len);
258 returnedlength = currentcard->tag_9F32_len; goto exitfunction;}
259 else if(*(tag+1) == 0x34){
260 memcpy(&returnedtag, currentcard->tag_9F34, sizeof(currentcard->tag_9F34));
261 returnedlength = sizeof(currentcard->tag_9F34); goto exitfunction;}
262 else if(*(tag+1) == 0x35){
263 memcpy(&returnedtag, currentcard->tag_9F35, sizeof(currentcard->tag_9F35));
264 returnedlength = sizeof(currentcard->tag_9F35); goto exitfunction;}
265 else if(*(tag+1) == 0x37){
266 memcpy(&returnedtag, currentcard->tag_9F37, sizeof(currentcard->tag_9F37));
267 returnedlength = sizeof(currentcard->tag_9F37);goto exitfunction;}
268 else if(*(tag+1) == 0x38){
269 memcpy(&returnedtag, currentcard->tag_9F38, currentcard->tag_9F38_len);
270 returnedlength = currentcard->tag_9F38_len; goto exitfunction;}
271 else if(*(tag+1) == 0x44){
272 memcpy(&returnedtag, currentcard->tag_9F44, sizeof(currentcard->tag_9F44));
273 returnedlength = sizeof(currentcard->tag_9F44);goto exitfunction;}
274 else if(*(tag+1) == 0x45){
275 memcpy(&returnedtag, currentcard->tag_9F45, sizeof(currentcard->tag_9F45));
276 returnedlength = sizeof(currentcard->tag_9F45);goto exitfunction;}
277 else if(*(tag+1) == 0x46){
278 memcpy(&returnedtag, currentcard->tag_9F46, currentcard->tag_9F46_len);
279 returnedlength = currentcard->tag_9F46_len; goto exitfunction;}
280 else if(*(tag+1) == 0x47){
281 memcpy(&returnedtag, currentcard->tag_9F47, currentcard->tag_9F47_len);
282 returnedlength = currentcard->tag_9F47_len; goto exitfunction;}
283 else if(*(tag+1) == 0x48){
284 memcpy(&returnedtag, currentcard->tag_9F48, currentcard->tag_9F48_len);
285 returnedlength = currentcard->tag_9F48_len; goto exitfunction;}
286 else if(*(tag+1) == 0x49){
287 memcpy(&returnedtag, currentcard->tag_9F49, currentcard->tag_9F49_len);
288 returnedlength = currentcard->tag_9F49_len; goto exitfunction;}
289 else if(*(tag+1) == 0x4A){
290 memcpy(&returnedtag, currentcard->tag_9F4A, sizeof(currentcard->tag_9F4A));
291 returnedlength = sizeof(currentcard->tag_9F4A);goto exitfunction;}
292 else if(*(tag+1) == 0x4B){
293 memcpy(&returnedtag, currentcard->tag_9F4B, currentcard->tag_9F4B_len);
294 returnedlength = currentcard->tag_9F4B_len; goto exitfunction;}
295 else if(*(tag+1) == 0x4C){
296 memcpy(&returnedtag, currentcard->tag_9F4C, sizeof(currentcard->tag_9F4C));
297 returnedlength = sizeof(currentcard->tag_9F4C); goto exitfunction;}
298 else if(*(tag+1) == 0x60){
299 memcpy(&returnedtag, currentcard->tag_9F60, sizeof(currentcard->tag_9F60));
300 returnedlength = sizeof(currentcard->tag_9F60);goto exitfunction;}
301 else if(*(tag+1) == 0x61){
302 memcpy(&returnedtag, currentcard->tag_9F61, sizeof(currentcard->tag_9F61));
303 returnedlength = sizeof(currentcard->tag_9F61);goto exitfunction;}
304 else if(*(tag+1) == 0x62){
305 memcpy(&returnedtag, currentcard->tag_9F62, sizeof(currentcard->tag_9F62));
306 returnedlength = sizeof(currentcard->tag_9F62);goto exitfunction;}
307 else if(*(tag+1) == 0x63){
308 memcpy(&returnedtag, currentcard->tag_9F63, sizeof(currentcard->tag_9F63));
309 returnedlength = sizeof(currentcard->tag_9F63);goto exitfunction;}
310 else if(*(tag+1) == 0x64){
311 memcpy(&returnedtag, currentcard->tag_9F64, sizeof(currentcard->tag_9F64));
312 returnedlength = sizeof(currentcard->tag_9F64);goto exitfunction;}
313 else if(*(tag+1) == 0x65){
314 memcpy(&returnedtag, currentcard->tag_9F65, sizeof(currentcard->tag_9F65));
315 returnedlength = sizeof(currentcard->tag_9F65);goto exitfunction;}
316 else if(*(tag+1) == 0x66){
317 memcpy(&returnedtag, currentcard->tag_9F66, sizeof(currentcard->tag_9F66));
318 returnedlength = sizeof(currentcard->tag_9F66);goto exitfunction;}
319 else if(*(tag+1) == 0x67){
320 memcpy(&returnedtag, currentcard->tag_9F67, sizeof(currentcard->tag_9F67));
321 returnedlength = sizeof(currentcard->tag_9F67);goto exitfunction;}
322 else if(*(tag+1) == 0x68){
323 memcpy(&returnedtag, currentcard->tag_9F68, currentcard->tag_9F68_len);
324 returnedlength = currentcard->tag_9F68_len;goto exitfunction;}
325 else if(*(tag+1) == 0x69){
326 memcpy(&returnedtag, currentcard->tag_9F69, currentcard->tag_9F69_len);
327 returnedlength = currentcard->tag_9F69_len; goto exitfunction;}
328 else if(*(tag+1) == 0x6A){
329 memcpy(&returnedtag, currentcard->tag_9F6A, sizeof(currentcard->tag_9F6A));
330 returnedlength = sizeof(currentcard->tag_9F6A);goto exitfunction;}
331 else if(*(tag+1) == 0x6B){
332 memcpy(&returnedtag, currentcard->tag_9F6B, currentcard->tag_9F6B_len);
333 returnedlength = currentcard->tag_9F6B_len; goto exitfunction;}
334 else if(*(tag+1) == 0x6C){
335 memcpy(&returnedtag, currentcard->tag_9F6C, sizeof(currentcard->tag_9F6C));
336 returnedlength = sizeof(currentcard->tag_9F6C);goto exitfunction;}
337 }
338 else {
339 if(!memcmp(tag, "\x61\x00",2)){
340 memcpy(&returnedtag, currentcard->tag_61, currentcard->tag_61_len);
341 returnedlength = currentcard->tag_61_len; goto exitfunction;}
342 else if(!memcmp(tag, "\x6F\x00",2)){
343 memcpy(&returnedtag, currentcard->tag_6F, currentcard->tag_6F_len);
344 returnedlength = currentcard->tag_6F_len; goto exitfunction;}
345 else if(!memcmp(tag, "\xAF\x00",2)){
346 memcpy(&returnedtag, currentcard->tag_AF, currentcard->tag_AF_len);
347 returnedlength = currentcard->tag_AF_len; goto exitfunction;}
348 else if(!memcmp(tag, "\x70\x00",2)){
349 memcpy(&returnedtag, currentcard->tag_70, currentcard->tag_70_len);
350 returnedlength = currentcard->tag_70_len; goto exitfunction;}
351 else if(!memcmp(tag, "\x77\x00",2)){
352 memcpy(&returnedtag, currentcard->tag_77, currentcard->tag_77_len);
353 returnedlength = currentcard->tag_77_len; goto exitfunction;}
354 else if(!memcmp(tag, "\x80\x00",2)){
355 memcpy(&returnedtag, currentcard->tag_80, currentcard->tag_80_len);
356 returnedlength = currentcard->tag_80_len; goto exitfunction;}
357 else if(!memcmp(tag, "\xBF\x0C",2)){
358 memcpy(&returnedtag, currentcard->tag_BF0C, currentcard->tag_BF0C_len);
359 returnedlength = currentcard->tag_BF0C_len; goto exitfunction;}
360 else if(!memcmp(tag, "\xFF\x01",2)){ //special DF tag
361 memcpy(&returnedtag, currentcard->tag_DFName, currentcard->tag_DFName_len);
362 returnedlength = currentcard->tag_DFName_len; goto exitfunction;}
363 }
364 exitfunction: //goto label to exit search quickly once found
365 memcpy(outputval, &returnedtag, returnedlength);
366 *outputvallen = returnedlength;
367 return 0;
368 }
369
370 //function to
371 int emv_settag(uint32_t tag, uint8_t *datain, emvtags *currentcard){
372 char binarydata[255] = {0};
373
374 /*
375 // if((strlen((const char *)datain)%2) != 0){ //must be an even string
376 // return -1;
377 // }
378 // if(strlen((const char *)datain) > 255) {
379 // return -1;
380 // }
381 */
382
383 uint8_t datalen = strlen((const char *)datain) / 2; //length of datain
384 for(int i = 0; i < strlen((const char *)datain); i += 2){
385 binarydata[i/2] |= (char)hex2int(datain[i]) << 4;
386 binarydata[i/2] |= (char)hex2int(datain[i+1]);
387 }
388 Dbprintf("BINARYDATA=");
389 Dbhexdump(datalen,(uint8_t *)binarydata,false);
390
391 switch(tag){
392 case 0x4F:
393 memcpy(currentcard->tag_4F, binarydata, datalen);
394 currentcard->tag_4F_len = datalen;
395 break;
396 case 0x50:
397 memcpy(currentcard->tag_50, binarydata, datalen);
398 currentcard->tag_50_len = datalen;
399 break;
400 case 0x56:
401 memcpy(currentcard->tag_56, binarydata, datalen);
402 currentcard->tag_56_len = datalen;
403 break;
404 case 0x57:
405 memcpy(currentcard->tag_57, binarydata, datalen);
406 currentcard->tag_57_len = datalen;
407 break;
408 case 0x5a:
409 memcpy(currentcard->tag_5A, binarydata, datalen);
410 currentcard->tag_5A_len = datalen;
411 break;
412 case 0x61:
413 memcpy(currentcard->tag_61, binarydata, datalen);
414 currentcard->tag_61_len = datalen;
415 break;
416 case 0x6f:
417 memcpy(currentcard->tag_6F, binarydata, datalen);
418 currentcard->tag_6F_len = datalen;
419 break;
420 case 0x70:
421 memcpy(currentcard->tag_70, binarydata, datalen);
422 currentcard->tag_70_len = datalen;
423 break;
424 case 0x77:
425 memcpy(currentcard->tag_77, binarydata, datalen);
426 currentcard->tag_77_len = datalen;
427 break;
428 case 0x80:
429 memcpy(currentcard->tag_80, binarydata, datalen);
430 currentcard->tag_80_len = datalen;
431 break;
432 case 0x82:
433 memcpy(currentcard->tag_82, binarydata, sizeof(currentcard->tag_82));
434 break;
435 case 0x84:
436 memcpy(currentcard->tag_84, binarydata, datalen);
437 currentcard->tag_84_len = datalen;
438 break;
439 case 0x86:
440 memcpy(currentcard->tag_86, binarydata, datalen);
441 currentcard->tag_86_len = datalen;
442 break;
443 case 0x87:
444 memcpy(currentcard->tag_87, binarydata, sizeof(currentcard->tag_87));
445 break;
446 case 0x88:
447 memcpy(currentcard->tag_88, binarydata, sizeof(currentcard->tag_88));
448 break;
449 case 0x8a:
450 memcpy(currentcard->tag_8A, binarydata, sizeof(currentcard->tag_8A));
451 break;
452 case 0x8c:
453 memcpy(currentcard->tag_8C, binarydata, datalen);
454 currentcard->tag_8C_len = datalen;
455 break;
456 case 0x8d:
457 memcpy(currentcard->tag_8D, binarydata, datalen);
458 currentcard->tag_8D_len = datalen;
459 break;
460 case 0x8e:
461 memcpy(currentcard->tag_8E, binarydata, datalen);
462 currentcard->tag_8E_len = datalen;
463 break;
464 case 0x8f:
465 memcpy(currentcard->tag_8F, binarydata, sizeof(currentcard->tag_8F));
466 break;
467 case 0x90:
468 memcpy(currentcard->tag_90, binarydata, datalen);
469 currentcard->tag_90_len = datalen;
470 break;
471 case 0x91:
472 memcpy(currentcard->tag_91, binarydata, datalen);
473 currentcard->tag_91_len = datalen;
474 break;
475 case 0x92:
476 memcpy(currentcard->tag_92, binarydata, datalen);
477 currentcard->tag_92_len = datalen;
478 break;
479 case 0x93:
480 memcpy(currentcard->tag_93, binarydata, datalen);
481 currentcard->tag_93_len = datalen;
482 break;
483 case 0x94:
484 memcpy(currentcard->tag_94, binarydata, datalen);
485 currentcard->tag_94_len = datalen;
486 break;
487 case 0x95:
488 memcpy(currentcard->tag_95, binarydata, sizeof(currentcard->tag_95));
489 break;
490 case 0x97:
491 memcpy(currentcard->tag_97, binarydata, datalen);
492 currentcard->tag_97_len = datalen;
493 break;
494 case 0x98:
495 memcpy(currentcard->tag_98, binarydata, sizeof(currentcard->tag_98));
496 break;
497 case 0x99:
498 memcpy(currentcard->tag_99, binarydata, datalen);
499 currentcard->tag_99_len = datalen;
500 break;
501 case 0x9a:
502 memcpy(currentcard->tag_9A, binarydata, sizeof(currentcard->tag_9A));
503 break;
504 case 0x9b:
505 memcpy(currentcard->tag_9B, binarydata, sizeof(currentcard->tag_9B));
506 break;
507 case 0x9c:
508 memcpy(currentcard->tag_9C, binarydata, sizeof(currentcard->tag_9C));
509 break;
510 case 0x9d:
511 memcpy(currentcard->tag_9D, binarydata, datalen);
512 currentcard->tag_9D_len = datalen;
513 break;
514 case 0xa5:
515 memcpy(currentcard->tag_A5, binarydata, datalen);
516 currentcard->tag_A5_len = datalen;
517 break;
518 case 0xaf:
519 memcpy(currentcard->tag_AF, binarydata, datalen);
520 currentcard->tag_AF_len = datalen;
521 break;
522 case 0xcd:
523 memcpy(currentcard->tag_CD, binarydata, sizeof(currentcard->tag_CD));
524 break;
525 case 0xce:
526 memcpy(currentcard->tag_CE, binarydata, sizeof(currentcard->tag_CE));
527 break;
528 case 0xcf:
529 memcpy(currentcard->tag_CF, binarydata, sizeof(currentcard->tag_CF));
530 break;
531 case 0xd7:
532 memcpy(currentcard->tag_CF, binarydata, sizeof(currentcard->tag_CF));
533 break;
534 case 0xd8:
535 memcpy(currentcard->tag_CF, binarydata, sizeof(currentcard->tag_CF));
536 break;
537 case 0xd9:
538 break;
539 case 0xda:
540 memcpy(currentcard->tag_DA, binarydata, sizeof(currentcard->tag_DA));
541 break;
542 case 0xdb:
543 memcpy(currentcard->tag_DB, binarydata, sizeof(currentcard->tag_DB));
544 break;
545 case 0xdc:
546 memcpy(currentcard->tag_DB, binarydata, sizeof(currentcard->tag_DB));
547 break;
548 case 0xdd:
549 memcpy(currentcard->tag_DD, binarydata, sizeof(currentcard->tag_DD));
550 break;
551 case 0x5f20:
552 break;
553 case 0x5f24:
554 memcpy(currentcard->tag_5F24, binarydata, sizeof(currentcard->tag_5F24));
555 break;
556 case 0x5f25:
557 memcpy(currentcard->tag_5F25, binarydata, sizeof(currentcard->tag_5F25));
558 break;
559 case 0x5f28:
560 memcpy(currentcard->tag_5F28, binarydata, sizeof(currentcard->tag_5F28));
561 break;
562 case 0x5f2a:
563 memcpy(currentcard->tag_5F2A, binarydata, sizeof(currentcard->tag_5F2A));
564 break;
565 case 0x5f2d:
566 break;
567 case 0x5f30:
568 memcpy(currentcard->tag_5F30, binarydata, sizeof(currentcard->tag_5F30));
569 break;
570 case 0x5f34:
571 memcpy(currentcard->tag_5F34, binarydata, sizeof(currentcard->tag_5F34));
572 break;
573 case 0x5f36:
574 memcpy(currentcard->tag_5F36, binarydata, sizeof(currentcard->tag_5F36));
575 break;
576 case 0x5f50:
577 break;
578 case 0x5f54:
579 memcpy(currentcard->tag_5F54, binarydata, sizeof(currentcard->tag_5F54));
580 break;
581 case 0x9f01:
582 memcpy(currentcard->tag_9F01, binarydata, sizeof(currentcard->tag_9F01));
583 break;
584 case 0x9f02:
585 memcpy(currentcard->tag_9F02, binarydata, sizeof(currentcard->tag_9F02));
586 break;
587 case 0x9f03:
588 memcpy(currentcard->tag_9F03, binarydata, sizeof(currentcard->tag_9F03));
589 break;
590 case 0x9f04:
591 memcpy(currentcard->tag_9F04, binarydata, sizeof(currentcard->tag_9F04));
592 break;
593 case 0x9f05:
594 memcpy(currentcard->tag_9F05, binarydata, datalen);
595 currentcard->tag_9F05_len = datalen;
596 break;
597 case 0x9f06:
598 memcpy(currentcard->tag_9F06, binarydata, datalen);
599 currentcard->tag_9F06_len = datalen;
600 break;
601 case 0x9f07:
602 memcpy(currentcard->tag_9F07, binarydata, sizeof(currentcard->tag_9F07));
603 break;
604 case 0x9f08:
605 memcpy(currentcard->tag_9F08, binarydata, sizeof(currentcard->tag_9F08));
606 break;
607 case 0x9f09:
608 memcpy(currentcard->tag_9F09, binarydata, sizeof(currentcard->tag_9F09));
609 break;
610 case 0x9f0b:
611 memcpy(currentcard->tag_9F0B, binarydata, sizeof(currentcard->tag_9F0B));
612 break;
613 case 0x9f0d:
614 memcpy(currentcard->tag_9F0D, binarydata, sizeof(currentcard->tag_9F0D));
615 break;
616 case 0x9f0e:
617 memcpy(currentcard->tag_9F0E, binarydata, sizeof(currentcard->tag_9F0E));
618 break;
619 case 0x9f0f:
620 memcpy(currentcard->tag_9F0F, binarydata, sizeof(currentcard->tag_9F0F));
621 break;
622 case 0x9f10:
623 memcpy(currentcard->tag_9F10, binarydata, datalen);
624 currentcard->tag_9F10_len = datalen;break;
625 case 0x9f11:
626 memcpy(currentcard->tag_9F11, binarydata, sizeof(currentcard->tag_9F11));
627 break;
628 case 0x9f12:
629 memcpy(currentcard->tag_9F12, binarydata, datalen);
630 currentcard->tag_9F12_len = datalen;break;
631 case 0x9f13:
632 memcpy(currentcard->tag_9F13, binarydata, sizeof(currentcard->tag_9F13));
633 break;
634 case 0x9f14:
635 memcpy(currentcard->tag_9F14, binarydata, sizeof(currentcard->tag_9F14));
636 break;
637 case 0x9f15:
638 memcpy(currentcard->tag_9F15, binarydata, sizeof(currentcard->tag_9F15));
639 break;
640 case 0x9f16:
641 memcpy(currentcard->tag_9F16, binarydata, sizeof(currentcard->tag_9F16));
642 break;
643 case 0x9f17:
644 memcpy(currentcard->tag_9F17, binarydata, sizeof(currentcard->tag_9F17));
645 break;
646 case 0x9f18:
647 memcpy(currentcard->tag_9F18, binarydata, sizeof(currentcard->tag_9F18));
648 break;
649 case 0x9f1a:
650 memcpy(currentcard->tag_9F1A, binarydata, sizeof(currentcard->tag_9F1A));
651 break;
652 case 0x9f1b:
653 memcpy(currentcard->tag_9F1B, binarydata, sizeof(currentcard->tag_9F1B));
654 break;
655 case 0x9f1c:
656 memcpy(currentcard->tag_9F1C, binarydata, sizeof(currentcard->tag_9F1C));
657 break;
658 case 0x9f1d:
659 memcpy(currentcard->tag_9F1D, binarydata, datalen);
660 currentcard->tag_9F1D_len = datalen;break;
661 case 0x9f1e:
662 memcpy(currentcard->tag_9F1E, binarydata, sizeof(currentcard->tag_9F1E));
663 break;
664 case 0x9f1f:
665 memcpy(currentcard->tag_9F1F, binarydata, datalen);
666 currentcard->tag_9F1F_len = datalen;break;
667 case 0x9f20:
668 memcpy(currentcard->tag_9F20, binarydata, datalen);
669 currentcard->tag_9F20_len = datalen;break;
670 case 0x9f21:
671 memcpy(currentcard->tag_9F21, binarydata, sizeof(currentcard->tag_9F21));
672 break;
673 case 0x9f22:
674 memcpy(currentcard->tag_9F22, binarydata, sizeof(currentcard->tag_9F22));
675 break;
676 case 0x9f23:
677 memcpy(currentcard->tag_9F23, binarydata, sizeof(currentcard->tag_9F23));
678 break;
679 case 0x9f26:
680 memcpy(currentcard->tag_9F26, binarydata, sizeof(currentcard->tag_9F26));
681 break;
682 case 0x9f27:
683 memcpy(currentcard->tag_9F27, binarydata, sizeof(currentcard->tag_9F27));
684 break;
685 case 0x9f2d:
686 memcpy(currentcard->tag_9F2D, binarydata, datalen);
687 currentcard->tag_9F2D_len = datalen;break;
688 case 0x9f2e:
689 memcpy(currentcard->tag_9F2E, binarydata, sizeof(currentcard->tag_9F2E));
690 break;
691 case 0x9f2f:
692 memcpy(currentcard->tag_9F2F, binarydata, datalen);
693 currentcard->tag_9F2F_len = datalen;break;
694 case 0x9f32:
695 memcpy(currentcard->tag_9F32, binarydata, datalen);
696 currentcard->tag_9F32_len = datalen;break;
697 case 0x9f33:
698 memcpy(currentcard->tag_9F33, binarydata, sizeof(currentcard->tag_9F33));
699 break;
700 case 0x9f34:
701 memcpy(currentcard->tag_9F34, binarydata, sizeof(currentcard->tag_9F34));
702 break;
703 case 0x9f35:
704 memcpy(currentcard->tag_9F35, binarydata, sizeof(currentcard->tag_9F35));
705 break;
706 case 0x9f36:
707 memcpy(currentcard->tag_9F36, binarydata, sizeof(currentcard->tag_9F36));
708 break;
709 case 0x9f37:
710 memcpy(currentcard->tag_9F37, binarydata, sizeof(currentcard->tag_9F37));
711 break;
712 case 0x9f38:
713 break;
714 case 0x9f39:
715 memcpy(currentcard->tag_9F39, binarydata, sizeof(currentcard->tag_9F39));
716 break;
717 case 0x9f40:
718 memcpy(currentcard->tag_9F40, binarydata, sizeof(currentcard->tag_9F40));
719 break;
720 case 0x9f41:
721 memcpy(currentcard->tag_9F41, binarydata, sizeof(currentcard->tag_9F41));
722 break;
723 case 0x9f42:
724 memcpy(currentcard->tag_9F42, binarydata, sizeof(currentcard->tag_9F42));
725 break;
726 case 0x9f43:
727 memcpy(currentcard->tag_9F43, binarydata, sizeof(currentcard->tag_9F43));
728 break;
729 case 0x9f44:
730 memcpy(currentcard->tag_9F44, binarydata, sizeof(currentcard->tag_9F44));
731 break;
732 case 0x9f45:
733 memcpy(currentcard->tag_9F45, binarydata, sizeof(currentcard->tag_9F45));
734 break;
735 case 0x9f46:
736 memcpy(currentcard->tag_9F46, binarydata, datalen);
737 currentcard->tag_9F46_len = datalen;break;
738 case 0x9f47:
739 memcpy(currentcard->tag_9F47, binarydata, datalen);
740 currentcard->tag_9F47_len = datalen;break;
741 case 0x9f48:
742 memcpy(currentcard->tag_9F48, binarydata, datalen);
743 currentcard->tag_9F48_len = datalen;break;
744 case 0x9f49:
745 memcpy(currentcard->tag_9F49, binarydata, datalen);
746 currentcard->tag_9F49_len = datalen;break;
747 case 0x9f4a:
748 memcpy(currentcard->tag_9F4A, binarydata, sizeof(currentcard->tag_9F4A));
749 break;
750 case 0x9f4b:
751 memcpy(currentcard->tag_9F4B, binarydata, datalen);
752 currentcard->tag_9F4B_len = datalen;break;
753 case 0x9f4c:
754 memcpy(currentcard->tag_9F4C, binarydata, sizeof(currentcard->tag_9F4C));
755 break;
756 case 0x9f4d:
757 memcpy(currentcard->tag_9F4D, binarydata, sizeof(currentcard->tag_9F4D));
758 break;
759 case 0x9f4e:
760 memcpy(currentcard->tag_9F4E, binarydata, sizeof(currentcard->tag_9F4E));
761 break;
762 case 0x9f60:
763 memcpy(currentcard->tag_9F60, binarydata, sizeof(currentcard->tag_9F60));
764 break;
765 case 0x9f61:
766 memcpy(currentcard->tag_9F61, binarydata, sizeof(currentcard->tag_9F61));
767 break;
768 case 0x9f62:
769 memcpy(currentcard->tag_9F62, binarydata, sizeof(currentcard->tag_9F62));
770 break;
771 case 0x9f63:
772 memcpy(currentcard->tag_9F63, binarydata, sizeof(currentcard->tag_9F63));
773 break;
774 case 0x9f64:
775 memcpy(currentcard->tag_9F64, binarydata, sizeof(currentcard->tag_9F64));
776 break;
777 case 0x9f65:
778 memcpy(currentcard->tag_9F65, binarydata, sizeof(currentcard->tag_9F65));
779 break;
780 case 0x9f66:
781 memcpy(currentcard->tag_9F66, binarydata, sizeof(currentcard->tag_9F66));
782 break;
783 case 0x9f67:
784 memcpy(currentcard->tag_9F67, binarydata, sizeof(currentcard->tag_9F67));
785 break;
786 case 0x9f68:
787 memcpy(currentcard->tag_9F68, binarydata, datalen);
788 currentcard->tag_9F68_len = datalen;break;
789 case 0x9f69:
790 memcpy(currentcard->tag_9F69, binarydata, datalen);
791 currentcard->tag_9F69_len = datalen;break;
792 case 0x9f6a:
793 memcpy(currentcard->tag_9F6A, binarydata, sizeof(currentcard->tag_9F6A));
794 break;
795 case 0x9f6b:
796 memcpy(currentcard->tag_9F6B, binarydata, sizeof(currentcard->tag_9F6B));
797 break;
798 case 0x9f6c:
799 memcpy(currentcard->tag_9F6C, binarydata, sizeof(currentcard->tag_9F6C));
800 break;
801 case 0xbf0c:
802 memcpy(currentcard->tag_BF0C, binarydata, datalen);
803 currentcard->tag_BF0C_len = datalen;break;
804 default:
805 break;
806 }
807 return 0;
808 }
809
810 /* generates an emv template based off tag values supplied */
811 int emv_generatetemplate(uint8_t* templateval,emvtags* currentcard, uint8_t* returnedval, uint8_t* returnedlen,uint8_t numtags, ...)
812 {
813 va_list arguments;
814 uint8_t* currenttag; //value of the current tag
815 uint8_t tagval[255]; //buffer to hold the extracted tag value
816 uint8_t taglen = 0; //extracted tag length
817 uint8_t bufferval[255];
818 uint8_t counter = 0;
819 uint32_t encodedlen = 0;
820 va_start(arguments, numtags);
821 for(int x=0; x<numtags; x++){
822 currenttag = va_arg(arguments, uint8_t*);
823 emv_lookuptag(currenttag, currentcard, tagval, &taglen);
824 encode_ber_tlv_item(currenttag, (uint8_t)strlen((const char*)currenttag), tagval, (uint32_t)taglen, bufferval+counter, &encodedlen);
825 counter +=encodedlen;
826 }
827 encode_ber_tlv_item(templateval, strlen((const char*) templateval), bufferval, counter, returnedval, &encodedlen);
828 *returnedlen = encodedlen;
829 return 0;
830 }
831
832 //generate a valid pdol list
833 int emv_generateDOL(uint8_t* DOL, uint8_t DOLlen,emvtags* 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, emvtags* 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, emvtags *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 emvtags 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
1369 readRecordCmd[0] = 0x00;
1370 readRecordCmd[1] = 0xB2;
1371 readRecordCmd[2] = recordnumber;
1372 readRecordCmd[3] = ((sfi << 3) | 0x04);
1373 readRecordCmd[4] = 0x00;
1374 return iso14_apdu(readRecordCmd, readRecordCmd_len, data);
1375 }
1376
1377 int emv_getprocessingoptions(uint8_t* pdol, uint8_t pdol_len, void* data)
1378 {
1379 uint16_t processingCmd_len = 4 + 1 + 2 + pdol_len + 1;
1380 uint8_t processingCmd[processingCmd_len];
1381
1382 processingCmd[0] = 0x80;
1383 processingCmd[1] = 0xA8;
1384 processingCmd[2] = 0x00;
1385 processingCmd[3] = 0x00;
1386 processingCmd[4] = pdol_len + 2;
1387 processingCmd[5] = 0x83; //template
1388 processingCmd[6] = pdol_len;
1389 if(pdol_len > 0){
1390 memcpy(&(processingCmd[7]), pdol, pdol_len);}
1391 processingCmd[processingCmd_len] = 0x00;
1392 return iso14_apdu(processingCmd, processingCmd_len, data);
1393 }
1394
1395 int emv_computecryptogram(uint8_t* UDOL, uint8_t UDOL_len, void *data)
1396 {
1397 uint16_t cryptogramCmd_len = 4 + 1 + UDOL_len + 1;
1398 uint8_t cryptogramCmd[cryptogramCmd_len];
1399
1400 cryptogramCmd[0] = 0x80;
1401 cryptogramCmd[1] = 0x2A;
1402 cryptogramCmd[2] = 0x8E;
1403 cryptogramCmd[3] = 0x80;
1404 cryptogramCmd[4] = UDOL_len;
1405 memcpy(&(cryptogramCmd[5]), UDOL, UDOL_len);
1406 cryptogramCmd[cryptogramCmd_len-1] = 0x00;
1407
1408 return iso14_apdu(cryptogramCmd, cryptogramCmd_len, data);
1409 }
1410
1411 int emv_getchallenge(void *data)
1412 {
1413 uint16_t challengeCmd_len = 5;
1414 uint8_t challengeCmd[challengeCmd_len];
1415
1416 challengeCmd[0] = 0x00;
1417 challengeCmd[1] = 0x84;
1418 challengeCmd[2] = 0x00;
1419 challengeCmd[3] = 0x00;
1420 challengeCmd[4] = 0x00;
1421
1422 return iso14_apdu(challengeCmd, challengeCmd_len, data);
1423 }
1424
1425 int emv_loopback(uint8_t* transData , uint8_t transData_len, void *data)
1426 {
1427 uint16_t loopbackCmd_len = 4 + 1 + transData_len + 1;
1428 uint8_t loopbackCmd[loopbackCmd_len];
1429
1430 loopbackCmd[0] = 0x00;
1431 loopbackCmd[1] = 0xEE;
1432 loopbackCmd[2] = 0x00;
1433 loopbackCmd[3] = 0x00;
1434 loopbackCmd[4] = loopbackCmd_len;
1435 memcpy(&(loopbackCmd[5]), transData, transData_len);
1436 return iso14_apdu(loopbackCmd, loopbackCmd_len, data);
1437 }
1438
1439 //generateAC
1440 int emv_generateAC(uint8_t refcontrolparam, uint8_t* cdolinput, uint8_t cdolinputlen, void* data)
1441 {
1442 uint16_t acCmd_len = 4 + 1 + cdolinputlen + 1;
1443 uint8_t acCmd[acCmd_len];
1444
1445 acCmd[0] = 0x80;
1446 acCmd[1] = 0xAE;
1447 acCmd[2] = refcontrolparam;
1448 acCmd[3] = 0x00;
1449 acCmd[4] = cdolinputlen;
1450 memcpy(&(acCmd[5]), cdolinput, cdolinputlen);
1451 acCmd[acCmd_len-1] = 0x00;
1452 Dbhexdump(acCmd_len, acCmd,false);
1453 return iso14_apdu(acCmd, acCmd_len, data);
1454 }
1455
1456 int emv_decodeAFL(uint8_t* AFL, uint8_t AFLlen ){
1457 return 0;
1458 }
1459
1460 //ICEMAN: move to client
1461 //Print out AIP Bit meanings
1462 int emv_decodeAIP(uint8_t* AIP)
1463 {
1464 if((AIP[0] & AIP_SDA_SUPPORTED) == AIP_SDA_SUPPORTED)
1465 Dbprintf("SDA supported");
1466 if((AIP[0] & AIP_DDA_SUPPORTED) == AIP_DDA_SUPPORTED)
1467 Dbprintf("DDA supported");
1468 if((AIP[0] & AIP_CARDHOLDER_VERIFICATION)==AIP_CARDHOLDER_VERIFICATION)
1469 Dbprintf("Cardholder verification is supported");
1470 if((AIP[0] & AIP_TERMINAL_RISK) == AIP_TERMINAL_RISK)
1471 Dbprintf("Terminal risk management is to be performed");
1472 if((AIP[0] & AIP_ISSUER_AUTH) == AIP_ISSUER_AUTH)
1473 Dbprintf("Issuer authentication is supported ");
1474 if((AIP[0] & AIP_CDA_SUPPORTED) == AIP_CDA_SUPPORTED)
1475 Dbprintf("CDA supported");
1476 if((AIP[1] & AIP_CHIP_SUPPORTED) == AIP_CHIP_SUPPORTED)
1477 Dbprintf("Chip supported");
1478 if((AIP[1] & AIP_MSR_SUPPORTED) == AIP_MSR_SUPPORTED)
1479 Dbprintf("MSR supported");
1480 return 0;
1481 }
1482
1483 //ICEMAN: move to client
1484 int emv_decodeCVM(uint8_t* CVM, uint8_t CVMlen)
1485 {
1486 uint8_t counter = 0;
1487 uint32_t amountX = 0;
1488 uint32_t amountY = 0;
1489 amountX = bytes_to_num(CVM, 4);
1490 amountY = bytes_to_num(CVM+4, 4);
1491 counter +=8;
1492 while(counter < CVMlen)
1493 {
1494 if((CVM[counter] & 0x40) == 0x40){
1495 if((CVM[counter] & 0x3F)== 0x00){
1496 Dbprintf("Fail CVM processing");
1497 }
1498 if((CVM[counter] & 0x3F) == 0x01){
1499 Dbprintf("Plaintext PIN verification performed by ICC");
1500 }
1501 if((CVM[counter] & 0x3F) == 0x02){
1502 Dbprintf("Enciphered PIN verified online");
1503 }
1504 if((CVM[counter] & 0x3F) == 0x03){
1505 Dbprintf("Plaintext PIN verification performed by ICC and signature (paper)");
1506 }
1507 if((CVM[counter] & 0x3F) == 0x04){
1508 Dbprintf("Enciphered PIN verification performed by ICC");
1509 }
1510 if((CVM[counter] & 0x3F) == 0x05){
1511 Dbprintf("Enciphered PIN verification performed by ICC and signature (paper)");
1512 }
1513 if((CVM[counter] & 0x3F) == 0x30){
1514 Dbprintf("Signature (paper)");
1515 }
1516 if((CVM[counter] & 0x3F) == 0x40){
1517 Dbprintf("No CVM required");
1518 }
1519 counter +=2;
1520 }
1521 else{
1522 Dbprintf("Fail cardholder verification if this CVM is unsuccessful");
1523 counter +=2;
1524 }
1525 if(CVM[counter+1] == 0x00){
1526 Dbprintf("Always");}
1527 if(CVM[counter+1] == 0x01){
1528 Dbprintf("If unattended cash");}
1529 if(CVM[counter+1] == 0x02){
1530 Dbprintf("If not unattended cash and not manual cash and not purchase with cashback");}
1531 if(CVM[counter+1] == 0x03){
1532 Dbprintf("If terminal supports the CVM");}
1533 if(CVM[counter+1] == 0x04){
1534 Dbprintf("If manual cash");}
1535 if(CVM[counter+1] == 0x05){
1536 Dbprintf("If purchase with cashback");}
1537 if(CVM[counter+1] == 0x06){
1538 Dbprintf("If transaction is in the application currency and is under %lu value", amountX);}
1539 if(CVM[counter+1] == 0x07){
1540 Dbprintf("If transaction is in the application currency and is over %lu value", amountX);}
1541 if(CVM[counter+1] == 0x08){
1542 Dbprintf("If transaction is in the application currency and is under %lu value", amountY);}
1543 if(CVM[counter+1] == 0x09){
1544 Dbprintf("If transaction is in the application currency and is over %lu value", amountY);}
1545 }
1546 return 0;
1547 }
1548
1549 //ICEMAN: move to client
1550 //dump the current card to the console
1551 void dumpCard(emvtags* currentcard){
1552 DUMP(currentcard->ATQA);
1553 Dbhexdump(sizeof(currentcard->ATQA), currentcard->ATQA, false);
1554 DUMP(currentcard->UID);
1555 Dbhexdump(currentcard->UID_len, currentcard->UID, false);
1556 DUMP(currentcard->SAK1);
1557 Dbhexdump(1, &currentcard->SAK1, false);
1558 DUMP(currentcard->SAK2);
1559 Dbhexdump(1, &currentcard->SAK2, false);
1560 DUMP(currentcard->ATS);
1561 Dbhexdump(currentcard->ATS_len, currentcard->ATS, false);
1562
1563 DUMP(currentcard->tag_4F);
1564 Dbhexdump(currentcard->tag_4F_len, currentcard->tag_4F, false);
1565 DUMP(currentcard->tag_50);
1566 Dbhexdump(currentcard->tag_50_len, currentcard->tag_50, false);
1567 DUMP(currentcard->tag_56);
1568 Dbhexdump(currentcard->tag_56_len, currentcard->tag_56, false);
1569 DUMP(currentcard->tag_57);
1570 Dbhexdump(currentcard->tag_57_len, currentcard->tag_57, false);
1571 DUMP(currentcard->tag_5A);
1572 Dbhexdump(currentcard->tag_5A_len, currentcard->tag_5A, false);
1573 DUMP(currentcard->tag_82);
1574 Dbhexdump(sizeof(currentcard->tag_82), currentcard->tag_82, false);
1575 DUMP(currentcard->tag_84);
1576 Dbhexdump(currentcard->tag_84_len, currentcard->tag_84, false);
1577 DUMP(currentcard->tag_86);
1578 Dbhexdump(currentcard->tag_86_len, currentcard->tag_86, false);
1579 DUMP(currentcard->tag_87);
1580 Dbhexdump(1, currentcard->tag_87, false);
1581 DUMP(currentcard->tag_88);
1582 Dbhexdump(1, currentcard->tag_88, false);
1583 DUMP(currentcard->tag_8A);
1584 Dbhexdump(2, currentcard->tag_8A, false);
1585 DUMP(currentcard->tag_8C);
1586 Dbhexdump(currentcard->tag_8C_len, currentcard->tag_8C, false);
1587 DUMP(currentcard->tag_8D);
1588 Dbhexdump(currentcard->tag_8D_len, currentcard->tag_8D, false);
1589 DUMP(currentcard->tag_8E);
1590 Dbhexdump(currentcard->tag_8E_len, currentcard->tag_8E, false);
1591 DUMP(currentcard->tag_8F);
1592 Dbhexdump(1, currentcard->tag_8F, false);
1593 DUMP(currentcard->tag_90);
1594 Dbhexdump(currentcard->tag_90_len, currentcard->tag_90, false);
1595 DUMP(currentcard->tag_92);
1596 Dbhexdump(currentcard->tag_92_len, currentcard->tag_92, false);
1597 DUMP(currentcard->tag_93);
1598 Dbhexdump(currentcard->tag_93_len, currentcard->tag_93, false);
1599 DUMP(currentcard->tag_94);
1600 Dbhexdump(currentcard->tag_94_len, currentcard->tag_94, false);
1601 DUMP(currentcard->tag_95);
1602 Dbhexdump(5, currentcard->tag_95, false);
1603 DUMP(currentcard->tag_97);
1604 Dbhexdump(currentcard->tag_97_len, currentcard->tag_97, false);
1605 DUMP(currentcard->tag_98);
1606 Dbhexdump(20, currentcard->tag_98, false);
1607 DUMP(currentcard->tag_99);
1608 Dbhexdump(currentcard->tag_99_len, currentcard->tag_99, false);
1609 DUMP(currentcard->tag_9A);
1610 Dbhexdump(3, currentcard->tag_9A, false);
1611 DUMP(currentcard->tag_9B);
1612 Dbhexdump(2, currentcard->tag_9B, false);
1613 DUMP(currentcard->tag_9C);
1614 Dbhexdump(1, currentcard->tag_9C, false);
1615 DUMP(currentcard->tag_9D);
1616 Dbhexdump(currentcard->tag_9D_len, currentcard->tag_9D, false);
1617 DUMP(currentcard->tag_CD);
1618 Dbhexdump(3, currentcard->tag_CD, false);
1619 DUMP(currentcard->tag_CE);
1620 Dbhexdump(3, currentcard->tag_CE, false);
1621 DUMP(currentcard->tag_CF);
1622 Dbhexdump(3, currentcard->tag_CF, false);
1623 DUMP(currentcard->tag_D7);
1624 Dbhexdump(3, currentcard->tag_D7, false);
1625 DUMP(currentcard->tag_D8);
1626 Dbhexdump(2, currentcard->tag_D8, false);
1627 DUMP(currentcard->tag_D9);
1628 Dbhexdump(currentcard->tag_D9_len, currentcard->tag_D9, false);
1629 DUMP(currentcard->tag_DA);
1630 Dbhexdump(2, currentcard->tag_DA, false);
1631 DUMP(currentcard->tag_DB);
1632 Dbhexdump(2, currentcard->tag_DB, false);
1633 DUMP(currentcard->tag_DC);
1634 Dbhexdump(2, currentcard->tag_DC, false);
1635 DUMP(currentcard->tag_DD);
1636 Dbhexdump(2, currentcard->tag_DD, false);
1637 DUMP(currentcard->tag_AF);
1638 Dbhexdump(currentcard->tag_AF_len, currentcard->tag_AF, false);
1639 DUMP(currentcard->tag_5F20);
1640 Dbhexdump(currentcard->tag_5F20_len, currentcard->tag_5F20, false);
1641 DUMP(currentcard->tag_5F24);
1642 Dbhexdump(3, currentcard->tag_5F24, false);
1643 DUMP(currentcard->tag_5F25);
1644 Dbhexdump(3, currentcard->tag_5F25, false);
1645 DUMP(currentcard->tag_5F28);
1646 Dbhexdump(2, currentcard->tag_5F28, false);
1647 DUMP(currentcard->tag_5F2A);
1648 Dbhexdump(2, currentcard->tag_5F2A, false);
1649 DUMP(currentcard->tag_5F2D);
1650 Dbhexdump(currentcard->tag_5F2D_len, currentcard->tag_5F2D, false);
1651 DUMP(currentcard->tag_5F30);
1652 Dbhexdump(3, currentcard->tag_5F30, false);
1653 DUMP(currentcard->tag_5F34);
1654 Dbhexdump(1, currentcard->tag_5F34, false);
1655 DUMP(currentcard->tag_5F36);
1656 Dbhexdump(2, currentcard->tag_5F36, false);
1657 DUMP(currentcard->tag_5F50);
1658 Dbhexdump(currentcard->tag_5F50_len, currentcard->tag_5F50, false);
1659 DUMP(currentcard->tag_5F54);
1660 Dbhexdump(currentcard->tag_5F54_len, currentcard->tag_5F54, false);
1661 DUMP(currentcard->tag_9F01);
1662 Dbhexdump(6, currentcard->tag_9F01, false);
1663 DUMP(currentcard->tag_9F02);
1664 Dbhexdump(6, currentcard->tag_9F02, false);
1665 DUMP(currentcard->tag_9F03);
1666 Dbhexdump(6, currentcard->tag_9F03, false);
1667 DUMP(currentcard->tag_9F04);
1668 Dbhexdump(4, currentcard->tag_9F04, false);
1669 DUMP(currentcard->tag_9F05);
1670 Dbhexdump(currentcard->tag_9F05_len, currentcard->tag_9F05, false);
1671 DUMP(currentcard->tag_9F06);
1672 Dbhexdump(currentcard->tag_9F06_len, currentcard->tag_9F06, false);
1673 DUMP(currentcard->tag_9F07);
1674 Dbhexdump(2, currentcard->tag_9F07, false);
1675 DUMP(currentcard->tag_9F08);
1676 Dbhexdump(2, currentcard->tag_9F08, false);
1677 DUMP(currentcard->tag_9F09);
1678 Dbhexdump(2, currentcard->tag_9F09, false);
1679 DUMP(currentcard->tag_9F0B);
1680 Dbhexdump(currentcard->tag_9F0B_len, currentcard->tag_9F0B, false);
1681 DUMP(currentcard->tag_9F0D);
1682 Dbhexdump(5, currentcard->tag_9F0D, false);
1683 DUMP(currentcard->tag_9F0E);
1684 Dbhexdump(5, currentcard->tag_9F0E, false);
1685 DUMP(currentcard->tag_9F0F);
1686 Dbhexdump(5, currentcard->tag_9F0F, false);
1687 DUMP(currentcard->tag_9F10);
1688 Dbhexdump(currentcard->tag_9F10_len, currentcard->tag_9F10, false);
1689 DUMP(currentcard->tag_9F11);
1690 Dbhexdump(1, currentcard->tag_9F11, false);
1691 DUMP(currentcard->tag_9F12);
1692 Dbhexdump(currentcard->tag_9F12_len, currentcard->tag_9F12, false);
1693 DUMP(currentcard->tag_9F13);
1694 Dbhexdump(2, currentcard->tag_9F13, false);
1695 DUMP(currentcard->tag_9F14);
1696 Dbhexdump(1, currentcard->tag_9F14, false);
1697 DUMP(currentcard->tag_9F15);
1698 Dbhexdump(2, currentcard->tag_9F15, false);
1699 DUMP(currentcard->tag_9F16);
1700 Dbhexdump(15, currentcard->tag_9F16, false);
1701 DUMP(currentcard->tag_9F17);
1702 Dbhexdump(1, currentcard->tag_9F17, false);
1703 DUMP(currentcard->tag_9F18);
1704 Dbhexdump(4, currentcard->tag_9F18, false);
1705 DUMP(currentcard->tag_9F1A);
1706 Dbhexdump(2, currentcard->tag_9F1A, false);
1707 DUMP(currentcard->tag_9F1B);
1708 Dbhexdump(4, currentcard->tag_9F1B, false);
1709 DUMP(currentcard->tag_9F1C);
1710 Dbhexdump(8, currentcard->tag_9F1C, false);
1711 DUMP(currentcard->tag_9F1D);
1712 Dbhexdump(currentcard->tag_9F1D_len, currentcard->tag_9F1D, false);
1713 DUMP(currentcard->tag_9F1E);
1714 Dbhexdump(8, currentcard->tag_9F1E, false);
1715 DUMP(currentcard->tag_9F1F);
1716 Dbhexdump(currentcard->tag_9F1F_len, currentcard->tag_9F1F, false);
1717 DUMP(currentcard->tag_9F20);
1718 Dbhexdump(currentcard->tag_9F20_len, currentcard->tag_9F20, false);
1719 DUMP(currentcard->tag_9F21);
1720 Dbhexdump(3, currentcard->tag_9F1E, false);
1721 DUMP(currentcard->tag_9F22);
1722 Dbhexdump(1, currentcard->tag_9F22, false);
1723 DUMP(currentcard->tag_9F23);
1724 Dbhexdump(1, currentcard->tag_9F23, false);
1725 DUMP(currentcard->tag_9F26);
1726 Dbhexdump(8, currentcard->tag_9F26, false);
1727 DUMP(currentcard->tag_9F27);
1728 Dbhexdump(1, currentcard->tag_9F27, false);
1729 DUMP(currentcard->tag_9F2D);
1730 Dbhexdump(currentcard->tag_9F2D_len, currentcard->tag_9F2D, false);
1731 DUMP(currentcard->tag_9F2E);
1732 Dbhexdump(3, currentcard->tag_9F2E, false);
1733 DUMP(currentcard->tag_9F2F);
1734 Dbhexdump(currentcard->tag_9F2F_len, currentcard->tag_9F2F, false);
1735 DUMP(currentcard->tag_9F32);
1736 Dbhexdump(currentcard->tag_9F32_len, currentcard->tag_9F32, false);
1737 DUMP(currentcard->tag_9F33);
1738 Dbhexdump(3, currentcard->tag_9F33, false);
1739 DUMP(currentcard->tag_9F34);
1740 Dbhexdump(3, currentcard->tag_9F34, false);
1741 DUMP(currentcard->tag_9F35);
1742 Dbhexdump(1, currentcard->tag_9F35, false);
1743 DUMP(currentcard->tag_9F36);
1744 Dbhexdump(2, currentcard->tag_9F36, false);
1745 DUMP(currentcard->tag_9F37);
1746 Dbhexdump(4, currentcard->tag_9F37, false);
1747 DUMP(currentcard->tag_9F38);
1748 Dbhexdump(currentcard->tag_9F38_len, currentcard->tag_9F38, false);
1749 DUMP(currentcard->tag_9F39);
1750 Dbhexdump(1, currentcard->tag_9F39, false);
1751 DUMP(currentcard->tag_9F39);
1752 Dbhexdump(1, currentcard->tag_9F39, false);
1753 DUMP(currentcard->tag_9F40);
1754 Dbhexdump(5, currentcard->tag_9F40, false);
1755 DUMP(currentcard->tag_9F41);
1756 Dbhexdump(4, currentcard->tag_9F41, false);
1757 DUMP(currentcard->tag_9F42);
1758 Dbhexdump(2, currentcard->tag_9F42, false);
1759 DUMP(currentcard->tag_9F43);
1760 Dbhexdump(4, currentcard->tag_9F43, false);
1761 DUMP(currentcard->tag_9F44);
1762 Dbhexdump(1, currentcard->tag_9F44, false);
1763 DUMP(currentcard->tag_9F45);
1764 Dbhexdump(2, currentcard->tag_9F45, false);
1765 DUMP(currentcard->tag_9F46);
1766 Dbhexdump(currentcard->tag_9F46_len, currentcard->tag_9F46, false);
1767 DUMP(currentcard->tag_9F47);
1768 Dbhexdump(currentcard->tag_9F47_len, currentcard->tag_9F47, false);
1769 DUMP(currentcard->tag_9F48);
1770 Dbhexdump(currentcard->tag_9F48_len, currentcard->tag_9F48, false);
1771 DUMP(currentcard->tag_9F49);
1772 Dbhexdump(currentcard->tag_9F49_len, currentcard->tag_9F49, false);
1773 DUMP(currentcard->tag_9F4A);
1774 Dbhexdump(1, currentcard->tag_9F4A, false);
1775 DUMP(currentcard->tag_9F4B);
1776 Dbhexdump(currentcard->tag_9F4B_len, currentcard->tag_9F4B, false);
1777 DUMP(currentcard->tag_9F4C);
1778 Dbhexdump(8, currentcard->tag_9F4C, false);
1779 DUMP(currentcard->tag_9F4D);
1780 Dbhexdump(2, currentcard->tag_9F4D, false);
1781 DUMP(currentcard->tag_9F4E);
1782 Dbhexdump(255, currentcard->tag_9F4E, false);
1783 DUMP(currentcard->tag_9F60);
1784 Dbhexdump(2, currentcard->tag_9F60, false);
1785 DUMP(currentcard->tag_9F61);
1786 Dbhexdump(2, currentcard->tag_9F61, false);
1787 DUMP(currentcard->tag_9F62);
1788 Dbhexdump(6, currentcard->tag_9F62, false);
1789 DUMP(currentcard->tag_9F63);
1790 Dbhexdump(6, currentcard->tag_9F63, false);
1791 DUMP(currentcard->tag_9F64);
1792 Dbhexdump(1, currentcard->tag_9F64, false);
1793 DUMP(currentcard->tag_9F65);
1794 Dbhexdump(2, currentcard->tag_9F65, false);
1795 DUMP(currentcard->tag_9F66);
1796 Dbhexdump(2, currentcard->tag_9F66, false);
1797 DUMP(currentcard->tag_9F67);
1798 Dbhexdump(1, currentcard->tag_9F67, false);
1799 DUMP(currentcard->tag_9F68);
1800 Dbhexdump(currentcard->tag_9F68_len, currentcard->tag_9F68, false);
1801 DUMP(currentcard->tag_9F69);
1802 Dbhexdump(currentcard->tag_9F69_len, currentcard->tag_9F69, false);
1803 DUMP(currentcard->tag_9F6A);
1804 Dbhexdump(8, currentcard->tag_9F6A, false);
1805 DUMP(currentcard->tag_9F6B);
1806 Dbhexdump(currentcard->tag_9F6B_len, currentcard->tag_9F6B, false);
1807 DUMP(currentcard->tag_9F6C);
1808 Dbhexdump(2, currentcard->tag_9F6C, false);
1809 DUMP(currentcard->tag_61);
1810 Dbhexdump(currentcard->tag_61_len, currentcard->tag_61, false);
1811 DUMP(currentcard->tag_A5);
1812 Dbhexdump(currentcard->tag_A5_len, currentcard->tag_A5, false);
1813 DUMP(currentcard->tag_DFNAME);
1814 Dbhexdump(currentcard->tag_DFNAME_len, currentcard->tag_DFNAME, false);
1815 DUMP(currentcard->tag_70);
1816 Dbhexdump(currentcard->tag_70_len, currentcard->tag_70, false);
1817 DUMP(currentcard->tag_77);
1818 Dbhexdump(currentcard->tag_77_len, currentcard->tag_77, false);
1819 DUMP(currentcard->tag_80);
1820 Dbhexdump(currentcard->tag_80_len, currentcard->tag_80, false);
1821 DUMP(currentcard->tag_91);
1822 Dbhexdump(currentcard->tag_91_len, currentcard->tag_91, false);
1823 DUMP(currentcard->tag_BF0C);
1824 Dbhexdump(currentcard->tag_BF0C_len, currentcard->tag_BF0C, false);
1825 DUMP(currentcard->tag_DFName);
1826 Dbhexdump(currentcard->tag_DFName_len, currentcard->tag_DFName, false);
1827 }
1828
1829
Impressum, Datenschutz