]> cvs.zerfleddert.de Git - proxmark3-svn/blame_incremental - armsrc/emvutil.c
CHG: a message..
[proxmark3-svn] / armsrc / emvutil.c
... / ...
CommitLineData
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
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 = 0;
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 returnedlength = sizeof(currentcard->tag_9F1A); 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 }
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
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 */
811int 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 va_end(arguments);
830 return 0;
831}
832
833//generate a valid pdol list
834int emv_generateDOL(uint8_t* DOL, uint8_t DOLlen,emvtags* currentcard,uint8_t* DOLoutput, uint8_t* DOLoutputlen)
835{
836 if(!DOL || !currentcard || !DOLoutput) // null pointer checks
837 return 1;
838 //scan through the DOL list and construct the result.
839 uint8_t i = 0;
840 uint8_t DOLcounter = 0; //points to the current DOL buffer location
841 uint8_t scannedtaglen = 0; //length of a scanned tag
842 uint8_t scannedtag[2] = {0x00,0x00}; //buffer for the scanned tag
843 uint8_t DOLoutputbuffer[255];
844 uint8_t retrievedtagvallen;
845
846 memset(DOLoutputbuffer,0x00, 255); //clear the output buffer
847 while(i < DOLlen)
848 {
849 //length of DOL tag
850 if((*(DOL+i) & 0x1F) == 0x1F)
851 { scannedtaglen = 2;}
852 else
853 {scannedtaglen=1;}
854 memcpy(scannedtag, DOL+i,scannedtaglen);
855 //look up tag value and copy
856 //Dbhexdump(2,scannedtag,false);
857 emv_lookuptag(scannedtag,currentcard,&(DOLoutputbuffer[DOLcounter]),&retrievedtagvallen);
858 DOLcounter += (uint8_t)DOL[i+scannedtaglen];
859 i += scannedtaglen + 1;
860 memset(scannedtag, 0x00, 2); //clear current tag
861
862 }
863 memcpy(DOLoutput, DOLoutputbuffer, DOLcounter);
864 *DOLoutputlen = DOLcounter;
865 return 0;
866}
867
868
869//decode the tag inputted and fill in the supplied structure. clean up the cleanup_passpass function
870int emv_emvtags_decode_tag(tlvtag* inputtag, emvtags* currentcard)
871{
872 if(!inputtag || !currentcard) {
873 return 1;
874 }
875 //scan decoded tag
876 if(*(inputtag->tag) == 0x5F) {
877 if(*(inputtag->tag+1) == 0x20){
878 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F20)))
879 return 1;
880 memcpy(currentcard->tag_5F20, inputtag->value, inputtag->valuelength);
881 currentcard->tag_5F20_len = inputtag->valuelength;
882 }
883 if(*(inputtag->tag+1) == 0x24){
884 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F24)))
885 return 1;
886 memcpy(currentcard->tag_5F24, inputtag->value, sizeof(currentcard->tag_5F24));}
887 if(*(inputtag->tag+1) == 0x25){
888 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F25)))
889 return 1;
890 memcpy(currentcard->tag_5F25, inputtag->value, inputtag->valuelength);}
891 if(*(inputtag->tag+1) == 0x28){
892 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F28)))
893 return 1;
894 memcpy(currentcard->tag_5F28, inputtag->value, inputtag->valuelength);}
895 if(*(inputtag->tag+1) == 0x2A){
896 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F2A)))
897 return 1;
898 memcpy(currentcard->tag_5F2A, inputtag->value, inputtag->valuelength);}
899 if(*(inputtag->tag+1) == 0x2D){
900 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F2D)))
901 return 1;
902 memcpy(currentcard->tag_5F2D, inputtag->value, inputtag->valuelength);
903 currentcard->tag_5F2D_len = inputtag->valuelength;}
904 if(*(inputtag->tag+1) == 0x30){
905 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F30)))
906 return 1;
907 memcpy(currentcard->tag_5F30, inputtag->value, inputtag->valuelength);}
908 if(*(inputtag->tag+1) == 0x34){
909 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F34)))
910 return 1;
911 memcpy(currentcard->tag_5F34, inputtag->value, sizeof(currentcard->tag_5F34));}
912 if(*(inputtag->tag+1) == 0x36){
913 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F36)))
914 return 1;
915 memcpy(currentcard->tag_5F36, inputtag->value, sizeof(currentcard->tag_5F36));}
916 if(*(inputtag->tag+1) == 0x50){
917 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F50)))
918 return 1;
919 memcpy(currentcard->tag_5F50, inputtag->value, inputtag->valuelength);
920 currentcard->tag_5F50_len = inputtag->valuelength;}
921 if(*(inputtag->tag+1) == 0x54){
922 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5F54)))
923 return 1;
924 memcpy(currentcard->tag_5F54, inputtag->value, inputtag->valuelength);
925 currentcard->tag_5F54_len = inputtag->valuelength;}
926 }
927 if(*(inputtag->tag) == 0x9F){
928 if(*(inputtag->tag+1) == 0x01){
929 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F01)))
930 return 1;
931 memcpy(currentcard->tag_9F01, inputtag->value, inputtag->valuelength);}
932 if(*(inputtag->tag+1) == 0x02){
933 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F02)))
934 return 1;
935 memcpy(currentcard->tag_9F02, inputtag->value, inputtag->valuelength);}
936 if(*(inputtag->tag+1) == 0x03){
937 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F03)))
938 return 1;
939 memcpy(currentcard->tag_9F03, inputtag->value, inputtag->valuelength);}
940 if(*(inputtag->tag+1) == 0x04){
941 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F04)))
942 return 1;
943 memcpy(currentcard->tag_9F04, inputtag->value, inputtag->valuelength);}
944 if(*(inputtag->tag+1) == 0x05){
945 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F05)))
946 return 1;
947 memcpy(currentcard->tag_9F05, inputtag->value, inputtag->valuelength);
948 currentcard->tag_9F05_len = inputtag->valuelength;}
949 if(*(inputtag->tag+1) == 0x06){
950 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F06)))
951 return 1;
952 memcpy(currentcard->tag_9F06, inputtag->value, inputtag->valuelength);
953 currentcard->tag_9F06_len = inputtag->valuelength;}
954 if(*(inputtag->tag+1) == 0x07){
955 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F07)))
956 return 1;
957 memcpy(currentcard->tag_9F07, inputtag->value, inputtag->valuelength);}
958 if(*(inputtag->tag+1) == 0x08){
959 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F08)))
960 return 1;
961 memcpy(currentcard->tag_9F08, inputtag->value, inputtag->valuelength);}
962 if(*(inputtag->tag+1) == 0x09){
963 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F09)))
964 return 1;
965 memcpy(currentcard->tag_9F09, inputtag->value, inputtag->valuelength);}
966 if(*(inputtag->tag+1) == 0x0B){
967 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F0B)))
968 return 1;
969 memcpy(currentcard->tag_9F0B, inputtag->value, inputtag->valuelength);
970 currentcard->tag_9F0B_len = inputtag->valuelength;}
971 if(*(inputtag->tag+1) == 0x0D){
972 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F0D)))
973 return 1;
974 memcpy(currentcard->tag_9F0D, inputtag->value, inputtag->valuelength);}
975 if(*(inputtag->tag+1) == 0x0E){
976 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F0E)))
977 return 1;
978 memcpy(currentcard->tag_9F0E, inputtag->value, inputtag->valuelength);}
979 if(*(inputtag->tag+1) == 0x0F){
980 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F0F)))
981 return 1;
982 memcpy(currentcard->tag_9F0F, inputtag->value, inputtag->valuelength);}
983 if(*(inputtag->tag+1) == 0x11){
984 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F11)))
985 return 1;
986 memcpy(currentcard->tag_9F11, inputtag->value, inputtag->valuelength);}
987 if(*(inputtag->tag+1) == 0x12){
988 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F12)))
989 return 1;
990 memcpy(currentcard->tag_9F12, inputtag->value, inputtag->valuelength);
991 currentcard->tag_9F12_len = inputtag->valuelength;}
992 if(*(inputtag->tag+1) == 0x13){
993 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F13)))
994 return 1;
995 memcpy(currentcard->tag_9F13, inputtag->value, inputtag->valuelength);}
996 if(*(inputtag->tag+1) == 0x14){
997 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F14)))
998 return 1;
999 memcpy(currentcard->tag_9F14, inputtag->value, inputtag->valuelength);}
1000 if(*(inputtag->tag+1) == 0x15){
1001 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F15)))
1002 return 1;
1003 memcpy(currentcard->tag_9F15, inputtag->value, inputtag->valuelength);}
1004 if(*(inputtag->tag+1) == 0x16){
1005 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F16)))
1006 return 1;
1007 memcpy(currentcard->tag_9F16, inputtag->value, inputtag->valuelength);}
1008 if(*(inputtag->tag+1) == 0x17){
1009 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F17)))
1010 return 1;
1011 memcpy(currentcard->tag_9F17, inputtag->value, inputtag->valuelength);}
1012 if(*(inputtag->tag+1) == 0x18){
1013 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F18)))
1014 return 1;
1015 memcpy(currentcard->tag_9F18, inputtag->value, inputtag->valuelength);}
1016 if(*(inputtag->tag+1) == 0x1A){
1017 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F1A)))
1018 return 1;
1019 memcpy(currentcard->tag_9F1A, inputtag->value, inputtag->valuelength);}
1020 if(*(inputtag->tag+1) == 0x1B){
1021 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F1B)))
1022 return 1;
1023 memcpy(currentcard->tag_9F1B, inputtag->value, inputtag->valuelength);}
1024 if(*(inputtag->tag+1) == 0x1C){
1025 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F1C)))
1026 return 1;
1027 memcpy(currentcard->tag_9F1C, inputtag->value, inputtag->valuelength);}
1028 if(*(inputtag->tag+1) == 0x1D){
1029 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F1D)))
1030 return 1;
1031 memcpy(currentcard->tag_9F1D, inputtag->value, inputtag->valuelength);
1032 currentcard->tag_9F1D_len = inputtag->valuelength;}
1033 if(*(inputtag->tag+1) == 0x1E){
1034 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F1E)))
1035 return 1;
1036 memcpy(currentcard->tag_9F1E, inputtag->value, inputtag->valuelength);}
1037 if(*(inputtag->tag+1) == 0x1F){
1038 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F1F)))
1039 return 1;
1040 memcpy(currentcard->tag_9F1F, inputtag->value, inputtag->valuelength);
1041 currentcard->tag_9F1F_len = inputtag->valuelength;}
1042 if(*(inputtag->tag+1) == 0x32){
1043 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F32)))
1044 return 1;
1045 currentcard->tag_9F32_len = inputtag->valuelength;
1046 memcpy(currentcard->tag_9F32, inputtag->value, inputtag->valuelength);
1047 }
1048 if(*(inputtag->tag+1) == 0x34){
1049 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F34)))
1050 return 1;
1051 memcpy(currentcard->tag_9F34, inputtag->value, inputtag->valuelength);}
1052if(*(inputtag->tag+1) == 0x35){
1053 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F35)))
1054 return 1;
1055 memcpy(currentcard->tag_9F35, inputtag->value, inputtag->valuelength);}
1056if(*(inputtag->tag+1) == 0x37){
1057 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F37)))
1058 return 1;
1059 memcpy(currentcard->tag_9F37, inputtag->value, inputtag->valuelength);}
1060 if(*(inputtag->tag+1) == 0x38){
1061 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F38)))
1062 return 1;
1063 memcpy(currentcard->tag_9F38, inputtag->value, inputtag->valuelength);
1064 currentcard->tag_9F38_len = inputtag->valuelength;}
1065 if(*(inputtag->tag+1) == 0x44){
1066 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F44)))
1067 return 1;
1068 memcpy(currentcard->tag_9F44, inputtag->value, inputtag->valuelength);}
1069 if(*(inputtag->tag+1) == 0x45){
1070 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F45)))
1071 return 1;
1072 memcpy(currentcard->tag_9F45, inputtag->value, inputtag->valuelength);}
1073if(*(inputtag->tag+1) == 0x46){
1074 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F46)))
1075 return 1;
1076 memcpy(currentcard->tag_9F46, inputtag->value, inputtag->valuelength);
1077 currentcard->tag_9F46_len = inputtag->valuelength;}
1078 if(*(inputtag->tag+1) == 0x47){
1079 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F47)))
1080 return 1;
1081 memcpy(currentcard->tag_9F47, inputtag->value, inputtag->valuelength);
1082 currentcard->tag_9F47_len = inputtag->valuelength;}
1083 if(*(inputtag->tag+1) == 0x48){
1084 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F48)))
1085 return 1;
1086 memcpy(currentcard->tag_9F48, inputtag->value, inputtag->valuelength);
1087 currentcard->tag_9F48_len = inputtag->valuelength;}
1088 if(*(inputtag->tag+1) == 0x49){
1089 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F49)))
1090 return 1;
1091 memcpy(currentcard->tag_9F49, inputtag->value, inputtag->valuelength);
1092 currentcard->tag_9F49_len = inputtag->valuelength;}
1093 if(*(inputtag->tag+1) == 0x4A){
1094 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F4A)))
1095 return 1;
1096 memcpy(currentcard->tag_9F4A, inputtag->value, inputtag->valuelength);}
1097 if(*(inputtag->tag+1) == 0x4B){
1098 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F4B)))
1099 return 1;
1100 memcpy(currentcard->tag_9F4B, inputtag->value, inputtag->valuelength);
1101 currentcard->tag_9F4B_len = inputtag->valuelength;}
1102 if(*(inputtag->tag+1) == 0x4C){
1103 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F4C)))
1104 return 1;
1105 memcpy(currentcard->tag_9F4C, inputtag->value, inputtag->valuelength);}
1106if(*(inputtag->tag+1) == 0x60){
1107 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F60)))
1108 return 1;
1109 memcpy(currentcard->tag_9F60, inputtag->value, inputtag->valuelength);}
1110 if(*(inputtag->tag+1) == 0x61){
1111 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F61)))
1112 return 1;
1113 memcpy(currentcard->tag_9F61, inputtag->value, inputtag->valuelength);}
1114 if(*(inputtag->tag+1) == 0x62){
1115 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F62)))
1116 return 1;
1117 memcpy(currentcard->tag_9F62, inputtag->value, inputtag->valuelength);}
1118 if(*(inputtag->tag+1) == 0x63){
1119 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F63)))
1120 return 1;
1121 memcpy(currentcard->tag_9F63, inputtag->value, inputtag->valuelength);}
1122 if(*(inputtag->tag+1) == 0x64){
1123 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F64)))
1124 return 1;
1125 memcpy(currentcard->tag_9F64, inputtag->value, inputtag->valuelength);}
1126 if(*(inputtag->tag+1) == 0x65){
1127 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F65)))
1128 return 1;
1129 memcpy(currentcard->tag_9F65, inputtag->value, inputtag->valuelength);}
1130 if(*(inputtag->tag+1) == 0x66){
1131 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F66)))
1132 return 1;
1133 memcpy(currentcard->tag_9F66, inputtag->value, inputtag->valuelength);}
1134 if(*(inputtag->tag+1) == 0x67){
1135 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F67)))
1136 return 1;
1137 memcpy(currentcard->tag_9F67, inputtag->value, inputtag->valuelength);}
1138 if(*(inputtag->tag+1) == 0x68){
1139 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F68)))
1140 return 1;
1141 memcpy(currentcard->tag_9F68, inputtag->value, inputtag->valuelength);
1142 currentcard->tag_9F68_len = inputtag->valuelength;}
1143 if(*(inputtag->tag+1) == 0x69){
1144 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F69)))
1145 return 1;
1146 memcpy(currentcard->tag_9F69, inputtag->value, inputtag->valuelength);
1147 currentcard->tag_9F69_len = inputtag->valuelength;}
1148 if(*(inputtag->tag+1) == 0x6A){
1149 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F6A)))
1150 return 1;
1151 memcpy(currentcard->tag_9F6A, inputtag->value, inputtag->valuelength);}
1152 if(*(inputtag->tag+1) == 0x6B){
1153 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F6B)))
1154 return 1;
1155 memcpy(currentcard->tag_9F6B, inputtag->value, inputtag->valuelength);
1156 currentcard->tag_9F6B_len = inputtag->valuelength;}
1157 if(*(inputtag->tag+1) == 0x6C){
1158 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9F6C)))
1159 return 1;
1160 memcpy(currentcard->tag_9F6C, inputtag->value, inputtag->valuelength);}
1161}
1162else
1163{
1164 if(*(inputtag->tag) == 0xBF){ //BF0C
1165 if(*(inputtag->tag+1) == 0x0C){
1166 if(!(inputtag->valuelength <= sizeof(currentcard->tag_BF0C)))
1167 return 1;
1168 memcpy(currentcard->tag_BF0C, inputtag->value, inputtag->valuelength);
1169 currentcard->tag_BF0C_len = inputtag->valuelength;}
1170 }
1171 else if(*(inputtag->tag) == 0x4F){ //BF0C
1172 if(!(inputtag->valuelength <= sizeof(currentcard->tag_4F)))
1173 return 1;
1174 memcpy(currentcard->tag_4F, inputtag->value, inputtag->valuelength);
1175 currentcard->tag_4F_len = inputtag->valuelength;}
1176 else if(*(inputtag->tag) == 0x50){ //BF0C
1177 if(!(inputtag->valuelength <= sizeof(currentcard->tag_50)))
1178 return 1;
1179 memcpy(currentcard->tag_50, inputtag->value, inputtag->valuelength);
1180 currentcard->tag_50_len = inputtag->valuelength;
1181 }
1182 else if(*(inputtag->tag) == 0x56){ //BF0C
1183 if(!(inputtag->valuelength <= sizeof(currentcard->tag_56)))
1184 return 1;
1185 memcpy(currentcard->tag_56, inputtag->value, inputtag->valuelength);
1186 currentcard->tag_56_len = inputtag->valuelength;
1187 }
1188 else if(*(inputtag->tag) == 0x57){ //BF0C
1189 if(!(inputtag->valuelength <= sizeof(currentcard->tag_57)))
1190 return 1;
1191 memcpy(currentcard->tag_57, inputtag->value, inputtag->valuelength);
1192 currentcard->tag_57_len = inputtag->valuelength;
1193 }
1194 else if(*(inputtag->tag) == 0x5A){ //BF0C
1195 if(!(inputtag->valuelength <= sizeof(currentcard->tag_5A)))
1196 return 1;
1197 memcpy(currentcard->tag_5A, inputtag->value, inputtag->valuelength);
1198 currentcard->tag_5A_len = inputtag->valuelength;}
1199 else if(*(inputtag->tag) == 0x61){ //BF0C
1200 if(!(inputtag->valuelength <= sizeof(currentcard->tag_61)))
1201 return 1;
1202 memcpy(currentcard->tag_61, inputtag->value, inputtag->valuelength);
1203 currentcard->tag_61_len = inputtag->valuelength;
1204 }
1205 else if(*(inputtag->tag) == 0x6F){ //BF0C
1206 memcpy(currentcard->tag_6F,inputtag->value,inputtag->valuelength);}
1207
1208 else if(*(inputtag->tag) == 0x70){ //BF0C
1209 memcpy(currentcard->tag_70,inputtag->value,inputtag->valuelength);}
1210 else if(*(inputtag->tag) == 0x77){ //BF0C
1211 memcpy(currentcard->tag_77,inputtag->value,inputtag->valuelength);}
1212 else if(*(inputtag->tag) == 0x80){ //BF0C
1213 memcpy(currentcard->tag_80,inputtag->value,inputtag->valuelength);}
1214 else if(*(inputtag->tag) == 0x82){ //BF0C
1215 if(!(inputtag->valuelength <= sizeof(currentcard->tag_82)))
1216 return 1;
1217 memcpy(currentcard->tag_82, inputtag->value, inputtag->valuelength);}
1218 else if(*(inputtag->tag) == 0x84){ //BF0C
1219 if(!(inputtag->valuelength <= sizeof(currentcard->tag_84)))
1220 return 1;
1221 memcpy(currentcard->tag_84, inputtag->value, inputtag->valuelength);
1222 currentcard->tag_84_len = inputtag->valuelength;
1223 }
1224 else if(*(inputtag->tag) == 0x86){ //BF0C
1225 if(!(inputtag->valuelength <= sizeof(currentcard->tag_86)))
1226 return 1;
1227 memcpy(currentcard->tag_86, inputtag->value, inputtag->valuelength);
1228 currentcard->tag_86_len = inputtag->valuelength;
1229 }
1230 else if(*(inputtag->tag) == 0x87){ //BF0C
1231 if(!(inputtag->valuelength <= sizeof(currentcard->tag_87)))
1232 return 1;
1233 memcpy(currentcard->tag_87, inputtag->value, inputtag->valuelength);}
1234 else if(*(inputtag->tag) == 0x88){ //BF0C
1235 if(!(inputtag->valuelength <= sizeof(currentcard->tag_88)))
1236 return 1;
1237 memcpy(currentcard->tag_88, inputtag->value, inputtag->valuelength);}
1238 else if(*(inputtag->tag) == 0x8A){ //BF0C
1239 if(!(inputtag->valuelength <= sizeof(currentcard->tag_8A)))
1240 return 1;
1241 memcpy(currentcard->tag_8A, inputtag->value, inputtag->valuelength);}
1242 else if(*(inputtag->tag) == 0x8C){ //BF0C
1243 if(!(inputtag->valuelength <= sizeof(currentcard->tag_8C)))
1244 return 1;
1245 memcpy(currentcard->tag_8C, inputtag->value, inputtag->valuelength);
1246 currentcard->tag_8C_len = inputtag->valuelength;
1247 }
1248 else if(*(inputtag->tag) == 0x8D){ //BF0C
1249 if(!(inputtag->valuelength <= sizeof(currentcard->tag_8D)))
1250 return 1;
1251 memcpy(currentcard->tag_8D, inputtag->value, inputtag->valuelength);
1252 currentcard->tag_8D_len = inputtag->valuelength;
1253 }
1254 else if(*(inputtag->tag) == 0x8E){ //BF0C
1255 if(!(inputtag->valuelength <= sizeof(currentcard->tag_8E)))
1256 return 1;
1257 memcpy(currentcard->tag_8E, inputtag->value, inputtag->valuelength);
1258 currentcard->tag_8E_len = inputtag->valuelength;
1259 }
1260 else if(*(inputtag->tag) == 0x8F){ //BF0C
1261 if(!(inputtag->valuelength <= sizeof(currentcard->tag_8F)))
1262 return 1;
1263 memcpy(currentcard->tag_8F,inputtag->value,sizeof(currentcard->tag_8F));}
1264 else if(*(inputtag->tag) == 0x90){ //BF0C
1265 if(!(inputtag->valuelength <= sizeof(currentcard->tag_90)))
1266 return 1;
1267 memcpy(currentcard->tag_90, inputtag->value, inputtag->valuelength);
1268 currentcard->tag_90_len = inputtag->valuelength;}
1269 else if(*(inputtag->tag) == 0x92){ //BF0C
1270 if(!(inputtag->valuelength <= sizeof(currentcard->tag_92)))
1271 return 1;
1272 memcpy(currentcard->tag_92, inputtag->value, inputtag->valuelength);
1273 currentcard->tag_92_len = inputtag->valuelength;}
1274 else if(*(inputtag->tag) == 0x93){ //BF0C
1275 if(!(inputtag->valuelength <= sizeof(currentcard->tag_93)))
1276 return 1;
1277 memcpy(currentcard->tag_93, inputtag->value, inputtag->valuelength);
1278 currentcard->tag_93_len = inputtag->valuelength;}
1279 else if(*(inputtag->tag) == 0x94){ //BF0C
1280 if(!(inputtag->valuelength <= sizeof(currentcard->tag_94)))
1281 return 1;
1282 memcpy(currentcard->tag_94, inputtag->value, inputtag->valuelength);
1283 currentcard->tag_94_len = inputtag->valuelength;}
1284 else if(*(inputtag->tag) == 0x95){ //BF0C
1285 if(!(inputtag->valuelength <= sizeof(currentcard->tag_95)))
1286 return 1;
1287 memcpy(currentcard->tag_95, inputtag->value, inputtag->valuelength);}
1288 else if(*(inputtag->tag) == 0x97){ //BF0C
1289 if(!(inputtag->valuelength <= sizeof(currentcard->tag_97)))
1290 return 1;
1291 memcpy(currentcard->tag_97, inputtag->value, inputtag->valuelength);
1292 currentcard->tag_97_len = inputtag->valuelength;}
1293 else if(*(inputtag->tag) == 0x98){ //BF0C
1294 if(!(inputtag->valuelength <= sizeof(currentcard->tag_98)))
1295 return 1;
1296 memcpy(currentcard->tag_98, inputtag->value, inputtag->valuelength);}
1297 else if(*(inputtag->tag) == 0x99){ //BF0C
1298 if(!(inputtag->valuelength <= sizeof(currentcard->tag_99)))
1299 return 1;
1300 memcpy(currentcard->tag_99, inputtag->value, inputtag->valuelength);
1301 currentcard->tag_99_len = inputtag->valuelength;}
1302 else if(*(inputtag->tag) == 0x9A){ //BF0C
1303 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9A)))
1304 return 1;
1305 memcpy(currentcard->tag_9A, inputtag->value, inputtag->valuelength);}
1306 else if(*(inputtag->tag) == 0x9B){ //BF0C
1307 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9B)))
1308 return 1;
1309 memcpy(currentcard->tag_9B, inputtag->value, inputtag->valuelength);}
1310 else if(*(inputtag->tag) == 0x9C){ //BF0C
1311 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9C)))
1312 return 1;
1313 memcpy(currentcard->tag_9C, inputtag->value, inputtag->valuelength);}
1314 else if(*(inputtag->tag) == 0x9D){ //BF0C
1315 if(!(inputtag->valuelength <= sizeof(currentcard->tag_9D)))
1316 return 1;
1317 memcpy(currentcard->tag_9D, inputtag->value, inputtag->valuelength);
1318 currentcard->tag_9D_len = inputtag->valuelength;}
1319 else if(*(inputtag->tag) == 0xA5){ //BF0C
1320 if(!(inputtag->valuelength <= sizeof(currentcard->tag_A5)))
1321 return 1;
1322 memcpy(currentcard->tag_A5, inputtag->value, inputtag->valuelength);
1323 currentcard->tag_A5_len = inputtag->valuelength;}
1324 }
1325 return 0;
1326}
1327
1328int emv_decode_field(uint8_t* inputfield,uint16_t inputlength, emvtags *result)
1329{
1330 uint16_t lengthcounter=0;
1331 tlvtag newtag;
1332 //copy result to the testtag
1333 if(!result){
1334 return 1;
1335 }
1336 //loop through and decode template
1337 while(lengthcounter < inputlength)
1338 {
1339 //decode the tlv tag
1340 decode_ber_tlv_item((inputfield+lengthcounter),&newtag);
1341 //write the emvtags strucutre
1342 emv_emvtags_decode_tag(&newtag,result);
1343 //move to next value and decode
1344 lengthcounter += newtag.fieldlength-1;
1345 }
1346 return 0;
1347}
1348
1349int emv_select(uint8_t* AID, uint8_t AID_len, void* data)
1350{
1351 uint16_t selectCmd_len = 4 + 1 + AID_len + 1;
1352 uint8_t selectCmd[selectCmd_len];
1353
1354 selectCmd[0] = 0x00;
1355 selectCmd[1] = 0xA4;
1356 selectCmd[2] = 0x04;
1357 selectCmd[3] = 0x00;
1358 selectCmd[4] = AID_len;
1359 memcpy(&(selectCmd[5]), AID, AID_len);
1360 selectCmd[selectCmd_len-1] = 0x00;
1361 return iso14_apdu(selectCmd, selectCmd_len, data);
1362}
1363
1364//perform READ RECORD
1365int emv_readrecord(uint8_t recordnumber, uint8_t sfi, void* data)
1366{
1367 uint16_t readRecordCmd_len = 5;
1368 uint8_t readRecordCmd[readRecordCmd_len];
1369
1370 readRecordCmd[0] = 0x00;
1371 readRecordCmd[1] = 0xB2;
1372 readRecordCmd[2] = recordnumber;
1373 readRecordCmd[3] = ((sfi << 3) | 0x04);
1374 readRecordCmd[4] = 0x00;
1375 return iso14_apdu(readRecordCmd, readRecordCmd_len, data);
1376}
1377
1378int emv_getprocessingoptions(uint8_t* pdol, uint8_t pdol_len, void* data)
1379{
1380 uint16_t processingCmd_len = 4 + 1 + 2 + pdol_len + 1;
1381 uint8_t processingCmd[processingCmd_len];
1382
1383 processingCmd[0] = 0x80;
1384 processingCmd[1] = 0xA8;
1385 processingCmd[2] = 0x00;
1386 processingCmd[3] = 0x00;
1387 processingCmd[4] = pdol_len + 2;
1388 processingCmd[5] = 0x83; //template
1389 processingCmd[6] = pdol_len;
1390 if(pdol_len > 0){
1391 memcpy(&(processingCmd[7]), pdol, pdol_len);}
1392 processingCmd[processingCmd_len-1] = 0x00;
1393 return iso14_apdu(processingCmd, processingCmd_len, data);
1394}
1395
1396int emv_computecryptogram(uint8_t* UDOL, uint8_t UDOL_len, void *data)
1397{
1398 uint16_t cryptogramCmd_len = 4 + 1 + UDOL_len + 1;
1399 uint8_t cryptogramCmd[cryptogramCmd_len];
1400
1401 cryptogramCmd[0] = 0x80;
1402 cryptogramCmd[1] = 0x2A;
1403 cryptogramCmd[2] = 0x8E;
1404 cryptogramCmd[3] = 0x80;
1405 cryptogramCmd[4] = UDOL_len;
1406 memcpy(&(cryptogramCmd[5]), UDOL, UDOL_len);
1407 cryptogramCmd[cryptogramCmd_len-1] = 0x00;
1408
1409 return iso14_apdu(cryptogramCmd, cryptogramCmd_len, data);
1410}
1411
1412int emv_getchallenge(void *data)
1413{
1414 uint16_t challengeCmd_len = 5;
1415 uint8_t challengeCmd[challengeCmd_len];
1416
1417 challengeCmd[0] = 0x00;
1418 challengeCmd[1] = 0x84;
1419 challengeCmd[2] = 0x00;
1420 challengeCmd[3] = 0x00;
1421 challengeCmd[4] = 0x00;
1422
1423 return iso14_apdu(challengeCmd, challengeCmd_len, data);
1424}
1425
1426int emv_loopback(uint8_t* transData , uint8_t transData_len, void *data)
1427{
1428 uint16_t loopbackCmd_len = 4 + 1 + transData_len + 1;
1429 uint8_t loopbackCmd[loopbackCmd_len];
1430
1431 loopbackCmd[0] = 0x00;
1432 loopbackCmd[1] = 0xEE;
1433 loopbackCmd[2] = 0x00;
1434 loopbackCmd[3] = 0x00;
1435 loopbackCmd[4] = loopbackCmd_len;
1436 memcpy(&(loopbackCmd[5]), transData, transData_len);
1437 return iso14_apdu(loopbackCmd, loopbackCmd_len, data);
1438}
1439
1440//generateAC
1441int emv_generateAC(uint8_t refcontrolparam, uint8_t* cdolinput, uint8_t cdolinputlen, void* data)
1442{
1443 uint16_t acCmd_len = 4 + 1 + cdolinputlen + 1;
1444 uint8_t acCmd[acCmd_len];
1445
1446 acCmd[0] = 0x80;
1447 acCmd[1] = 0xAE;
1448 acCmd[2] = refcontrolparam;
1449 acCmd[3] = 0x00;
1450 acCmd[4] = cdolinputlen;
1451 memcpy(&(acCmd[5]), cdolinput, cdolinputlen);
1452 acCmd[acCmd_len-1] = 0x00;
1453 Dbhexdump(acCmd_len, acCmd,false);
1454 return iso14_apdu(acCmd, acCmd_len, data);
1455}
1456
1457int emv_decodeAFL(uint8_t* AFL, uint8_t AFLlen ){
1458 return 0;
1459}
1460
1461//ICEMAN: move to client
1462//Print out AIP Bit meanings
1463int emv_decodeAIP(uint8_t* AIP)
1464{
1465 if((AIP[0] & AIP_SDA_SUPPORTED) == AIP_SDA_SUPPORTED)
1466 Dbprintf("SDA supported");
1467 if((AIP[0] & AIP_DDA_SUPPORTED) == AIP_DDA_SUPPORTED)
1468 Dbprintf("DDA supported");
1469 if((AIP[0] & AIP_CARDHOLDER_VERIFICATION)==AIP_CARDHOLDER_VERIFICATION)
1470 Dbprintf("Cardholder verification is supported");
1471 if((AIP[0] & AIP_TERMINAL_RISK) == AIP_TERMINAL_RISK)
1472 Dbprintf("Terminal risk management is to be performed");
1473 if((AIP[0] & AIP_ISSUER_AUTH) == AIP_ISSUER_AUTH)
1474 Dbprintf("Issuer authentication is supported ");
1475 if((AIP[0] & AIP_CDA_SUPPORTED) == AIP_CDA_SUPPORTED)
1476 Dbprintf("CDA supported");
1477 if((AIP[1] & AIP_CHIP_SUPPORTED) == AIP_CHIP_SUPPORTED)
1478 Dbprintf("Chip supported");
1479 if((AIP[1] & AIP_MSR_SUPPORTED) == AIP_MSR_SUPPORTED)
1480 Dbprintf("MSR supported");
1481 return 0;
1482}
1483
1484//ICEMAN: move to client
1485int emv_decodeCVM(uint8_t* CVM, uint8_t CVMlen)
1486{
1487 uint8_t counter = 0;
1488 uint32_t amountX = 0;
1489 uint32_t amountY = 0;
1490 amountX = bytes_to_num(CVM, 4);
1491 amountY = bytes_to_num(CVM+4, 4);
1492 counter +=8;
1493 while(counter < CVMlen)
1494 {
1495 if((CVM[counter] & 0x40) == 0x40){
1496 if((CVM[counter] & 0x3F)== 0x00){
1497 Dbprintf("Fail CVM processing");
1498 }
1499 if((CVM[counter] & 0x3F) == 0x01){
1500 Dbprintf("Plaintext PIN verification performed by ICC");
1501 }
1502 if((CVM[counter] & 0x3F) == 0x02){
1503 Dbprintf("Enciphered PIN verified online");
1504 }
1505 if((CVM[counter] & 0x3F) == 0x03){
1506 Dbprintf("Plaintext PIN verification performed by ICC and signature (paper)");
1507 }
1508 if((CVM[counter] & 0x3F) == 0x04){
1509 Dbprintf("Enciphered PIN verification performed by ICC");
1510 }
1511 if((CVM[counter] & 0x3F) == 0x05){
1512 Dbprintf("Enciphered PIN verification performed by ICC and signature (paper)");
1513 }
1514 if((CVM[counter] & 0x3F) == 0x30){
1515 Dbprintf("Signature (paper)");
1516 }
1517 if((CVM[counter] & 0x7F) == 0x40){ // iceman, wrong masked used? changed from 0x3f -> 0x7f
1518 Dbprintf("No CVM required");
1519 }
1520 counter +=2;
1521 }
1522 else{
1523 Dbprintf("Fail cardholder verification if this CVM is unsuccessful");
1524 counter +=2;
1525 }
1526 if(CVM[counter+1] == 0x00){
1527 Dbprintf("Always");}
1528 if(CVM[counter+1] == 0x01){
1529 Dbprintf("If unattended cash");}
1530 if(CVM[counter+1] == 0x02){
1531 Dbprintf("If not unattended cash and not manual cash and not purchase with cashback");}
1532 if(CVM[counter+1] == 0x03){
1533 Dbprintf("If terminal supports the CVM");}
1534 if(CVM[counter+1] == 0x04){
1535 Dbprintf("If manual cash");}
1536 if(CVM[counter+1] == 0x05){
1537 Dbprintf("If purchase with cashback");}
1538 if(CVM[counter+1] == 0x06){
1539 Dbprintf("If transaction is in the application currency and is under %lu value", amountX);}
1540 if(CVM[counter+1] == 0x07){
1541 Dbprintf("If transaction is in the application currency and is over %lu value", amountX);}
1542 if(CVM[counter+1] == 0x08){
1543 Dbprintf("If transaction is in the application currency and is under %lu value", amountY);}
1544 if(CVM[counter+1] == 0x09){
1545 Dbprintf("If transaction is in the application currency and is over %lu value", amountY);}
1546 }
1547 return 0;
1548}
1549
1550//ICEMAN: move to client
1551//dump the current card to the console
1552void dumpCard(emvtags* currentcard){
1553 DUMP(currentcard->ATQA);
1554 Dbhexdump(sizeof(currentcard->ATQA), currentcard->ATQA, false);
1555 DUMP(currentcard->UID);
1556 Dbhexdump(currentcard->UID_len, currentcard->UID, false);
1557 DUMP(currentcard->SAK1);
1558 Dbhexdump(1, &currentcard->SAK1, false);
1559 DUMP(currentcard->SAK2);
1560 Dbhexdump(1, &currentcard->SAK2, false);
1561 DUMP(currentcard->ATS);
1562 Dbhexdump(currentcard->ATS_len, currentcard->ATS, false);
1563
1564 DUMP(currentcard->tag_4F);
1565 Dbhexdump(currentcard->tag_4F_len, currentcard->tag_4F, false);
1566 DUMP(currentcard->tag_50);
1567 Dbhexdump(currentcard->tag_50_len, currentcard->tag_50, false);
1568 DUMP(currentcard->tag_56);
1569 Dbhexdump(currentcard->tag_56_len, currentcard->tag_56, false);
1570 DUMP(currentcard->tag_57);
1571 Dbhexdump(currentcard->tag_57_len, currentcard->tag_57, false);
1572 DUMP(currentcard->tag_5A);
1573 Dbhexdump(currentcard->tag_5A_len, currentcard->tag_5A, false);
1574 DUMP(currentcard->tag_82);
1575 Dbhexdump(sizeof(currentcard->tag_82), currentcard->tag_82, false);
1576 DUMP(currentcard->tag_84);
1577 Dbhexdump(currentcard->tag_84_len, currentcard->tag_84, false);
1578 DUMP(currentcard->tag_86);
1579 Dbhexdump(currentcard->tag_86_len, currentcard->tag_86, false);
1580 DUMP(currentcard->tag_87);
1581 Dbhexdump(1, currentcard->tag_87, false);
1582DUMP(currentcard->tag_88);
1583 Dbhexdump(1, currentcard->tag_88, false);
1584DUMP(currentcard->tag_8A);
1585 Dbhexdump(2, currentcard->tag_8A, false);
1586 DUMP(currentcard->tag_8C);
1587 Dbhexdump(currentcard->tag_8C_len, currentcard->tag_8C, false);
1588 DUMP(currentcard->tag_8D);
1589 Dbhexdump(currentcard->tag_8D_len, currentcard->tag_8D, false);
1590 DUMP(currentcard->tag_8E);
1591 Dbhexdump(currentcard->tag_8E_len, currentcard->tag_8E, false);
1592 DUMP(currentcard->tag_8F);
1593 Dbhexdump(1, currentcard->tag_8F, false);
1594 DUMP(currentcard->tag_90);
1595 Dbhexdump(currentcard->tag_90_len, currentcard->tag_90, false);
1596 DUMP(currentcard->tag_92);
1597 Dbhexdump(currentcard->tag_92_len, currentcard->tag_92, false);
1598 DUMP(currentcard->tag_93);
1599 Dbhexdump(currentcard->tag_93_len, currentcard->tag_93, false);
1600 DUMP(currentcard->tag_94);
1601 Dbhexdump(currentcard->tag_94_len, currentcard->tag_94, false);
1602 DUMP(currentcard->tag_95);
1603 Dbhexdump(5, currentcard->tag_95, false);
1604 DUMP(currentcard->tag_97);
1605 Dbhexdump(currentcard->tag_97_len, currentcard->tag_97, false);
1606 DUMP(currentcard->tag_98);
1607 Dbhexdump(20, currentcard->tag_98, false);
1608 DUMP(currentcard->tag_99);
1609 Dbhexdump(currentcard->tag_99_len, currentcard->tag_99, false);
1610 DUMP(currentcard->tag_9A);
1611 Dbhexdump(3, currentcard->tag_9A, false);
1612 DUMP(currentcard->tag_9B);
1613 Dbhexdump(2, currentcard->tag_9B, false);
1614 DUMP(currentcard->tag_9C);
1615 Dbhexdump(1, currentcard->tag_9C, false);
1616 DUMP(currentcard->tag_9D);
1617 Dbhexdump(currentcard->tag_9D_len, currentcard->tag_9D, false);
1618 DUMP(currentcard->tag_CD);
1619 Dbhexdump(3, currentcard->tag_CD, false);
1620 DUMP(currentcard->tag_CE);
1621 Dbhexdump(3, currentcard->tag_CE, false);
1622 DUMP(currentcard->tag_CF);
1623 Dbhexdump(3, currentcard->tag_CF, false);
1624 DUMP(currentcard->tag_D7);
1625 Dbhexdump(3, currentcard->tag_D7, false);
1626 DUMP(currentcard->tag_D8);
1627 Dbhexdump(2, currentcard->tag_D8, false);
1628 DUMP(currentcard->tag_D9);
1629 Dbhexdump(currentcard->tag_D9_len, currentcard->tag_D9, false);
1630 DUMP(currentcard->tag_DA);
1631 Dbhexdump(2, currentcard->tag_DA, false);
1632 DUMP(currentcard->tag_DB);
1633 Dbhexdump(2, currentcard->tag_DB, false);
1634 DUMP(currentcard->tag_DC);
1635 Dbhexdump(2, currentcard->tag_DC, false);
1636 DUMP(currentcard->tag_DD);
1637 Dbhexdump(2, currentcard->tag_DD, false);
1638 DUMP(currentcard->tag_AF);
1639 Dbhexdump(currentcard->tag_AF_len, currentcard->tag_AF, false);
1640 DUMP(currentcard->tag_5F20);
1641 Dbhexdump(currentcard->tag_5F20_len, currentcard->tag_5F20, false);
1642 DUMP(currentcard->tag_5F24);
1643 Dbhexdump(3, currentcard->tag_5F24, false);
1644 DUMP(currentcard->tag_5F25);
1645 Dbhexdump(3, currentcard->tag_5F25, false);
1646 DUMP(currentcard->tag_5F28);
1647 Dbhexdump(2, currentcard->tag_5F28, false);
1648 DUMP(currentcard->tag_5F2A);
1649 Dbhexdump(2, currentcard->tag_5F2A, false);
1650 DUMP(currentcard->tag_5F2D);
1651 Dbhexdump(currentcard->tag_5F2D_len, currentcard->tag_5F2D, false);
1652 DUMP(currentcard->tag_5F30);
1653 Dbhexdump(3, currentcard->tag_5F30, false);
1654 DUMP(currentcard->tag_5F34);
1655 Dbhexdump(1, currentcard->tag_5F34, false);
1656 DUMP(currentcard->tag_5F36);
1657 Dbhexdump(2, currentcard->tag_5F36, false);
1658 DUMP(currentcard->tag_5F50);
1659 Dbhexdump(currentcard->tag_5F50_len, currentcard->tag_5F50, false);
1660 DUMP(currentcard->tag_5F54);
1661 Dbhexdump(currentcard->tag_5F54_len, currentcard->tag_5F54, false);
1662 DUMP(currentcard->tag_9F01);
1663 Dbhexdump(6, currentcard->tag_9F01, false);
1664 DUMP(currentcard->tag_9F02);
1665 Dbhexdump(6, currentcard->tag_9F02, false);
1666 DUMP(currentcard->tag_9F03);
1667 Dbhexdump(6, currentcard->tag_9F03, false);
1668 DUMP(currentcard->tag_9F04);
1669 Dbhexdump(4, currentcard->tag_9F04, false);
1670 DUMP(currentcard->tag_9F05);
1671 Dbhexdump(currentcard->tag_9F05_len, currentcard->tag_9F05, false);
1672 DUMP(currentcard->tag_9F06);
1673 Dbhexdump(currentcard->tag_9F06_len, currentcard->tag_9F06, false);
1674 DUMP(currentcard->tag_9F07);
1675 Dbhexdump(2, currentcard->tag_9F07, false);
1676 DUMP(currentcard->tag_9F08);
1677 Dbhexdump(2, currentcard->tag_9F08, false);
1678 DUMP(currentcard->tag_9F09);
1679 Dbhexdump(2, currentcard->tag_9F09, false);
1680 DUMP(currentcard->tag_9F0B);
1681 Dbhexdump(currentcard->tag_9F0B_len, currentcard->tag_9F0B, false);
1682 DUMP(currentcard->tag_9F0D);
1683 Dbhexdump(5, currentcard->tag_9F0D, false);
1684 DUMP(currentcard->tag_9F0E);
1685 Dbhexdump(5, currentcard->tag_9F0E, false);
1686 DUMP(currentcard->tag_9F0F);
1687 Dbhexdump(5, currentcard->tag_9F0F, false);
1688 DUMP(currentcard->tag_9F10);
1689 Dbhexdump(currentcard->tag_9F10_len, currentcard->tag_9F10, false);
1690 DUMP(currentcard->tag_9F11);
1691 Dbhexdump(1, currentcard->tag_9F11, false);
1692 DUMP(currentcard->tag_9F12);
1693 Dbhexdump(currentcard->tag_9F12_len, currentcard->tag_9F12, false);
1694 DUMP(currentcard->tag_9F13);
1695 Dbhexdump(2, currentcard->tag_9F13, false);
1696 DUMP(currentcard->tag_9F14);
1697 Dbhexdump(1, currentcard->tag_9F14, false);
1698 DUMP(currentcard->tag_9F15);
1699 Dbhexdump(2, currentcard->tag_9F15, false);
1700 DUMP(currentcard->tag_9F16);
1701 Dbhexdump(15, currentcard->tag_9F16, false);
1702 DUMP(currentcard->tag_9F17);
1703 Dbhexdump(1, currentcard->tag_9F17, false);
1704 DUMP(currentcard->tag_9F18);
1705 Dbhexdump(4, currentcard->tag_9F18, false);
1706 DUMP(currentcard->tag_9F1A);
1707 Dbhexdump(2, currentcard->tag_9F1A, false);
1708 DUMP(currentcard->tag_9F1B);
1709 Dbhexdump(4, currentcard->tag_9F1B, false);
1710 DUMP(currentcard->tag_9F1C);
1711 Dbhexdump(8, currentcard->tag_9F1C, false);
1712 DUMP(currentcard->tag_9F1D);
1713 Dbhexdump(currentcard->tag_9F1D_len, currentcard->tag_9F1D, false);
1714 DUMP(currentcard->tag_9F1E);
1715 Dbhexdump(8, currentcard->tag_9F1E, false);
1716 DUMP(currentcard->tag_9F1F);
1717 Dbhexdump(currentcard->tag_9F1F_len, currentcard->tag_9F1F, false);
1718 DUMP(currentcard->tag_9F20);
1719 Dbhexdump(currentcard->tag_9F20_len, currentcard->tag_9F20, false);
1720 DUMP(currentcard->tag_9F21);
1721 Dbhexdump(3, currentcard->tag_9F1E, false);
1722 DUMP(currentcard->tag_9F22);
1723 Dbhexdump(1, currentcard->tag_9F22, false);
1724 DUMP(currentcard->tag_9F23);
1725 Dbhexdump(1, currentcard->tag_9F23, false);
1726 DUMP(currentcard->tag_9F26);
1727 Dbhexdump(8, currentcard->tag_9F26, false);
1728 DUMP(currentcard->tag_9F27);
1729 Dbhexdump(1, currentcard->tag_9F27, false);
1730 DUMP(currentcard->tag_9F2D);
1731 Dbhexdump(currentcard->tag_9F2D_len, currentcard->tag_9F2D, false);
1732 DUMP(currentcard->tag_9F2E);
1733 Dbhexdump(3, currentcard->tag_9F2E, false);
1734 DUMP(currentcard->tag_9F2F);
1735 Dbhexdump(currentcard->tag_9F2F_len, currentcard->tag_9F2F, false);
1736 DUMP(currentcard->tag_9F32);
1737 Dbhexdump(currentcard->tag_9F32_len, currentcard->tag_9F32, false);
1738 DUMP(currentcard->tag_9F33);
1739 Dbhexdump(3, currentcard->tag_9F33, false);
1740 DUMP(currentcard->tag_9F34);
1741 Dbhexdump(3, currentcard->tag_9F34, false);
1742 DUMP(currentcard->tag_9F35);
1743 Dbhexdump(1, currentcard->tag_9F35, false);
1744 DUMP(currentcard->tag_9F36);
1745 Dbhexdump(2, currentcard->tag_9F36, false);
1746 DUMP(currentcard->tag_9F37);
1747 Dbhexdump(4, currentcard->tag_9F37, false);
1748 DUMP(currentcard->tag_9F38);
1749 Dbhexdump(currentcard->tag_9F38_len, currentcard->tag_9F38, false);
1750 DUMP(currentcard->tag_9F39);
1751 Dbhexdump(1, currentcard->tag_9F39, false);
1752 DUMP(currentcard->tag_9F39);
1753 Dbhexdump(1, currentcard->tag_9F39, false);
1754 DUMP(currentcard->tag_9F40);
1755 Dbhexdump(5, currentcard->tag_9F40, false);
1756 DUMP(currentcard->tag_9F41);
1757 Dbhexdump(4, currentcard->tag_9F41, false);
1758 DUMP(currentcard->tag_9F42);
1759 Dbhexdump(2, currentcard->tag_9F42, false);
1760 DUMP(currentcard->tag_9F43);
1761 Dbhexdump(4, currentcard->tag_9F43, false);
1762 DUMP(currentcard->tag_9F44);
1763 Dbhexdump(1, currentcard->tag_9F44, false);
1764 DUMP(currentcard->tag_9F45);
1765 Dbhexdump(2, currentcard->tag_9F45, false);
1766 DUMP(currentcard->tag_9F46);
1767 Dbhexdump(currentcard->tag_9F46_len, currentcard->tag_9F46, false);
1768 DUMP(currentcard->tag_9F47);
1769 Dbhexdump(currentcard->tag_9F47_len, currentcard->tag_9F47, false);
1770 DUMP(currentcard->tag_9F48);
1771 Dbhexdump(currentcard->tag_9F48_len, currentcard->tag_9F48, false);
1772 DUMP(currentcard->tag_9F49);
1773 Dbhexdump(currentcard->tag_9F49_len, currentcard->tag_9F49, false);
1774 DUMP(currentcard->tag_9F4A);
1775 Dbhexdump(1, currentcard->tag_9F4A, false);
1776 DUMP(currentcard->tag_9F4B);
1777 Dbhexdump(currentcard->tag_9F4B_len, currentcard->tag_9F4B, false);
1778 DUMP(currentcard->tag_9F4C);
1779 Dbhexdump(8, currentcard->tag_9F4C, false);
1780 DUMP(currentcard->tag_9F4D);
1781 Dbhexdump(2, currentcard->tag_9F4D, false);
1782 DUMP(currentcard->tag_9F4E);
1783 Dbhexdump(255, currentcard->tag_9F4E, false);
1784 DUMP(currentcard->tag_9F60);
1785 Dbhexdump(2, currentcard->tag_9F60, false);
1786 DUMP(currentcard->tag_9F61);
1787 Dbhexdump(2, currentcard->tag_9F61, false);
1788 DUMP(currentcard->tag_9F62);
1789 Dbhexdump(6, currentcard->tag_9F62, false);
1790 DUMP(currentcard->tag_9F63);
1791 Dbhexdump(6, currentcard->tag_9F63, false);
1792 DUMP(currentcard->tag_9F64);
1793 Dbhexdump(1, currentcard->tag_9F64, false);
1794 DUMP(currentcard->tag_9F65);
1795 Dbhexdump(2, currentcard->tag_9F65, false);
1796 DUMP(currentcard->tag_9F66);
1797 Dbhexdump(2, currentcard->tag_9F66, false);
1798 DUMP(currentcard->tag_9F67);
1799 Dbhexdump(1, currentcard->tag_9F67, false);
1800 DUMP(currentcard->tag_9F68);
1801 Dbhexdump(currentcard->tag_9F68_len, currentcard->tag_9F68, false);
1802 DUMP(currentcard->tag_9F69);
1803 Dbhexdump(currentcard->tag_9F69_len, currentcard->tag_9F69, false);
1804 DUMP(currentcard->tag_9F6A);
1805 Dbhexdump(8, currentcard->tag_9F6A, false);
1806 DUMP(currentcard->tag_9F6B);
1807 Dbhexdump(currentcard->tag_9F6B_len, currentcard->tag_9F6B, false);
1808 DUMP(currentcard->tag_9F6C);
1809 Dbhexdump(2, currentcard->tag_9F6C, false);
1810 DUMP(currentcard->tag_61);
1811 Dbhexdump(currentcard->tag_61_len, currentcard->tag_61, false);
1812 DUMP(currentcard->tag_A5);
1813 Dbhexdump(currentcard->tag_A5_len, currentcard->tag_A5, false);
1814 DUMP(currentcard->tag_DFNAME);
1815 Dbhexdump(currentcard->tag_DFNAME_len, currentcard->tag_DFNAME, false);
1816 DUMP(currentcard->tag_70);
1817 Dbhexdump(currentcard->tag_70_len, currentcard->tag_70, false);
1818 DUMP(currentcard->tag_77);
1819 Dbhexdump(currentcard->tag_77_len, currentcard->tag_77, false);
1820 DUMP(currentcard->tag_80);
1821 Dbhexdump(currentcard->tag_80_len, currentcard->tag_80, false);
1822 DUMP(currentcard->tag_91);
1823 Dbhexdump(currentcard->tag_91_len, currentcard->tag_91, false);
1824 DUMP(currentcard->tag_BF0C);
1825 Dbhexdump(currentcard->tag_BF0C_len, currentcard->tag_BF0C, false);
1826 DUMP(currentcard->tag_DFName);
1827 Dbhexdump(currentcard->tag_DFName_len, currentcard->tag_DFName, false);
1828}
1829
1830
Impressum, Datenschutz