]> git.zerfleddert.de Git - proxmark3-svn/blame - armsrc/emvutil.c
CHG: removed a -L path for OSX
[proxmark3-svn] / armsrc / emvutil.c
CommitLineData
9206d3b0 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//-----------------------------------------------------------------------------
9206d3b0 11#include "emvutil.h"
9206d3b0 12
13#define DUMP(varname) Dbprintf("%s=", #varname);
14
15int 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
20int 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
41int 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;}
262else if(*(tag+1) == 0x35){
263 memcpy(&returnedtag, currentcard->tag_9F35, sizeof(currentcard->tag_9F35));
264 returnedlength = sizeof(currentcard->tag_9F35); goto exitfunction;}
265else 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;}
298else 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 }
364exitfunction: //goto label to exit search quickly once found
365 memcpy(outputval, &returnedtag, returnedlength);
366 *outputvallen = returnedlength;
367 return 0;
368}
369
370//function to
371int emv_settag(uint32_t tag, uint8_t *datain, emvtags *currentcard){
372 char binarydata[255] = {0};
373 //if((strlen((const char *)datain)%2) != 0){ //must be an even string
374 // return -1;
375 //}
376 //if(strlen((const char *)datain) > 255) {
377 // return -1;
378 //}
379 uint8_t datalen = strlen((const char *)datain) / 2; //length of datain
380 for(int i=0;i<strlen((const char *)datain);i+=2){
381 binarydata[i/2] |= (char)hex2int(datain[i]) << 4;
382 binarydata[i/2] |= (char)hex2int(datain[i+1]);
383 }
384 Dbprintf("BINARYDATA=");
385 Dbhexdump(datalen,(uint8_t *)binarydata,false);
386
387 switch(tag){
388 case 0x4F:
389 memcpy(currentcard->tag_4F, binarydata, datalen);
390 currentcard->tag_4F_len = datalen;
391 break;
392 case 0x50:
393 memcpy(currentcard->tag_50, binarydata, datalen);
394 currentcard->tag_50_len = datalen;
395 break;
396 case 0x56:
397 memcpy(currentcard->tag_56, binarydata, datalen);
398 currentcard->tag_56_len = datalen;
399 break;
400 case 0x57:
401 memcpy(currentcard->tag_57, binarydata, datalen);
402 currentcard->tag_57_len = datalen;
403 break;
404 case 0x5a:
405 memcpy(currentcard->tag_5A, binarydata, datalen);
406 currentcard->tag_5A_len = datalen;
407 break;
408 case 0x61:
409 memcpy(currentcard->tag_61, binarydata, datalen);
410 currentcard->tag_61_len = datalen;
411 break;
412 case 0x6f:
413 memcpy(currentcard->tag_6F, binarydata, datalen);
414 currentcard->tag_6F_len = datalen;
415 break;
416 case 0x70:
417 memcpy(currentcard->tag_70, binarydata, datalen);
418 currentcard->tag_70_len = datalen;
419 break;
420 case 0x77:
421 memcpy(currentcard->tag_77, binarydata, datalen);
422 currentcard->tag_77_len = datalen;
423 break;
424 case 0x80:
425 memcpy(currentcard->tag_80, binarydata, datalen);
426 currentcard->tag_80_len = datalen;
427 break;
428 case 0x82:
429 memcpy(currentcard->tag_82, binarydata, sizeof(currentcard->tag_82));
430 break;
431 case 0x84:
432 memcpy(currentcard->tag_84, binarydata, datalen);
433 currentcard->tag_84_len = datalen;
434 break;
435 case 0x86:
436 memcpy(currentcard->tag_86, binarydata, datalen);
437 currentcard->tag_86_len = datalen;
438 break;
439 case 0x87:
440 memcpy(currentcard->tag_87, binarydata, sizeof(currentcard->tag_87));
441 break;
442 case 0x88:
443 memcpy(currentcard->tag_88, binarydata, sizeof(currentcard->tag_88));
444 break;
445 case 0x8a:
446 memcpy(currentcard->tag_8A, binarydata, sizeof(currentcard->tag_8A));
447 break;
448 case 0x8c:
449 memcpy(currentcard->tag_8C, binarydata, datalen);
450 currentcard->tag_8C_len = datalen;
451 break;
452 case 0x8d:
453 memcpy(currentcard->tag_8D, binarydata, datalen);
454 currentcard->tag_8D_len = datalen;
455 break;
456 case 0x8e:
457 memcpy(currentcard->tag_8E, binarydata, datalen);
458 currentcard->tag_8E_len = datalen;
459 break;
460 case 0x8f:
461 memcpy(currentcard->tag_8F, binarydata, sizeof(currentcard->tag_8F));
462 break;
463 case 0x90:
464 memcpy(currentcard->tag_90, binarydata, datalen);
465 currentcard->tag_90_len = datalen;
466 break;
467 case 0x91:
468 memcpy(currentcard->tag_91, binarydata, datalen);
469 currentcard->tag_91_len = datalen;
470 break;
471 case 0x92:
472 memcpy(currentcard->tag_92, binarydata, datalen);
473 currentcard->tag_92_len = datalen;
474 break;
475 case 0x93:
476 memcpy(currentcard->tag_93, binarydata, datalen);
477 currentcard->tag_93_len = datalen;
478 break;
479 case 0x94:
480 memcpy(currentcard->tag_94, binarydata, datalen);
481 currentcard->tag_94_len = datalen;
482 break;
483 case 0x95:
484 memcpy(currentcard->tag_95, binarydata, sizeof(currentcard->tag_95));
485 break;
486 case 0x97:
487 memcpy(currentcard->tag_97, binarydata, datalen);
488 currentcard->tag_97_len = datalen;
489 break;
490 case 0x98:
491 memcpy(currentcard->tag_98, binarydata, sizeof(currentcard->tag_98));
492 break;
493 case 0x99:
494 memcpy(currentcard->tag_99, binarydata, datalen);
495 currentcard->tag_99_len = datalen;
496 break;
497 case 0x9a:
498 memcpy(currentcard->tag_9A, binarydata, sizeof(currentcard->tag_9A));
499 break;
500 case 0x9b:
501 memcpy(currentcard->tag_9B, binarydata, sizeof(currentcard->tag_9B));
502 break;
503 case 0x9c:
504 memcpy(currentcard->tag_9C, binarydata, sizeof(currentcard->tag_9C));
505 break;
506 case 0x9d:
507 memcpy(currentcard->tag_9D, binarydata, datalen);
508 currentcard->tag_9D_len = datalen;
509 break;
510 case 0xa5:
511 memcpy(currentcard->tag_A5, binarydata, datalen);
512 currentcard->tag_A5_len = datalen;
513 break;
514 case 0xaf:
515 memcpy(currentcard->tag_AF, binarydata, datalen);
516 currentcard->tag_AF_len = datalen;
517 break;
518 case 0xcd:
519 memcpy(currentcard->tag_CD, binarydata, sizeof(currentcard->tag_CD));
520 break;
521 case 0xce:
522 memcpy(currentcard->tag_CE, binarydata, sizeof(currentcard->tag_CE));
523 break;
524 case 0xcf:
525 memcpy(currentcard->tag_CF, binarydata, sizeof(currentcard->tag_CF));
526 break;
527 case 0xd7:
528 memcpy(currentcard->tag_CF, binarydata, sizeof(currentcard->tag_CF));
529 break;
530 case 0xd8:
531 memcpy(currentcard->tag_CF, binarydata, sizeof(currentcard->tag_CF));
532 break;
533 case 0xd9:
534 break;
535 case 0xda:
536 memcpy(currentcard->tag_DA, binarydata, sizeof(currentcard->tag_DA));
537 break;
538 case 0xdb:
539 memcpy(currentcard->tag_DB, binarydata, sizeof(currentcard->tag_DB));
540 break;
541 case 0xdc:
542 memcpy(currentcard->tag_DB, binarydata, sizeof(currentcard->tag_DB));
543 break;
544 case 0xdd:
545 memcpy(currentcard->tag_DD, binarydata, sizeof(currentcard->tag_DD));
546 break;
547 case 0x5f20:
548 break;
549 case 0x5f24:
550 memcpy(currentcard->tag_5F24, binarydata, sizeof(currentcard->tag_5F24));
551 break;
552 case 0x5f25:
553 memcpy(currentcard->tag_5F25, binarydata, sizeof(currentcard->tag_5F25));
554 break;
555 case 0x5f28:
556 memcpy(currentcard->tag_5F28, binarydata, sizeof(currentcard->tag_5F28));
557 break;
558 case 0x5f2a:
559 memcpy(currentcard->tag_5F2A, binarydata, sizeof(currentcard->tag_5F2A));
560 break;
561 case 0x5f2d:
562 break;
563 case 0x5f30:
564 memcpy(currentcard->tag_5F30, binarydata, sizeof(currentcard->tag_5F30));
565 break;
566 case 0x5f34:
567 memcpy(currentcard->tag_5F34, binarydata, sizeof(currentcard->tag_5F34));
568 break;
569 case 0x5f36:
570 memcpy(currentcard->tag_5F36, binarydata, sizeof(currentcard->tag_5F36));
571 break;
572 case 0x5f50:
573 break;
574 case 0x5f54:
575 memcpy(currentcard->tag_5F54, binarydata, sizeof(currentcard->tag_5F54));
576 break;
577 case 0x9f01:
578 memcpy(currentcard->tag_9F01, binarydata, sizeof(currentcard->tag_9F01));
579 break;
580 case 0x9f02:
581 memcpy(currentcard->tag_9F02, binarydata, sizeof(currentcard->tag_9F02));
582 break;
583 case 0x9f03:
584 memcpy(currentcard->tag_9F03, binarydata, sizeof(currentcard->tag_9F03));
585 break;
586 case 0x9f04:
587 memcpy(currentcard->tag_9F04, binarydata, sizeof(currentcard->tag_9F04));
588 break;
589 case 0x9f05:
590 memcpy(currentcard->tag_9F05, binarydata, datalen);
591 currentcard->tag_9F05_len = datalen;
592 break;
593 case 0x9f06:
594 memcpy(currentcard->tag_9F06, binarydata, datalen);
595 currentcard->tag_9F06_len = datalen;
596 break;
597 case 0x9f07:
598 memcpy(currentcard->tag_9F07, binarydata, sizeof(currentcard->tag_9F07));
599 break;
600 case 0x9f08:
601 memcpy(currentcard->tag_9F08, binarydata, sizeof(currentcard->tag_9F08));
602 break;
603 case 0x9f09:
604 memcpy(currentcard->tag_9F09, binarydata, sizeof(currentcard->tag_9F09));
605 break;
606 case 0x9f0b:
607 memcpy(currentcard->tag_9F0B, binarydata, sizeof(currentcard->tag_9F0B));
608 break;
609 case 0x9f0d:
610 memcpy(currentcard->tag_9F0D, binarydata, sizeof(currentcard->tag_9F0D));
611 break;
612 case 0x9f0e:
613 memcpy(currentcard->tag_9F0E, binarydata, sizeof(currentcard->tag_9F0E));
614 break;
615 case 0x9f0f:
616 memcpy(currentcard->tag_9F0F, binarydata, sizeof(currentcard->tag_9F0F));
617 break;
618 case 0x9f10:
619 memcpy(currentcard->tag_9F10, binarydata, datalen);
620 currentcard->tag_9F10_len = datalen;break;
621 case 0x9f11:
622 memcpy(currentcard->tag_9F11, binarydata, sizeof(currentcard->tag_9F11));
623 break;
624 case 0x9f12:
625 memcpy(currentcard->tag_9F12, binarydata, datalen);
626 currentcard->tag_9F12_len = datalen;break;
627 case 0x9f13:
628 memcpy(currentcard->tag_9F13, binarydata, sizeof(currentcard->tag_9F13));
629 break;
630 case 0x9f14:
631 memcpy(currentcard->tag_9F14, binarydata, sizeof(currentcard->tag_9F14));
632 break;
633 case 0x9f15:
634 memcpy(currentcard->tag_9F15, binarydata, sizeof(currentcard->tag_9F15));
635 break;
636 case 0x9f16:
637 memcpy(currentcard->tag_9F16, binarydata, sizeof(currentcard->tag_9F16));
638 break;
639 case 0x9f17:
640 memcpy(currentcard->tag_9F17, binarydata, sizeof(currentcard->tag_9F17));
641 break;
642 case 0x9f18:
643 memcpy(currentcard->tag_9F18, binarydata, sizeof(currentcard->tag_9F18));
644 break;
645 case 0x9f1a:
646 memcpy(currentcard->tag_9F1A, binarydata, sizeof(currentcard->tag_9F1A));
647 break;
648 case 0x9f1b:
649 memcpy(currentcard->tag_9F1B, binarydata, sizeof(currentcard->tag_9F1B));
650 break;
651 case 0x9f1c:
652 memcpy(currentcard->tag_9F1C, binarydata, sizeof(currentcard->tag_9F1C));
653 break;
654 case 0x9f1d:
655 memcpy(currentcard->tag_9F1D, binarydata, datalen);
656 currentcard->tag_9F1D_len = datalen;break;
657 case 0x9f1e:
658 memcpy(currentcard->tag_9F1E, binarydata, sizeof(currentcard->tag_9F1E));
659 break;
660 case 0x9f1f:
661 memcpy(currentcard->tag_9F1F, binarydata, datalen);
662 currentcard->tag_9F1F_len = datalen;break;
663 case 0x9f20:
664 memcpy(currentcard->tag_9F20, binarydata, datalen);
665 currentcard->tag_9F20_len = datalen;break;
666 case 0x9f21:
667 memcpy(currentcard->tag_9F21, binarydata, sizeof(currentcard->tag_9F21));
668 break;
669 case 0x9f22:
670 memcpy(currentcard->tag_9F22, binarydata, sizeof(currentcard->tag_9F22));
671 break;
672 case 0x9f23:
673 memcpy(currentcard->tag_9F23, binarydata, sizeof(currentcard->tag_9F23));
674 break;
675 case 0x9f26:
676 memcpy(currentcard->tag_9F26, binarydata, sizeof(currentcard->tag_9F26));
677 break;
678 case 0x9f27:
679 memcpy(currentcard->tag_9F27, binarydata, sizeof(currentcard->tag_9F27));
680 break;
681 case 0x9f2d:
682 memcpy(currentcard->tag_9F2D, binarydata, datalen);
683 currentcard->tag_9F2D_len = datalen;break;
684 case 0x9f2e:
685 memcpy(currentcard->tag_9F2E, binarydata, sizeof(currentcard->tag_9F2E));
686 break;
687 case 0x9f2f:
688 memcpy(currentcard->tag_9F2F, binarydata, datalen);
689 currentcard->tag_9F2F_len = datalen;break;
690 case 0x9f32:
691 memcpy(currentcard->tag_9F32, binarydata, datalen);
692 currentcard->tag_9F32_len = datalen;break;
693 case 0x9f33:
694 memcpy(currentcard->tag_9F33, binarydata, sizeof(currentcard->tag_9F33));
695 break;
696 case 0x9f34:
697 memcpy(currentcard->tag_9F34, binarydata, sizeof(currentcard->tag_9F34));
698 break;
699 case 0x9f35:
700 memcpy(currentcard->tag_9F35, binarydata, sizeof(currentcard->tag_9F35));
701 break;
702 case 0x9f36:
703 memcpy(currentcard->tag_9F36, binarydata, sizeof(currentcard->tag_9F36));
704 break;
705 case 0x9f37:
706 memcpy(currentcard->tag_9F37, binarydata, sizeof(currentcard->tag_9F37));
707 break;
708 case 0x9f38:
709 break;
710 case 0x9f39:
711 memcpy(currentcard->tag_9F39, binarydata, sizeof(currentcard->tag_9F39));
712 break;
713 case 0x9f40:
714 memcpy(currentcard->tag_9F40, binarydata, sizeof(currentcard->tag_9F40));
715 break;
716 case 0x9f41:
717 memcpy(currentcard->tag_9F41, binarydata, sizeof(currentcard->tag_9F41));
718 break;
719 case 0x9f42:
720 memcpy(currentcard->tag_9F42, binarydata, sizeof(currentcard->tag_9F42));
721 break;
722 case 0x9f43:
723 memcpy(currentcard->tag_9F43, binarydata, sizeof(currentcard->tag_9F43));
724 break;
725 case 0x9f44:
726 memcpy(currentcard->tag_9F44, binarydata, sizeof(currentcard->tag_9F44));
727 break;
728 case 0x9f45:
729 memcpy(currentcard->tag_9F45, binarydata, sizeof(currentcard->tag_9F45));
730 break;
731 case 0x9f46:
732 memcpy(currentcard->tag_9F46, binarydata, datalen);
733 currentcard->tag_9F46_len = datalen;break;
734 case 0x9f47:
735 memcpy(currentcard->tag_9F47, binarydata, datalen);
736 currentcard->tag_9F47_len = datalen;break;
737 case 0x9f48:
738 memcpy(currentcard->tag_9F48, binarydata, datalen);
739 currentcard->tag_9F48_len = datalen;break;
740 case 0x9f49:
741 memcpy(currentcard->tag_9F49, binarydata, datalen);
742 currentcard->tag_9F49_len = datalen;break;
743 case 0x9f4a:
744 memcpy(currentcard->tag_9F4A, binarydata, sizeof(currentcard->tag_9F4A));
745 break;
746 case 0x9f4b:
747 memcpy(currentcard->tag_9F4B, binarydata, datalen);
748 currentcard->tag_9F4B_len = datalen;break;
749 case 0x9f4c:
750 memcpy(currentcard->tag_9F4C, binarydata, sizeof(currentcard->tag_9F4C));
751 break;
752 case 0x9f4d:
753 memcpy(currentcard->tag_9F4D, binarydata, sizeof(currentcard->tag_9F4D));
754 break;
755 case 0x9f4e:
756 memcpy(currentcard->tag_9F4E, binarydata, sizeof(currentcard->tag_9F4E));
757 break;
758 case 0x9f60:
759 memcpy(currentcard->tag_9F60, binarydata, sizeof(currentcard->tag_9F60));
760 break;
761 case 0x9f61:
762 memcpy(currentcard->tag_9F61, binarydata, sizeof(currentcard->tag_9F61));
763 break;
764 case 0x9f62:
765 memcpy(currentcard->tag_9F62, binarydata, sizeof(currentcard->tag_9F62));
766 break;
767 case 0x9f63:
768 memcpy(currentcard->tag_9F63, binarydata, sizeof(currentcard->tag_9F63));
769 break;
770 case 0x9f64:
771 memcpy(currentcard->tag_9F64, binarydata, sizeof(currentcard->tag_9F64));
772 break;
773 case 0x9f65:
774 memcpy(currentcard->tag_9F65, binarydata, sizeof(currentcard->tag_9F65));
775 break;
776 case 0x9f66:
777 memcpy(currentcard->tag_9F66, binarydata, sizeof(currentcard->tag_9F66));
778 break;
779 case 0x9f67:
780 memcpy(currentcard->tag_9F67, binarydata, sizeof(currentcard->tag_9F67));
781 break;
782 case 0x9f68:
783 memcpy(currentcard->tag_9F68, binarydata, datalen);
784 currentcard->tag_9F68_len = datalen;break;
785 case 0x9f69:
786 memcpy(currentcard->tag_9F69, binarydata, datalen);
787 currentcard->tag_9F69_len = datalen;break;
788 case 0x9f6a:
789 memcpy(currentcard->tag_9F6A, binarydata, sizeof(currentcard->tag_9F6A));
790 break;
791 case 0x9f6b:
792 memcpy(currentcard->tag_9F6B, binarydata, sizeof(currentcard->tag_9F6B));
793 break;
794 case 0x9f6c:
795 memcpy(currentcard->tag_9F6C, binarydata, sizeof(currentcard->tag_9F6C));
796 break;
797 case 0xbf0c:
798 memcpy(currentcard->tag_BF0C, binarydata, datalen);
799 currentcard->tag_BF0C_len = datalen;break;
800 default:
801 break;
802 }
803 return 0;
804}
805
806/* generates an emv template based off tag values supplied */
807int emv_generatetemplate(uint8_t* templateval,emvtags* currentcard, uint8_t* returnedval, uint8_t* returnedlen,uint8_t numtags, ...)
808{
809 va_list arguments;
810 uint8_t* currenttag; //value of the current tag
811 uint8_t tagval[255]; //buffer to hold the extracted tag value
812 uint8_t taglen = 0; //extracted tag length
813 uint8_t bufferval[255];
814 uint8_t counter = 0;
815 uint32_t encodedlen = 0;
816 va_start(arguments, numtags);
817 for(int x=0; x<numtags; x++){
818 currenttag = va_arg(arguments, uint8_t*);
819 emv_lookuptag(currenttag, currentcard, tagval, &taglen);
820 encode_ber_tlv_item(currenttag, (uint8_t)strlen((const char*)currenttag), tagval, (uint32_t)taglen, bufferval+counter, &encodedlen);
821 counter +=encodedlen;
822 }
823 encode_ber_tlv_item(templateval, strlen((const char*) templateval), bufferval, counter, returnedval, &encodedlen);
824 *returnedlen = encodedlen;
825 return 0;
826}
827
828//generate a valid pdol list
829int emv_generateDOL(uint8_t* DOL, uint8_t DOLlen,emvtags* currentcard,uint8_t* DOLoutput, uint8_t* DOLoutputlen)
830{
831 if(!DOL || !currentcard || !DOLoutput) // null pointer checks
832 return 1;
833 //scan through the DOL list and construct the result.
834 uint8_t i = 0;
835 uint8_t DOLcounter = 0; //points to the current DOL buffer location
836 uint8_t scannedtaglen = 0; //length of a scanned tag
837 uint8_t scannedtag[2] = {0x00,0x00}; //buffer for the scanned tag
838 uint8_t DOLoutputbuffer[255];
839 uint8_t retrievedtagvallen;
840
841 memset(DOLoutputbuffer,0x00, 255); //clear the output buffer
842 while(i < DOLlen)
843 {
844 //length of DOL tag
845 if((*(DOL+i) & 0x1F) == 0x1F)
846 { scannedtaglen = 2;}
847 else
848 {scannedtaglen=1;}
849 memcpy(scannedtag, DOL+i,scannedtaglen);
850 //look up tag value and copy
851 //Dbhexdump(2,scannedtag,false);
852 emv_lookuptag(scannedtag,currentcard,&(DOLoutputbuffer[DOLcounter]),&retrievedtagvallen);
853 DOLcounter += (uint8_t)DOL[i+scannedtaglen];
854 i += scannedtaglen + 1;
855 memset(scannedtag, 0x00, 2); //clear current tag
856
857 }
858 memcpy(DOLoutput, DOLoutputbuffer, DOLcounter);
859 *DOLoutputlen = DOLcounter;
860 return 0;
861}
862
863
864//decode the tag inputted and fill in the supplied structure. clean up the cleanup_passpass function
865int emv_emvtags_decode_tag(tlvtag* inputtag, emvtags* currentcard)
866{
867 if(!inputtag || !currentcard) {
868 return 1;
869 }
870 //scan decoded tag
871 if(*(inputtag->tag) == 0x5F) {
872 if(*(inputtag->tag+1) == 0x20){
873 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F20)))
874 return 1;
875 memcpy(currentcard->tag_5F20, inputtag->value, inputtag->valuelength);
876 currentcard->tag_5F20_len = inputtag->valuelength;
877 }
878 if(*(inputtag->tag+1) == 0x24){
879 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F24)))
880 return 1;
881 memcpy(currentcard->tag_5F24, inputtag->value, sizeof(currentcard->tag_5F24));}
882 if(*(inputtag->tag+1) == 0x25){
883 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F25)))
884 return 1;
885 memcpy(currentcard->tag_5F25, inputtag->value, inputtag->valuelength);}
886 if(*(inputtag->tag+1) == 0x28){
887 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F28)))
888 return 1;
889 memcpy(currentcard->tag_5F28, inputtag->value, inputtag->valuelength);}
890 if(*(inputtag->tag+1) == 0x2A){
891 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F2A)))
892 return 1;
893 memcpy(currentcard->tag_5F2A, inputtag->value, inputtag->valuelength);}
894 if(*(inputtag->tag+1) == 0x2D){
895 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F2D)))
896 return 1;
897 memcpy(currentcard->tag_5F2D, inputtag->value, inputtag->valuelength);
898 currentcard->tag_5F2D_len = inputtag->valuelength;}
899 if(*(inputtag->tag+1) == 0x30){
900 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F30)))
901 return 1;
902 memcpy(currentcard->tag_5F30, inputtag->value, inputtag->valuelength);}
903 if(*(inputtag->tag+1) == 0x34){
904 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F34)))
905 return 1;
906 memcpy(currentcard->tag_5F34, inputtag->value, sizeof(currentcard->tag_5F34));}
907 if(*(inputtag->tag+1) == 0x36){
908 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F36)))
909 return 1;
910 memcpy(currentcard->tag_5F36, inputtag->value, sizeof(currentcard->tag_5F36));}
911 if(*(inputtag->tag+1) == 0x50){
912 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F50)))
913 return 1;
914 memcpy(currentcard->tag_5F50, inputtag->value, inputtag->valuelength);
915 currentcard->tag_5F50_len = inputtag->valuelength;}
916 if(*(inputtag->tag+1) == 0x54){
917 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F54)))
918 return 1;
919 memcpy(currentcard->tag_5F54, inputtag->value, inputtag->valuelength);
920 currentcard->tag_5F54_len = inputtag->valuelength;}
921 }
922 if(*(inputtag->tag) == 0x9F){
923 if(*(inputtag->tag+1) == 0x01){
924 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F01)))
925 return 1;
926 memcpy(currentcard->tag_9F01, inputtag->value, inputtag->valuelength);}
927 if(*(inputtag->tag+1) == 0x02){
928 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F02)))
929 return 1;
930 memcpy(currentcard->tag_9F02, inputtag->value, inputtag->valuelength);}
931 if(*(inputtag->tag+1) == 0x03){
932 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F03)))
933 return 1;
934 memcpy(currentcard->tag_9F03, inputtag->value, inputtag->valuelength);}
935 if(*(inputtag->tag+1) == 0x04){
936 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F04)))
937 return 1;
938 memcpy(currentcard->tag_9F04, inputtag->value, inputtag->valuelength);}
939 if(*(inputtag->tag+1) == 0x05){
940 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F05)))
941 return 1;
942 memcpy(currentcard->tag_9F05, inputtag->value, inputtag->valuelength);
943 currentcard->tag_9F05_len = inputtag->valuelength;}
944 if(*(inputtag->tag+1) == 0x06){
945 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F06)))
946 return 1;
947 memcpy(currentcard->tag_9F06, inputtag->value, inputtag->valuelength);
948 currentcard->tag_9F06_len = inputtag->valuelength;}
949 if(*(inputtag->tag+1) == 0x07){
950 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F07)))
951 return 1;
952 memcpy(currentcard->tag_9F07, inputtag->value, inputtag->valuelength);}
953 if(*(inputtag->tag+1) == 0x08){
954 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F08)))
955 return 1;
956 memcpy(currentcard->tag_9F08, inputtag->value, inputtag->valuelength);}
957 if(*(inputtag->tag+1) == 0x09){
958 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F09)))
959 return 1;
960 memcpy(currentcard->tag_9F09, inputtag->value, inputtag->valuelength);}
961 if(*(inputtag->tag+1) == 0x0B){
962 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F0B)))
963 return 1;
964 memcpy(currentcard->tag_9F0B, inputtag->value, inputtag->valuelength);
965 currentcard->tag_9F0B_len = inputtag->valuelength;}
966 if(*(inputtag->tag+1) == 0x0D){
967 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F0D)))
968 return 1;
969 memcpy(currentcard->tag_9F0D, inputtag->value, inputtag->valuelength);}
970 if(*(inputtag->tag+1) == 0x0E){
971 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F0E)))
972 return 1;
973 memcpy(currentcard->tag_9F0E, inputtag->value, inputtag->valuelength);}
974 if(*(inputtag->tag+1) == 0x0F){
975 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F0F)))
976 return 1;
977 memcpy(currentcard->tag_9F0F, inputtag->value, inputtag->valuelength);}
978 if(*(inputtag->tag+1) == 0x11){
979 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F11)))
980 return 1;
981 memcpy(currentcard->tag_9F11, inputtag->value, inputtag->valuelength);}
982 if(*(inputtag->tag+1) == 0x12){
983 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F12)))
984 return 1;
985 memcpy(currentcard->tag_9F12, inputtag->value, inputtag->valuelength);
986 currentcard->tag_9F12_len = inputtag->valuelength;}
987 if(*(inputtag->tag+1) == 0x13){
988 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F13)))
989 return 1;
990 memcpy(currentcard->tag_9F13, inputtag->value, inputtag->valuelength);}
991 if(*(inputtag->tag+1) == 0x14){
992 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F14)))
993 return 1;
994 memcpy(currentcard->tag_9F14, inputtag->value, inputtag->valuelength);}
995 if(*(inputtag->tag+1) == 0x15){
996 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F15)))
997 return 1;
998 memcpy(currentcard->tag_9F15, inputtag->value, inputtag->valuelength);}
999 if(*(inputtag->tag+1) == 0x16){
1000 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F16)))
1001 return 1;
1002 memcpy(currentcard->tag_9F16, inputtag->value, inputtag->valuelength);}
1003 if(*(inputtag->tag+1) == 0x17){
1004 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F17)))
1005 return 1;
1006 memcpy(currentcard->tag_9F17, inputtag->value, inputtag->valuelength);}
1007 if(*(inputtag->tag+1) == 0x18){
1008 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F18)))
1009 return 1;
1010 memcpy(currentcard->tag_9F18, inputtag->value, inputtag->valuelength);}
1011 if(*(inputtag->tag+1) == 0x1A){
1012 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F1A)))
1013 return 1;
1014 memcpy(currentcard->tag_9F1A, inputtag->value, inputtag->valuelength);}
1015 if(*(inputtag->tag+1) == 0x1B){
1016 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F1B)))
1017 return 1;
1018 memcpy(currentcard->tag_9F1B, inputtag->value, inputtag->valuelength);}
1019 if(*(inputtag->tag+1) == 0x1C){
1020 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F1C)))
1021 return 1;
1022 memcpy(currentcard->tag_9F1C, inputtag->value, inputtag->valuelength);}
1023 if(*(inputtag->tag+1) == 0x1D){
1024 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F1D)))
1025 return 1;
1026 memcpy(currentcard->tag_9F1D, inputtag->value, inputtag->valuelength);
1027 currentcard->tag_9F1D_len = inputtag->valuelength;}
1028 if(*(inputtag->tag+1) == 0x1E){
1029 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F1E)))
1030 return 1;
1031 memcpy(currentcard->tag_9F1E, inputtag->value, inputtag->valuelength);}
1032 if(*(inputtag->tag+1) == 0x1F){
1033 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F1F)))
1034 return 1;
1035 memcpy(currentcard->tag_9F1F, inputtag->value, inputtag->valuelength);
1036 currentcard->tag_9F1F_len = inputtag->valuelength;}
1037 if(*(inputtag->tag+1) == 0x32){
1038 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F32)))
1039 return 1;
1040 currentcard->tag_9F32_len = inputtag->valuelength;
1041 memcpy(currentcard->tag_9F32, inputtag->value, inputtag->valuelength);
1042 }
1043 if(*(inputtag->tag+1) == 0x34){
1044 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F34)))
1045 return 1;
1046 memcpy(currentcard->tag_9F34, inputtag->value, inputtag->valuelength);}
1047if(*(inputtag->tag+1) == 0x35){
1048 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F35)))
1049 return 1;
1050 memcpy(currentcard->tag_9F35, inputtag->value, inputtag->valuelength);}
1051if(*(inputtag->tag+1) == 0x37){
1052 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F37)))
1053 return 1;
1054 memcpy(currentcard->tag_9F37, inputtag->value, inputtag->valuelength);}
1055 if(*(inputtag->tag+1) == 0x38){
1056 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F38)))
1057 return 1;
1058 memcpy(currentcard->tag_9F38, inputtag->value, inputtag->valuelength);
1059 currentcard->tag_9F38_len = inputtag->valuelength;}
1060 if(*(inputtag->tag+1) == 0x44){
1061 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F44)))
1062 return 1;
1063 memcpy(currentcard->tag_9F44, inputtag->value, inputtag->valuelength);}
1064 if(*(inputtag->tag+1) == 0x45){
1065 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F45)))
1066 return 1;
1067 memcpy(currentcard->tag_9F45, inputtag->value, inputtag->valuelength);}
1068if(*(inputtag->tag+1) == 0x46){
1069 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F46)))
1070 return 1;
1071 memcpy(currentcard->tag_9F46, inputtag->value, inputtag->valuelength);
1072 currentcard->tag_9F46_len = inputtag->valuelength;}
1073 if(*(inputtag->tag+1) == 0x47){
1074 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F47)))
1075 return 1;
1076 memcpy(currentcard->tag_9F47, inputtag->value, inputtag->valuelength);
1077 currentcard->tag_9F47_len = inputtag->valuelength;}
1078 if(*(inputtag->tag+1) == 0x48){
1079 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F48)))
1080 return 1;
1081 memcpy(currentcard->tag_9F48, inputtag->value, inputtag->valuelength);
1082 currentcard->tag_9F48_len = inputtag->valuelength;}
1083 if(*(inputtag->tag+1) == 0x49){
1084 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F49)))
1085 return 1;
1086 memcpy(currentcard->tag_9F49, inputtag->value, inputtag->valuelength);
1087 currentcard->tag_9F49_len = inputtag->valuelength;}
1088 if(*(inputtag->tag+1) == 0x4A){
1089 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F4A)))
1090 return 1;
1091 memcpy(currentcard->tag_9F4A, inputtag->value, inputtag->valuelength);}
1092 if(*(inputtag->tag+1) == 0x4B){
1093 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F4B)))
1094 return 1;
1095 memcpy(currentcard->tag_9F4B, inputtag->value, inputtag->valuelength);
1096 currentcard->tag_9F4B_len = inputtag->valuelength;}
1097 if(*(inputtag->tag+1) == 0x4C){
1098 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F4C)))
1099 return 1;
1100 memcpy(currentcard->tag_9F4C, inputtag->value, inputtag->valuelength);}
1101if(*(inputtag->tag+1) == 0x60){
1102 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F60)))
1103 return 1;
1104 memcpy(currentcard->tag_9F60, inputtag->value, inputtag->valuelength);}
1105 if(*(inputtag->tag+1) == 0x61){
1106 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F61)))
1107 return 1;
1108 memcpy(currentcard->tag_9F61, inputtag->value, inputtag->valuelength);}
1109 if(*(inputtag->tag+1) == 0x62){
1110 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F62)))
1111 return 1;
1112 memcpy(currentcard->tag_9F62, inputtag->value, inputtag->valuelength);}
1113 if(*(inputtag->tag+1) == 0x63){
1114 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F63)))
1115 return 1;
1116 memcpy(currentcard->tag_9F63, inputtag->value, inputtag->valuelength);}
1117 if(*(inputtag->tag+1) == 0x64){
1118 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F64)))
1119 return 1;
1120 memcpy(currentcard->tag_9F64, inputtag->value, inputtag->valuelength);}
1121 if(*(inputtag->tag+1) == 0x65){
1122 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F65)))
1123 return 1;
1124 memcpy(currentcard->tag_9F65, inputtag->value, inputtag->valuelength);}
1125 if(*(inputtag->tag+1) == 0x66){
1126 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F66)))
1127 return 1;
1128 memcpy(currentcard->tag_9F66, inputtag->value, inputtag->valuelength);}
1129 if(*(inputtag->tag+1) == 0x67){
1130 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F67)))
1131 return 1;
1132 memcpy(currentcard->tag_9F67, inputtag->value, inputtag->valuelength);}
1133 if(*(inputtag->tag+1) == 0x68){
1134 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F68)))
1135 return 1;
1136 memcpy(currentcard->tag_9F68, inputtag->value, inputtag->valuelength);
1137 currentcard->tag_9F68_len = inputtag->valuelength;}
1138 if(*(inputtag->tag+1) == 0x69){
1139 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F69)))
1140 return 1;
1141 memcpy(currentcard->tag_9F69, inputtag->value, inputtag->valuelength);
1142 currentcard->tag_9F69_len = inputtag->valuelength;}
1143 if(*(inputtag->tag+1) == 0x6A){
1144 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F6A)))
1145 return 1;
1146 memcpy(currentcard->tag_9F6A, inputtag->value, inputtag->valuelength);}
1147 if(*(inputtag->tag+1) == 0x6B){
1148 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F6B)))
1149 return 1;
1150 memcpy(currentcard->tag_9F6B, inputtag->value, inputtag->valuelength);
1151 currentcard->tag_9F6B_len = inputtag->valuelength;}
1152 if(*(inputtag->tag+1) == 0x6C){
1153 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F6C)))
1154 return 1;
1155 memcpy(currentcard->tag_9F6C, inputtag->value, inputtag->valuelength);}
1156}
1157else
1158{
1159 if(*(inputtag->tag) == 0xBF){ //BF0C
1160 if(*(inputtag->tag+1) == 0x0C){
1161 if(!(inputtag->valuelength <= sizeof(currentcard->tag_BF0C)))
1162 return 1;
1163 memcpy(currentcard->tag_BF0C, inputtag->value, inputtag->valuelength);
1164 currentcard->tag_BF0C_len = inputtag->valuelength;}
1165 }
1166 else if(*(inputtag->tag) == 0x4F){ //BF0C
1167 if(!(inputtag->valuelength <= sizeof(currentcard->tag_4F)))
1168 return 1;
1169 memcpy(currentcard->tag_4F, inputtag->value, inputtag->valuelength);
1170 currentcard->tag_4F_len = inputtag->valuelength;}
1171 else if(*(inputtag->tag) == 0x50){ //BF0C
1172 if(!(inputtag->valuelength <= sizeof(currentcard->tag_50)))
1173 return 1;
1174 memcpy(currentcard->tag_50, inputtag->value, inputtag->valuelength);
1175 currentcard->tag_50_len = inputtag->valuelength;
1176 }
1177 else if(*(inputtag->tag) == 0x56){ //BF0C
1178 if(!(inputtag->valuelength <= sizeof(currentcard->tag_56)))
1179 return 1;
1180 memcpy(currentcard->tag_56, inputtag->value, inputtag->valuelength);
1181 currentcard->tag_56_len = inputtag->valuelength;
1182 }
1183 else if(*(inputtag->tag) == 0x57){ //BF0C
1184 if(!(inputtag->valuelength <= sizeof(currentcard->tag_57)))
1185 return 1;
1186 memcpy(currentcard->tag_57, inputtag->value, inputtag->valuelength);
1187 currentcard->tag_57_len = inputtag->valuelength;
1188 }
1189 else if(*(inputtag->tag) == 0x5A){ //BF0C
1190 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5A)))
1191 return 1;
1192 memcpy(currentcard->tag_5A, inputtag->value, inputtag->valuelength);
1193 currentcard->tag_5A_len = inputtag->valuelength;}
1194 else if(*(inputtag->tag) == 0x61){ //BF0C
1195 if(!(inputtag->valuelength <= sizeof(currentcard->tag_61)))
1196 return 1;
1197 memcpy(currentcard->tag_61, inputtag->value, inputtag->valuelength);
1198 currentcard->tag_61_len = inputtag->valuelength;
1199 }
1200 else if(*(inputtag->tag) == 0x6F){ //BF0C
1201 memcpy(currentcard->tag_6F,inputtag->value,inputtag->valuelength);}
1202
1203 else if(*(inputtag->tag) == 0x70){ //BF0C
1204 memcpy(currentcard->tag_70,inputtag->value,inputtag->valuelength);}
1205 else if(*(inputtag->tag) == 0x77){ //BF0C
1206 memcpy(currentcard->tag_77,inputtag->value,inputtag->valuelength);}
1207 else if(*(inputtag->tag) == 0x80){ //BF0C
1208 memcpy(currentcard->tag_80,inputtag->value,inputtag->valuelength);}
1209 else if(*(inputtag->tag) == 0x82){ //BF0C
1210 if(!(inputtag->valuelength <= sizeof(currentcard->tag_82)))
1211 return 1;
1212 memcpy(currentcard->tag_82, inputtag->value, inputtag->valuelength);}
1213 else if(*(inputtag->tag) == 0x84){ //BF0C
1214 if(!(inputtag->valuelength <= sizeof(currentcard->tag_84)))
1215 return 1;
1216 memcpy(currentcard->tag_84, inputtag->value, inputtag->valuelength);
1217 currentcard->tag_84_len = inputtag->valuelength;
1218 }
1219 else if(*(inputtag->tag) == 0x86){ //BF0C
1220 if(!(inputtag->valuelength <= sizeof(currentcard->tag_86)))
1221 return 1;
1222 memcpy(currentcard->tag_86, inputtag->value, inputtag->valuelength);
1223 currentcard->tag_86_len = inputtag->valuelength;
1224 }
1225 else if(*(inputtag->tag) == 0x87){ //BF0C
1226 if(!(inputtag->valuelength <= sizeof(currentcard->tag_87)))
1227 return 1;
1228 memcpy(currentcard->tag_87, inputtag->value, inputtag->valuelength);}
1229 else if(*(inputtag->tag) == 0x88){ //BF0C
1230 if(!(inputtag->valuelength <= sizeof(currentcard->tag_88)))
1231 return 1;
1232 memcpy(currentcard->tag_88, inputtag->value, inputtag->valuelength);}
1233 else if(*(inputtag->tag) == 0x8A){ //BF0C
1234 if(!(inputtag->valuelength <= sizeof(currentcard->tag_8A)))
1235 return 1;
1236 memcpy(currentcard->tag_8A, inputtag->value, inputtag->valuelength);}
1237 else if(*(inputtag->tag) == 0x8C){ //BF0C
1238 if(!(inputtag->valuelength <= sizeof(currentcard->tag_8C)))
1239 return 1;
1240 memcpy(currentcard->tag_8C, inputtag->value, inputtag->valuelength);
1241 currentcard->tag_8C_len = inputtag->valuelength;
1242 }
1243 else if(*(inputtag->tag) == 0x8D){ //BF0C
1244 if(!(inputtag->valuelength <= sizeof(currentcard->tag_8D)))
1245 return 1;
1246 memcpy(currentcard->tag_8D, inputtag->value, inputtag->valuelength);
1247 currentcard->tag_8D_len = inputtag->valuelength;
1248 }
1249 else if(*(inputtag->tag) == 0x8E){ //BF0C
1250 if(!(inputtag->valuelength <= sizeof(currentcard->tag_8E)))
1251 return 1;
1252 memcpy(currentcard->tag_8E, inputtag->value, inputtag->valuelength);
1253 currentcard->tag_8E_len = inputtag->valuelength;
1254 }
1255 else if(*(inputtag->tag) == 0x8F){ //BF0C
1256 if(!(inputtag->valuelength <= sizeof(currentcard->tag_8F)))
1257 return 1;
1258 memcpy(currentcard->tag_8F,inputtag->value,sizeof(currentcard->tag_8F));}
1259 else if(*(inputtag->tag) == 0x90){ //BF0C
1260 if(!(inputtag->valuelength <= sizeof(currentcard->tag_90)))
1261 return 1;
1262 memcpy(currentcard->tag_90, inputtag->value, inputtag->valuelength);
1263 currentcard->tag_90_len = inputtag->valuelength;}
1264 else if(*(inputtag->tag) == 0x92){ //BF0C
1265 if(!(inputtag->valuelength <= sizeof(currentcard->tag_92)))
1266 return 1;
1267 memcpy(currentcard->tag_92, inputtag->value, inputtag->valuelength);
1268 currentcard->tag_92_len = inputtag->valuelength;}
1269 else if(*(inputtag->tag) == 0x93){ //BF0C
1270 if(!(inputtag->valuelength <= sizeof(currentcard->tag_93)))
1271 return 1;
1272 memcpy(currentcard->tag_93, inputtag->value, inputtag->valuelength);
1273 currentcard->tag_93_len = inputtag->valuelength;}
1274 else if(*(inputtag->tag) == 0x94){ //BF0C
1275 if(!(inputtag->valuelength <= sizeof(currentcard->tag_94)))
1276 return 1;
1277 memcpy(currentcard->tag_94, inputtag->value, inputtag->valuelength);
1278 currentcard->tag_94_len = inputtag->valuelength;}
1279 else if(*(inputtag->tag) == 0x95){ //BF0C
1280 if(!(inputtag->valuelength <= sizeof(currentcard->tag_95)))
1281 return 1;
1282 memcpy(currentcard->tag_95, inputtag->value, inputtag->valuelength);}
1283 else if(*(inputtag->tag) == 0x97){ //BF0C
1284 if(!(inputtag->valuelength <= sizeof(currentcard->tag_97)))
1285 return 1;
1286 memcpy(currentcard->tag_97, inputtag->value, inputtag->valuelength);
1287 currentcard->tag_97_len = inputtag->valuelength;}
1288 else if(*(inputtag->tag) == 0x98){ //BF0C
1289 if(!(inputtag->valuelength <= sizeof(currentcard->tag_98)))
1290 return 1;
1291 memcpy(currentcard->tag_98, inputtag->value, inputtag->valuelength);}
1292 else if(*(inputtag->tag) == 0x99){ //BF0C
1293 if(!(inputtag->valuelength <= sizeof(currentcard->tag_99)))
1294 return 1;
1295 memcpy(currentcard->tag_99, inputtag->value, inputtag->valuelength);
1296 currentcard->tag_99_len = inputtag->valuelength;}
1297 else if(*(inputtag->tag) == 0x9A){ //BF0C
1298 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9A)))
1299 return 1;
1300 memcpy(currentcard->tag_9A, inputtag->value, inputtag->valuelength);}
1301 else if(*(inputtag->tag) == 0x9B){ //BF0C
1302 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9B)))
1303 return 1;
1304 memcpy(currentcard->tag_9B, inputtag->value, inputtag->valuelength);}
1305 else if(*(inputtag->tag) == 0x9C){ //BF0C
1306 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9C)))
1307 return 1;
1308 memcpy(currentcard->tag_9C, inputtag->value, inputtag->valuelength);}
1309 else if(*(inputtag->tag) == 0x9D){ //BF0C
1310 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9D)))
1311 return 1;
1312 memcpy(currentcard->tag_9D, inputtag->value, inputtag->valuelength);
1313 currentcard->tag_9D_len = inputtag->valuelength;}
1314 else if(*(inputtag->tag) == 0xA5){ //BF0C
1315 if(!(inputtag->valuelength <= sizeof(currentcard->tag_A5)))
1316 return 1;
1317 memcpy(currentcard->tag_A5, inputtag->value, inputtag->valuelength);
1318 currentcard->tag_A5_len = inputtag->valuelength;}
1319 }
1320 return 0;
1321}
1322
1323int emv_decode_field(uint8_t* inputfield,uint16_t inputlength, emvtags *result)
1324{
1325 uint16_t lengthcounter=0;
1326 tlvtag newtag;
1327 //copy result to the testtag
1328 if(!result){
1329 return 1;
1330 }
1331 //loop through and decode template
1332 while(lengthcounter < inputlength)
1333 {
1334 //decode the tlv tag
1335 decode_ber_tlv_item((inputfield+lengthcounter),&newtag);
1336 //write the emvtags strucutre
1337 emv_emvtags_decode_tag(&newtag,result);
1338 //move to next value and decode
1339 lengthcounter += newtag.fieldlength-1;
1340 }
1341 return 0;
1342}
1343
1344int emv_select(uint8_t* AID, uint8_t AID_len, void* data)
1345{
1346 uint16_t selectCmd_len = 4 + 1 + AID_len + 1;
1347 uint8_t selectCmd[selectCmd_len];
1348
1349 selectCmd[0] = 0x00;
1350 selectCmd[1] = 0xA4;
1351 selectCmd[2] = 0x04;
1352 selectCmd[3] = 0x00;
1353 selectCmd[4] = AID_len;
1354 memcpy(&(selectCmd[5]), AID, AID_len);
1355 selectCmd[selectCmd_len-1] = 0x00;
1356 return iso14_apdu(selectCmd,selectCmd_len,false, 0,data);
1357}
1358
1359//perform READ RECORD
1360int emv_readrecord(uint8_t recordnumber, uint8_t sfi, void* data)
1361{
1362 uint16_t readRecordCmd_len = 5;
1363 uint8_t readRecordCmd[readRecordCmd_len];
1364
1365 readRecordCmd[0] = 0x00;
1366 readRecordCmd[1] = 0xB2;
1367 readRecordCmd[2] = recordnumber;
1368 readRecordCmd[3] = ((sfi << 3) | 0x04);
1369 readRecordCmd[4] = 0x00;
1370 return iso14_apdu(readRecordCmd,readRecordCmd_len,false,0,data);
1371}
1372
1373int emv_getprocessingoptions(uint8_t* pdol, uint8_t pdol_len, void* data)
1374{
1375 uint16_t processingCmd_len = 4 + 1 + 2 + pdol_len + 1;
1376 uint8_t processingCmd[processingCmd_len];
1377
1378 processingCmd[0] = 0x80;
1379 processingCmd[1] = 0xA8;
1380 processingCmd[2] = 0x00;
1381 processingCmd[3] = 0x00;
1382 processingCmd[4] = pdol_len + 2;
1383 processingCmd[5] = 0x83; //template
1384 processingCmd[6] = pdol_len;
1385 if(pdol_len > 0){
1386 memcpy(&(processingCmd[7]), pdol, pdol_len);}
1387 processingCmd[processingCmd_len] = 0x00;
1388 //Dbhexdump(processingCmd_len, processingCmd, false);
1389 return iso14_apdu(processingCmd,processingCmd_len,false, 0, data);
1390}
1391
1392int emv_computecryptogram(uint8_t* UDOL, uint8_t UDOL_len, void *data)
1393{
1394 uint16_t cryptogramCmd_len = 4 + 1 + UDOL_len + 1;
1395 uint8_t cryptogramCmd[cryptogramCmd_len];
1396
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
1405 return iso14_apdu(cryptogramCmd,cryptogramCmd_len,false, 0,data);
1406}
1407
1408int emv_getchallenge(void *data)
1409{
1410 uint16_t challengeCmd_len = 5;
1411 uint8_t challengeCmd[challengeCmd_len];
1412
1413 challengeCmd[0] = 0x00;
1414 challengeCmd[1] = 0x84;
1415 challengeCmd[2] = 0x00;
1416 challengeCmd[3] = 0x00;
1417 challengeCmd[4] = 0x00;
1418
1419 return iso14_apdu(challengeCmd,challengeCmd_len,false, 0,data);
1420}
1421
1422int emv_loopback(uint8_t* transData , uint8_t transData_len, void *data)
1423{
1424 uint16_t loopbackCmd_len = 4 + 1 + transData_len + 1;
1425 uint8_t loopbackCmd[loopbackCmd_len];
1426
1427 loopbackCmd[0] = 0x00;
1428 loopbackCmd[1] = 0xEE;
1429 loopbackCmd[2] = 0x00;
1430 loopbackCmd[3] = 0x00;
1431 loopbackCmd[4] = loopbackCmd_len;
1432 memcpy(&(loopbackCmd[5]), transData, transData_len);
1433 return iso14_apdu(loopbackCmd,loopbackCmd_len,false, 0,data);
1434}
1435
1436//generateAC
1437int emv_generateAC(uint8_t refcontrolparam, uint8_t* cdolinput, uint8_t cdolinputlen, void* data)
1438{
1439 uint16_t acCmd_len = 4 + 1 + cdolinputlen + 1;
1440 uint8_t acCmd[acCmd_len];
1441
1442 acCmd[0] = 0x80;
1443 acCmd[1] = 0xAE;
1444 acCmd[2] = refcontrolparam;
1445 acCmd[3] = 0x00;
1446 acCmd[4] = cdolinputlen;
1447 memcpy(&(acCmd[5]), cdolinput, cdolinputlen);
1448 acCmd[acCmd_len-1] = 0x00;
1449 Dbhexdump(acCmd_len, acCmd,false);
1450 return iso14_apdu(acCmd,acCmd_len,false,0,data);
1451}
1452
1453int emv_decodeAFL(uint8_t* AFL, uint8_t AFLlen )
1454{
1455
1456 return 0;
1457}
1458
1459//Print out AIP Bit meanings
1460int emv_decodeAIP(uint8_t* AIP)
1461{
1462 if((AIP[0] & AIP_SDA_SUPPORTED) == AIP_SDA_SUPPORTED)
1463 Dbprintf("SDA supported");
1464 if((AIP[0] & AIP_DDA_SUPPORTED) == AIP_DDA_SUPPORTED)
1465 Dbprintf("DDA supported");
1466 if((AIP[0] & AIP_CARDHOLDER_VERIFICATION)==AIP_CARDHOLDER_VERIFICATION)
1467 Dbprintf("Cardholder verification is supported");
1468 if((AIP[0] & AIP_TERMINAL_RISK) == AIP_TERMINAL_RISK)
1469 Dbprintf("Terminal risk management is to be performed");
1470 if((AIP[0] & AIP_ISSUER_AUTH) == AIP_ISSUER_AUTH)
1471 Dbprintf("Issuer authentication is supported ");
1472 if((AIP[0] & AIP_CDA_SUPPORTED) == AIP_CDA_SUPPORTED)
1473 Dbprintf("CDA supported");
1474 if((AIP[1] & AIP_CHIP_SUPPORTED) == AIP_CHIP_SUPPORTED)
1475 Dbprintf("Chip supported");
1476 if((AIP[1] & AIP_MSR_SUPPORTED) == AIP_MSR_SUPPORTED)
1477 Dbprintf("MSR supported");
1478 return 0;
1479}
1480
1481int emv_decodeCVM(uint8_t* CVM, uint8_t CVMlen)
1482{
1483 uint8_t counter = 0;
1484 uint32_t amountX = 0;
1485 uint32_t amountY = 0;
1486 amountX = bytes_to_num(CVM, 4);
1487 amountY = bytes_to_num(CVM+4, 4);
1488 counter +=8;
1489 while(counter < CVMlen)
1490 {
1491 if((CVM[counter] & 0x40) == 0x40){
1492 if((CVM[counter] & 0x3F)== 0x00){
1493 Dbprintf("Fail CVM processing");
1494 }
1495 if((CVM[counter] & 0x3F) == 0x01){
1496 Dbprintf("Plaintext PIN verification performed by ICC");
1497 }
1498 if((CVM[counter] & 0x3F) == 0x02){
1499 Dbprintf("Enciphered PIN verified online");
1500 }
1501 if((CVM[counter] & 0x3F) == 0x03){
1502 Dbprintf("Plaintext PIN verification performed by ICC and signature (paper)");
1503 }
1504 if((CVM[counter] & 0x3F) == 0x04){
1505 Dbprintf("Enciphered PIN verification performed by ICC");
1506 }
1507 if((CVM[counter] & 0x3F) == 0x05){
1508 Dbprintf("Enciphered PIN verification performed by ICC and signature (paper)");
1509 }
1510 if((CVM[counter] & 0x3F) == 0x30){
1511 Dbprintf("Signature (paper)");
1512 }
1513 if((CVM[counter] & 0x3F) == 0x40){
1514 Dbprintf("No CVM required");
1515 }
1516 counter +=2;
1517 }
1518 else{
1519 Dbprintf("Fail cardholder verification if this CVM is unsuccessful");
1520 counter +=2;
1521 }
1522 if(CVM[counter+1] == 0x00){
1523 Dbprintf("Always");}
1524 if(CVM[counter+1] == 0x01){
1525 Dbprintf("If unattended cash");}
1526 if(CVM[counter+1] == 0x02){
1527 Dbprintf("If not unattended cash and not manual cash and not purchase with cashback");}
1528 if(CVM[counter+1] == 0x03){
1529 Dbprintf("If terminal supports the CVM");}
1530 if(CVM[counter+1] == 0x04){
1531 Dbprintf("If manual cash");}
1532 if(CVM[counter+1] == 0x05){
1533 Dbprintf("If purchase with cashback");}
1534 if(CVM[counter+1] == 0x06){
1535 Dbprintf("If transaction is in the application currency and is under %lu value", amountX);}
1536 if(CVM[counter+1] == 0x07){
1537 Dbprintf("If transaction is in the application currency and is over %lu value", amountX);}
1538 if(CVM[counter+1] == 0x08){
1539 Dbprintf("If transaction is in the application currency and is under %lu value", amountY);}
1540 if(CVM[counter+1] == 0x09){
1541 Dbprintf("If transaction is in the application currency and is over %lu value", amountY);}
1542 }
1543 return 0;
1544}
1545
1546//dump the current card to the console
1547void dumpCard(emvtags* currentcard){
1548 DUMP(currentcard->ATQA);
1549 Dbhexdump(sizeof(currentcard->ATQA), currentcard->ATQA, false);
1550 DUMP(currentcard->UID);
1551 Dbhexdump(currentcard->UID_len, currentcard->UID, false);
1552 DUMP(currentcard->SAK1);
1553 Dbhexdump(1, &currentcard->SAK1, false);
1554 DUMP(currentcard->SAK2);
1555 Dbhexdump(1, &currentcard->SAK2, false);
1556 DUMP(currentcard->ATS);
1557 Dbhexdump(currentcard->ATS_len, currentcard->ATS, false);
1558
1559 DUMP(currentcard->tag_4F);
1560 Dbhexdump(currentcard->tag_4F_len, currentcard->tag_4F, false);
1561 DUMP(currentcard->tag_50);
1562 Dbhexdump(currentcard->tag_50_len, currentcard->tag_50, false);
1563 DUMP(currentcard->tag_56);
1564 Dbhexdump(currentcard->tag_56_len, currentcard->tag_56, false);
1565 DUMP(currentcard->tag_57);
1566 Dbhexdump(currentcard->tag_57_len, currentcard->tag_57, false);
1567 DUMP(currentcard->tag_5A);
1568 Dbhexdump(currentcard->tag_5A_len, currentcard->tag_5A, false);
1569 DUMP(currentcard->tag_82);
1570 Dbhexdump(sizeof(currentcard->tag_82), currentcard->tag_82, false);
1571 DUMP(currentcard->tag_84);
1572 Dbhexdump(currentcard->tag_84_len, currentcard->tag_84, false);
1573 DUMP(currentcard->tag_86);
1574 Dbhexdump(currentcard->tag_86_len, currentcard->tag_86, false);
1575 DUMP(currentcard->tag_87);
1576 Dbhexdump(1, currentcard->tag_87, false);
1577DUMP(currentcard->tag_88);
1578 Dbhexdump(1, currentcard->tag_88, false);
1579DUMP(currentcard->tag_8A);
1580 Dbhexdump(2, currentcard->tag_8A, false);
1581 DUMP(currentcard->tag_8C);
1582 Dbhexdump(currentcard->tag_8C_len, currentcard->tag_8C, false);
1583 DUMP(currentcard->tag_8D);
1584 Dbhexdump(currentcard->tag_8D_len, currentcard->tag_8D, false);
1585 DUMP(currentcard->tag_8E);
1586 Dbhexdump(currentcard->tag_8E_len, currentcard->tag_8E, false);
1587 DUMP(currentcard->tag_8F);
1588 Dbhexdump(1, currentcard->tag_8F, false);
1589 DUMP(currentcard->tag_90);
1590 Dbhexdump(currentcard->tag_90_len, currentcard->tag_90, false);
1591 DUMP(currentcard->tag_92);
1592 Dbhexdump(currentcard->tag_92_len, currentcard->tag_92, false);
1593 DUMP(currentcard->tag_93);
1594 Dbhexdump(currentcard->tag_93_len, currentcard->tag_93, false);
1595 DUMP(currentcard->tag_94);
1596 Dbhexdump(currentcard->tag_94_len, currentcard->tag_94, false);
1597 DUMP(currentcard->tag_95);
1598 Dbhexdump(5, currentcard->tag_95, false);
1599 DUMP(currentcard->tag_97);
1600 Dbhexdump(currentcard->tag_97_len, currentcard->tag_97, false);
1601 DUMP(currentcard->tag_98);
1602 Dbhexdump(20, currentcard->tag_98, false);
1603 DUMP(currentcard->tag_99);
1604 Dbhexdump(currentcard->tag_99_len, currentcard->tag_99, false);
1605 DUMP(currentcard->tag_9A);
1606 Dbhexdump(3, currentcard->tag_9A, false);
1607 DUMP(currentcard->tag_9B);
1608 Dbhexdump(2, currentcard->tag_9B, false);
1609 DUMP(currentcard->tag_9C);
1610 Dbhexdump(1, currentcard->tag_9C, false);
1611 DUMP(currentcard->tag_9D);
1612 Dbhexdump(currentcard->tag_9D_len, currentcard->tag_9D, false);
1613 DUMP(currentcard->tag_CD);
1614 Dbhexdump(3, currentcard->tag_CD, false);
1615 DUMP(currentcard->tag_CE);
1616 Dbhexdump(3, currentcard->tag_CE, false);
1617 DUMP(currentcard->tag_CF);
1618 Dbhexdump(3, currentcard->tag_CF, false);
1619 DUMP(currentcard->tag_D7);
1620 Dbhexdump(3, currentcard->tag_D7, false);
1621 DUMP(currentcard->tag_D8);
1622 Dbhexdump(2, currentcard->tag_D8, false);
1623 DUMP(currentcard->tag_D9);
1624 Dbhexdump(currentcard->tag_D9_len, currentcard->tag_D9, false);
1625 DUMP(currentcard->tag_DA);
1626 Dbhexdump(2, currentcard->tag_DA, false);
1627 DUMP(currentcard->tag_DB);
1628 Dbhexdump(2, currentcard->tag_DB, false);
1629 DUMP(currentcard->tag_DC);
1630 Dbhexdump(2, currentcard->tag_DC, false);
1631 DUMP(currentcard->tag_DD);
1632 Dbhexdump(2, currentcard->tag_DD, false);
1633 DUMP(currentcard->tag_AF);
1634 Dbhexdump(currentcard->tag_AF_len, currentcard->tag_AF, false);
1635 DUMP(currentcard->tag_5F20);
1636 Dbhexdump(currentcard->tag_5F20_len, currentcard->tag_5F20, false);
1637 DUMP(currentcard->tag_5F24);
1638 Dbhexdump(3, currentcard->tag_5F24, false);
1639 DUMP(currentcard->tag_5F25);
1640 Dbhexdump(3, currentcard->tag_5F25, false);
1641 DUMP(currentcard->tag_5F28);
1642 Dbhexdump(2, currentcard->tag_5F28, false);
1643 DUMP(currentcard->tag_5F2A);
1644 Dbhexdump(2, currentcard->tag_5F2A, false);
1645 DUMP(currentcard->tag_5F2D);
1646 Dbhexdump(currentcard->tag_5F2D_len, currentcard->tag_5F2D, false);
1647 DUMP(currentcard->tag_5F30);
1648 Dbhexdump(3, currentcard->tag_5F30, false);
1649 DUMP(currentcard->tag_5F34);
1650 Dbhexdump(1, currentcard->tag_5F34, false);
1651 DUMP(currentcard->tag_5F36);
1652 Dbhexdump(2, currentcard->tag_5F36, false);
1653 DUMP(currentcard->tag_5F50);
1654 Dbhexdump(currentcard->tag_5F50_len, currentcard->tag_5F50, false);
1655 DUMP(currentcard->tag_5F54);
1656 Dbhexdump(currentcard->tag_5F54_len, currentcard->tag_5F54, false);
1657 DUMP(currentcard->tag_9F01);
1658 Dbhexdump(6, currentcard->tag_9F01, false);
1659 DUMP(currentcard->tag_9F02);
1660 Dbhexdump(6, currentcard->tag_9F02, false);
1661 DUMP(currentcard->tag_9F03);
1662 Dbhexdump(6, currentcard->tag_9F03, false);
1663 DUMP(currentcard->tag_9F04);
1664 Dbhexdump(4, currentcard->tag_9F04, false);
1665 DUMP(currentcard->tag_9F05);
1666 Dbhexdump(currentcard->tag_9F05_len, currentcard->tag_9F05, false);
1667 DUMP(currentcard->tag_9F06);
1668 Dbhexdump(currentcard->tag_9F06_len, currentcard->tag_9F06, false);
1669 DUMP(currentcard->tag_9F07);
1670 Dbhexdump(2, currentcard->tag_9F07, false);
1671 DUMP(currentcard->tag_9F08);
1672 Dbhexdump(2, currentcard->tag_9F08, false);
1673 DUMP(currentcard->tag_9F09);
1674 Dbhexdump(2, currentcard->tag_9F09, false);
1675 DUMP(currentcard->tag_9F0B);
1676 Dbhexdump(currentcard->tag_9F0B_len, currentcard->tag_9F0B, false);
1677 DUMP(currentcard->tag_9F0D);
1678 Dbhexdump(5, currentcard->tag_9F0D, false);
1679 DUMP(currentcard->tag_9F0E);
1680 Dbhexdump(5, currentcard->tag_9F0E, false);
1681 DUMP(currentcard->tag_9F0F);
1682 Dbhexdump(5, currentcard->tag_9F0F, false);
1683 DUMP(currentcard->tag_9F10);
1684 Dbhexdump(currentcard->tag_9F10_len, currentcard->tag_9F10, false);
1685 DUMP(currentcard->tag_9F11);
1686 Dbhexdump(1, currentcard->tag_9F11, false);
1687 DUMP(currentcard->tag_9F12);
1688 Dbhexdump(currentcard->tag_9F12_len, currentcard->tag_9F12, false);
1689 DUMP(currentcard->tag_9F13);
1690 Dbhexdump(2, currentcard->tag_9F13, false);
1691 DUMP(currentcard->tag_9F14);
1692 Dbhexdump(1, currentcard->tag_9F14, false);
1693 DUMP(currentcard->tag_9F15);
1694 Dbhexdump(2, currentcard->tag_9F15, false);
1695 DUMP(currentcard->tag_9F16);
1696 Dbhexdump(15, currentcard->tag_9F16, false);
1697 DUMP(currentcard->tag_9F17);
1698 Dbhexdump(1, currentcard->tag_9F17, false);
1699 DUMP(currentcard->tag_9F18);
1700 Dbhexdump(4, currentcard->tag_9F18, false);
1701 DUMP(currentcard->tag_9F1A);
1702 Dbhexdump(2, currentcard->tag_9F1A, false);
1703 DUMP(currentcard->tag_9F1B);
1704 Dbhexdump(4, currentcard->tag_9F1B, false);
1705 DUMP(currentcard->tag_9F1C);
1706 Dbhexdump(8, currentcard->tag_9F1C, false);
1707 DUMP(currentcard->tag_9F1D);
1708 Dbhexdump(currentcard->tag_9F1D_len, currentcard->tag_9F1D, false);
1709 DUMP(currentcard->tag_9F1E);
1710 Dbhexdump(8, currentcard->tag_9F1E, false);
1711 DUMP(currentcard->tag_9F1F);
1712 Dbhexdump(currentcard->tag_9F1F_len, currentcard->tag_9F1F, false);
1713 DUMP(currentcard->tag_9F20);
1714 Dbhexdump(currentcard->tag_9F20_len, currentcard->tag_9F20, false);
1715 DUMP(currentcard->tag_9F21);
1716 Dbhexdump(3, currentcard->tag_9F1E, false);
1717 DUMP(currentcard->tag_9F22);
1718 Dbhexdump(1, currentcard->tag_9F22, false);
1719 DUMP(currentcard->tag_9F23);
1720 Dbhexdump(1, currentcard->tag_9F23, false);
1721 DUMP(currentcard->tag_9F26);
1722 Dbhexdump(8, currentcard->tag_9F26, false);
1723 DUMP(currentcard->tag_9F27);
1724 Dbhexdump(1, currentcard->tag_9F27, false);
1725 DUMP(currentcard->tag_9F2D);
1726 Dbhexdump(currentcard->tag_9F2D_len, currentcard->tag_9F2D, false);
1727 DUMP(currentcard->tag_9F2E);
1728 Dbhexdump(3, currentcard->tag_9F2E, false);
1729 DUMP(currentcard->tag_9F2F);
1730 Dbhexdump(currentcard->tag_9F2F_len, currentcard->tag_9F2F, false);
1731 DUMP(currentcard->tag_9F32);
1732 Dbhexdump(currentcard->tag_9F32_len, currentcard->tag_9F32, false);
1733 DUMP(currentcard->tag_9F33);
1734 Dbhexdump(3, currentcard->tag_9F33, false);
1735 DUMP(currentcard->tag_9F34);
1736 Dbhexdump(3, currentcard->tag_9F34, false);
1737 DUMP(currentcard->tag_9F35);
1738 Dbhexdump(1, currentcard->tag_9F35, false);
1739 DUMP(currentcard->tag_9F36);
1740 Dbhexdump(2, currentcard->tag_9F36, false);
1741 DUMP(currentcard->tag_9F37);
1742 Dbhexdump(4, currentcard->tag_9F37, false);
1743 DUMP(currentcard->tag_9F38);
1744 Dbhexdump(currentcard->tag_9F38_len, currentcard->tag_9F38, false);
1745 DUMP(currentcard->tag_9F39);
1746 Dbhexdump(1, currentcard->tag_9F39, false);
1747 DUMP(currentcard->tag_9F39);
1748 Dbhexdump(1, currentcard->tag_9F39, false);
1749 DUMP(currentcard->tag_9F40);
1750 Dbhexdump(5, currentcard->tag_9F40, false);
1751 DUMP(currentcard->tag_9F41);
1752 Dbhexdump(4, currentcard->tag_9F41, false);
1753 DUMP(currentcard->tag_9F42);
1754 Dbhexdump(2, currentcard->tag_9F42, false);
1755 DUMP(currentcard->tag_9F43);
1756 Dbhexdump(4, currentcard->tag_9F43, false);
1757 DUMP(currentcard->tag_9F44);
1758 Dbhexdump(1, currentcard->tag_9F44, false);
1759 DUMP(currentcard->tag_9F45);
1760 Dbhexdump(2, currentcard->tag_9F45, false);
1761 DUMP(currentcard->tag_9F46);
1762 Dbhexdump(currentcard->tag_9F46_len, currentcard->tag_9F46, false);
1763 DUMP(currentcard->tag_9F47);
1764 Dbhexdump(currentcard->tag_9F47_len, currentcard->tag_9F47, false);
1765 DUMP(currentcard->tag_9F48);
1766 Dbhexdump(currentcard->tag_9F48_len, currentcard->tag_9F48, false);
1767 DUMP(currentcard->tag_9F49);
1768 Dbhexdump(currentcard->tag_9F49_len, currentcard->tag_9F49, false);
1769 DUMP(currentcard->tag_9F4A);
1770 Dbhexdump(1, currentcard->tag_9F4A, false);
1771 DUMP(currentcard->tag_9F4B);
1772 Dbhexdump(currentcard->tag_9F4B_len, currentcard->tag_9F4B, false);
1773 DUMP(currentcard->tag_9F4C);
1774 Dbhexdump(8, currentcard->tag_9F4C, false);
1775 DUMP(currentcard->tag_9F4D);
1776 Dbhexdump(2, currentcard->tag_9F4D, false);
1777 DUMP(currentcard->tag_9F4E);
1778 Dbhexdump(255, currentcard->tag_9F4E, false);
1779 DUMP(currentcard->tag_9F60);
1780 Dbhexdump(2, currentcard->tag_9F60, false);
1781 DUMP(currentcard->tag_9F61);
1782 Dbhexdump(2, currentcard->tag_9F61, false);
1783 DUMP(currentcard->tag_9F62);
1784 Dbhexdump(6, currentcard->tag_9F62, false);
1785 DUMP(currentcard->tag_9F63);
1786 Dbhexdump(6, currentcard->tag_9F63, false);
1787 DUMP(currentcard->tag_9F64);
1788 Dbhexdump(1, currentcard->tag_9F64, false);
1789 DUMP(currentcard->tag_9F65);
1790 Dbhexdump(2, currentcard->tag_9F65, false);
1791 DUMP(currentcard->tag_9F66);
1792 Dbhexdump(2, currentcard->tag_9F66, false);
1793 DUMP(currentcard->tag_9F67);
1794 Dbhexdump(1, currentcard->tag_9F67, false);
1795 DUMP(currentcard->tag_9F68);
1796 Dbhexdump(currentcard->tag_9F68_len, currentcard->tag_9F68, false);
1797 DUMP(currentcard->tag_9F69);
1798 Dbhexdump(currentcard->tag_9F69_len, currentcard->tag_9F69, false);
1799 DUMP(currentcard->tag_9F6A);
1800 Dbhexdump(8, currentcard->tag_9F6A, false);
1801 DUMP(currentcard->tag_9F6B);
1802 Dbhexdump(currentcard->tag_9F6B_len, currentcard->tag_9F6B, false);
1803 DUMP(currentcard->tag_9F6C);
1804 Dbhexdump(2, currentcard->tag_9F6C, false);
1805 DUMP(currentcard->tag_61);
1806 Dbhexdump(currentcard->tag_61_len, currentcard->tag_61, false);
1807 DUMP(currentcard->tag_A5);
1808 Dbhexdump(currentcard->tag_A5_len, currentcard->tag_A5, false);
1809 DUMP(currentcard->tag_DFNAME);
1810 Dbhexdump(currentcard->tag_DFNAME_len, currentcard->tag_DFNAME, false);
1811 DUMP(currentcard->tag_70);
1812 Dbhexdump(currentcard->tag_70_len, currentcard->tag_70, false);
1813 DUMP(currentcard->tag_77);
1814 Dbhexdump(currentcard->tag_77_len, currentcard->tag_77, false);
1815 DUMP(currentcard->tag_80);
1816 Dbhexdump(currentcard->tag_80_len, currentcard->tag_80, false);
1817 DUMP(currentcard->tag_91);
1818 Dbhexdump(currentcard->tag_91_len, currentcard->tag_91, false);
1819 DUMP(currentcard->tag_BF0C);
1820 Dbhexdump(currentcard->tag_BF0C_len, currentcard->tag_BF0C, false);
1821 DUMP(currentcard->tag_DFName);
1822 Dbhexdump(currentcard->tag_DFName_len, currentcard->tag_DFName, false);
1823}
1824
1825
Impressum, Datenschutz