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