1 //-----------------------------------------------------------------------------
3 // Many authors, whom made it possible
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
8 //-----------------------------------------------------------------------------
9 // various EMV related functions.
10 //-----------------------------------------------------------------------------
13 #define DUMP(varname) Dbprintf("%s=", #varname);
15 //uint8_t PCB = 0x00; //track Protocol Control Byte externally
18 //print detected tag name over the serial link
19 int emv_printtag(uint8_t* selected_tag
, emvcard
* inputcard
, uint8_t* outputstring
, uint8_t* outputlen
)
21 //search tag list and print the match
22 //get the value of the tag
23 uint8_t tagvalue
[255];
25 emv_lookuptag(selected_tag
, inputcard
, tagvalue
, &tagvaluelen
);
26 //loop through selected tag, print the value found
27 for(int i
=0; i
<(sizeof(EMV_TAG_LIST
)/sizeof(EMV_TAG_LIST
[0])); i
++){
28 if(!memcmp(selected_tag
, EMV_TAG_LIST
[i
].tag
, 2)){
29 memcpy(outputstring
, EMV_TAG_LIST
[i
].description
, strlen(EMV_TAG_LIST
[i
].description
));
30 memcpy(outputstring
+(strlen(EMV_TAG_LIST
[i
].description
)), "=", 1);
31 memcpy(outputstring
+(strlen(EMV_TAG_LIST
[i
].description
))+1, tagvalue
, tagvaluelen
);
32 *outputlen
= strlen(EMV_TAG_LIST
[i
].description
) + 1 + tagvaluelen
;
39 //returns the value of the emv tag in the supplied emvcard structure
40 int emv_lookuptag(uint8_t* tag
, emvcard
*currentcard
, uint8_t* outputval
, uint8_t* outputvallen
)
42 //loop through tag and return the appropriate value
43 uint8_t returnedtag
[255];
44 uint8_t returnedlength
= 0;
45 memset(returnedtag
, 0x00, sizeof(returnedtag
));
46 if(!memcmp(tag
, "\x4F\x00",2)){
47 memcpy(&returnedtag
, currentcard
->tag_4F
, currentcard
->tag_4F_len
);
48 returnedlength
= currentcard
->tag_4F_len
; goto exitfunction
;}
49 else if(!memcmp(tag
, "\x50\x00",2)){
50 memcpy(&returnedtag
, currentcard
->tag_50
, currentcard
->tag_50_len
);
51 returnedlength
= currentcard
->tag_50_len
; goto exitfunction
;}
52 else if(!memcmp(tag
, "\x56\x00",2)){
53 memcpy(&returnedtag
, currentcard
->tag_56
, currentcard
->tag_56_len
);
54 returnedlength
= currentcard
->tag_56_len
; goto exitfunction
;}
55 else if(!memcmp(tag
, "\x57\x00",2)){
56 memcpy(&returnedtag
, currentcard
->tag_57
, currentcard
->tag_57_len
);
57 returnedlength
= currentcard
->tag_57_len
; goto exitfunction
;}
58 else if(!memcmp(tag
, "\x5A\x00",2)){
59 memcpy(&returnedtag
, currentcard
->tag_5A
, currentcard
->tag_5A_len
);
60 returnedlength
= currentcard
->tag_5A_len
; goto exitfunction
;}
61 else if(!memcmp(tag
, "\x82\x00",2)){
62 memcpy(&returnedtag
, currentcard
->tag_82
, sizeof(currentcard
->tag_82
));
63 returnedlength
= sizeof(currentcard
->tag_82
);goto exitfunction
;}
64 else if(!memcmp(tag
, "\x84\x00",2)){
65 memcpy(&returnedtag
, currentcard
->tag_84
, currentcard
->tag_84_len
);
66 returnedlength
= currentcard
->tag_84_len
; goto exitfunction
;}
67 else if(!memcmp(tag
, "\x86\x00",2)){
68 memcpy(&returnedtag
, currentcard
->tag_86
, currentcard
->tag_86_len
);
69 returnedlength
= currentcard
->tag_86_len
; goto exitfunction
;}
70 else if(!memcmp(tag
, "\x87\x00",2)){
71 memcpy(&returnedtag
, currentcard
->tag_87
, sizeof(currentcard
->tag_87
));
72 returnedlength
= sizeof(currentcard
->tag_87
);goto exitfunction
;}
73 else if(!memcmp(tag
, "\x88\x00",2)){
74 memcpy(&returnedtag
, currentcard
->tag_88
, currentcard
->tag_50_len
);
75 returnedlength
= sizeof(currentcard
->tag_88
); goto exitfunction
;}
76 else if(!memcmp(tag
, "\x8A\x00",2)){
77 memcpy(&returnedtag
, currentcard
->tag_8A
, sizeof(currentcard
->tag_8A
));
78 returnedlength
= sizeof(currentcard
->tag_8A
);goto exitfunction
;}
79 else if(!memcmp(tag
, "\x8C\x00",2)){
80 memcpy(&returnedtag
, currentcard
->tag_8C
, currentcard
->tag_8C_len
);
81 returnedlength
= currentcard
->tag_8C_len
; goto exitfunction
;}
82 else if(!memcmp(tag
, "\x8D\x00",2)){
83 memcpy(&returnedtag
, currentcard
->tag_8D
, currentcard
->tag_8D_len
);
84 returnedlength
= currentcard
->tag_8D_len
; goto exitfunction
;}
85 else if(!memcmp(tag
, "\x8E\x00",2)){
86 memcpy(&returnedtag
, currentcard
->tag_8E
, currentcard
->tag_8E_len
);
87 returnedlength
= currentcard
->tag_8E_len
; goto exitfunction
;}
88 else if(!memcmp(tag
, "\x8F\x00",2)){
89 memcpy(&returnedtag
, currentcard
->tag_8F
, sizeof(currentcard
->tag_8F
));
90 returnedlength
= sizeof(currentcard
->tag_8F
);goto exitfunction
;}
91 else if(!memcmp(tag
, "\x90\x00",2)){
92 memcpy(&returnedtag
, currentcard
->tag_90
, currentcard
->tag_90_len
);
93 returnedlength
= currentcard
->tag_90_len
; goto exitfunction
;}
94 else if(!memcmp(tag
, "\x92\x00",2)){
95 memcpy(&returnedtag
, currentcard
->tag_92
, currentcard
->tag_92_len
);
96 returnedlength
= currentcard
->tag_92_len
; goto exitfunction
;}
97 else if(!memcmp(tag
, "\x93\x00",2)){
98 memcpy(&returnedtag
, currentcard
->tag_93
, currentcard
->tag_93_len
);
99 returnedlength
= currentcard
->tag_93_len
; goto exitfunction
;}
100 else if(!memcmp(tag
, "\x94\x00",2)){
101 memcpy(&returnedtag
, currentcard
->tag_94
, currentcard
->tag_94_len
);
102 returnedlength
= currentcard
->tag_94_len
; goto exitfunction
;}
103 else if(!memcmp(tag
, "\x95\x00",2)){
104 memcpy(&returnedtag
, currentcard
->tag_95
, sizeof(currentcard
->tag_95
));
105 returnedlength
= sizeof(currentcard
->tag_95
);goto exitfunction
;}
106 else if(!memcmp(tag
, "\x97\x00",2)){
107 memcpy(&returnedtag
, currentcard
->tag_97
, currentcard
->tag_97_len
);
108 returnedlength
= currentcard
->tag_97_len
; goto exitfunction
;}
109 else if(!memcmp(tag
, "\x98\x00",2)){
110 memcpy(&returnedtag
, currentcard
->tag_98
, sizeof(currentcard
->tag_98
));
111 returnedlength
= sizeof(currentcard
->tag_98
);goto exitfunction
;}
112 else if(!memcmp(tag
, "\x99\x00",2)){
113 memcpy(&returnedtag
, currentcard
->tag_99
, currentcard
->tag_99_len
);
114 returnedlength
= currentcard
->tag_99_len
; goto exitfunction
;}
115 else if(!memcmp(tag
, "\x9A\x00",2)){
116 memcpy(&returnedtag
, currentcard
->tag_9A
, sizeof(currentcard
->tag_9A
));
117 returnedlength
= sizeof(currentcard
->tag_9A
);goto exitfunction
;}
118 else if(!memcmp(tag
, "\x9B\x00",2)){
119 memcpy(&returnedtag
, currentcard
->tag_9B
, sizeof(currentcard
->tag_9B
));
120 returnedlength
= sizeof(currentcard
->tag_9B
);goto exitfunction
;}
121 else if(!memcmp(tag
, "\x9C\x00",2)){
122 memcpy(&returnedtag
, currentcard
->tag_9C
, sizeof(currentcard
->tag_9C
));
123 returnedlength
= sizeof(currentcard
->tag_9C
);goto exitfunction
;}
124 else if(!memcmp(tag
, "\x9D\x00",2)){
125 memcpy(&returnedtag
, currentcard
->tag_9D
, currentcard
->tag_9D_len
);
126 returnedlength
= currentcard
->tag_9D_len
; goto exitfunction
;}
127 else if(!memcmp(tag
, "\x9D\x00",2)){
128 memcpy(&returnedtag
, currentcard
->tag_9D
, currentcard
->tag_9D_len
);
129 returnedlength
= currentcard
->tag_9D_len
; goto exitfunction
;}
130 else if(!memcmp(tag
, "\xCD\x00",2)){
131 memcpy(&returnedtag
, currentcard
->tag_CD
, sizeof(currentcard
->tag_CD
));
132 returnedlength
= sizeof(currentcard
->tag_CD
);goto exitfunction
;}
133 else if(!memcmp(tag
, "\xCE\x00",2)){
134 memcpy(&returnedtag
, currentcard
->tag_CE
, sizeof(currentcard
->tag_CE
));
135 returnedlength
= sizeof(currentcard
->tag_CE
);goto exitfunction
;}
136 else if(!memcmp(tag
, "\xCF\x00",2)){
137 memcpy(&returnedtag
, currentcard
->tag_CF
, sizeof(currentcard
->tag_CF
));
138 returnedlength
= sizeof(currentcard
->tag_CF
);goto exitfunction
;}
139 else if(!memcmp(tag
, "\xD7\x00",2)){
140 memcpy(&returnedtag
, currentcard
->tag_D7
, sizeof(currentcard
->tag_D7
));
141 returnedlength
= sizeof(currentcard
->tag_D7
);goto exitfunction
;}
142 else if(!memcmp(tag
, "\xD8\x00",2)){
143 memcpy(&returnedtag
, currentcard
->tag_D8
, sizeof(currentcard
->tag_D8
));
144 returnedlength
= sizeof(currentcard
->tag_D8
);goto exitfunction
;}
145 else if(!memcmp(tag
, "\xD9\x00",2)){
146 memcpy(&returnedtag
, currentcard
->tag_D9
, currentcard
->tag_D9_len
);
147 returnedlength
= currentcard
->tag_D9_len
;goto exitfunction
;}
148 else if(!memcmp(tag
, "\xDA\x00",2)){
149 memcpy(&returnedtag
, currentcard
->tag_DA
, sizeof(currentcard
->tag_DA
));
150 returnedlength
= sizeof(currentcard
->tag_DA
);goto exitfunction
;}
151 else if(!memcmp(tag
, "\xDB\x00",2)){
152 memcpy(&returnedtag
, currentcard
->tag_DB
, sizeof(currentcard
->tag_DB
));
153 returnedlength
= sizeof(currentcard
->tag_DB
);goto exitfunction
;}
154 else if(!memcmp(tag
, "\xDC\x00",2)){
155 memcpy(&returnedtag
, currentcard
->tag_DC
, sizeof(currentcard
->tag_DC
));
156 returnedlength
= sizeof(currentcard
->tag_DC
);goto exitfunction
;}
157 else if(!memcmp(tag
, "\xDD\x00",2)){
158 memcpy(&returnedtag
, currentcard
->tag_DD
, sizeof(currentcard
->tag_DD
));
159 returnedlength
= sizeof(currentcard
->tag_DD
);goto exitfunction
;}
160 else if(!memcmp(tag
, "\xA5\x00",2)){
161 memcpy(&returnedtag
, currentcard
->tag_A5
, currentcard
->tag_A5_len
);
162 returnedlength
= currentcard
->tag_A5_len
; goto exitfunction
;}
163 else if(!memcmp(tag
, "\xAF\x00",2)){
164 memcpy(&returnedtag
, currentcard
->tag_AF
, currentcard
->tag_AF_len
);
165 returnedlength
= currentcard
->tag_AF_len
; goto exitfunction
;}
167 if(*(tag
+1) == 0x20){
168 memcpy(&returnedtag
, currentcard
->tag_5F20
, currentcard
->tag_5F20_len
);
169 returnedlength
= currentcard
->tag_5F20_len
; goto exitfunction
;}
170 else if(*(tag
+1) == 0x24){
171 memcpy(&returnedtag
, currentcard
->tag_5F24
, sizeof(currentcard
->tag_5F24
));
172 returnedlength
= sizeof(currentcard
->tag_5F24
);goto exitfunction
;}
173 else if(*(tag
+1) == 0x25){
174 memcpy(&returnedtag
, currentcard
->tag_5F25
, sizeof(currentcard
->tag_5F25
));
175 returnedlength
= sizeof(currentcard
->tag_5F25
);goto exitfunction
;}
176 else if(*(tag
+1) == 0x28){
177 memcpy(&returnedtag
, currentcard
->tag_5F28
, sizeof(currentcard
->tag_5F28
));
178 returnedlength
= sizeof(currentcard
->tag_5F28
);goto exitfunction
;}
179 else if(*(tag
+1) == 0x2A){
180 memcpy(&returnedtag
, currentcard
->tag_5F2A
, sizeof(currentcard
->tag_5F2A
));
181 returnedlength
= sizeof(currentcard
->tag_5F2A
);goto exitfunction
;}
182 else if(*(tag
+1) == 0x2D){
183 memcpy(&returnedtag
, currentcard
->tag_5F2D
, currentcard
->tag_5F2D_len
);
184 returnedlength
= currentcard
->tag_5F2D_len
; goto exitfunction
;}
185 else if(*(tag
+1) == 0x30){
186 memcpy(&returnedtag
, currentcard
->tag_5F30
, sizeof(currentcard
->tag_5F30
));
187 returnedlength
= sizeof(currentcard
->tag_5F30
);goto exitfunction
;}
188 else if(*(tag
+1) == 0x34){
189 memcpy(&returnedtag
, currentcard
->tag_5F34
, sizeof(currentcard
->tag_5F34
));
190 returnedlength
= sizeof(currentcard
->tag_5F34
);goto exitfunction
;}
191 else if(*(tag
+1) == 0x36){
192 memcpy(&returnedtag
, currentcard
->tag_5F36
, sizeof(currentcard
->tag_5F36
));
193 returnedlength
= sizeof(currentcard
->tag_5F36
);goto exitfunction
;}
194 else if(*(tag
+1) == 0x50){
195 memcpy(&returnedtag
, currentcard
->tag_5F50
, currentcard
->tag_5F50_len
);
196 returnedlength
= currentcard
->tag_5F50_len
; goto exitfunction
;}
197 else if(*(tag
+1) == 0x54){
198 memcpy(&returnedtag
, currentcard
->tag_5F54
, currentcard
->tag_5F54_len
);
199 returnedlength
= currentcard
->tag_5F54_len
; goto exitfunction
;}
202 if(*(tag
+1) == 0x01){
203 memcpy(&returnedtag
, currentcard
->tag_9F01
, sizeof(currentcard
->tag_9F01
));
204 returnedlength
= sizeof(currentcard
->tag_9F01
);goto exitfunction
;}
205 else if(*(tag
+1) == 0x02){
206 memcpy(&returnedtag
, currentcard
->tag_9F02
, sizeof(currentcard
->tag_9F02
));
207 returnedlength
= sizeof(currentcard
->tag_9F02
);goto exitfunction
;}
208 else if(*(tag
+1) == 0x03){
209 returnedlength
= sizeof(currentcard
->tag_9F03
);goto exitfunction
;}
210 else if(*(tag
+1) == 0x04){
211 memcpy(&returnedtag
, currentcard
->tag_9F04
, sizeof(currentcard
->tag_9F04
));
212 returnedlength
= sizeof(currentcard
->tag_9F04
);goto exitfunction
;}
213 else if(*(tag
+1) == 0x05){
214 memcpy(&returnedtag
, currentcard
->tag_9F05
, currentcard
->tag_9F05_len
);
215 returnedlength
= currentcard
->tag_9F05_len
; goto exitfunction
;}
216 else if(*(tag
+1) == 0x06){
217 memcpy(&returnedtag
, currentcard
->tag_9F06
, currentcard
->tag_9F06_len
);
218 returnedlength
= currentcard
->tag_9F06_len
; goto exitfunction
;}
219 else if(*(tag
+1) == 0x07){
220 memcpy(&returnedtag
, currentcard
->tag_9F07
, sizeof(currentcard
->tag_9F07
));
221 returnedlength
= sizeof(currentcard
->tag_9F07
);goto exitfunction
;}
222 else if(*(tag
+1) == 0x08){
223 memcpy(&returnedtag
, currentcard
->tag_9F08
, sizeof(currentcard
->tag_9F08
));
224 returnedlength
= sizeof(currentcard
->tag_9F08
);goto exitfunction
;}
225 else if(*(tag
+1) == 0x09){
226 memcpy(&returnedtag
, currentcard
->tag_9F09
, sizeof(currentcard
->tag_9F09
));
227 returnedlength
= sizeof(currentcard
->tag_9F09
);goto exitfunction
;}
228 else if(*(tag
+1) == 0x0B){
229 memcpy(&returnedtag
, currentcard
->tag_9F0B
, currentcard
->tag_9F0B_len
);
230 returnedlength
= currentcard
->tag_9F0B_len
; goto exitfunction
;}
231 else if(*(tag
+1) == 0x0D){
232 memcpy(&returnedtag
, currentcard
->tag_9F0D
, sizeof(currentcard
->tag_9F0D
));
233 returnedlength
= sizeof(currentcard
->tag_9F0D
); goto exitfunction
;}
234 else if(*(tag
+1) == 0x0E){
235 memcpy(&returnedtag
, currentcard
->tag_9F0E
, sizeof(currentcard
->tag_9F0E
));
236 returnedlength
= sizeof(currentcard
->tag_9F0E
); goto exitfunction
;}
237 else if(*(tag
+1) == 0x0F){
238 memcpy(&returnedtag
, currentcard
->tag_9F0F
, sizeof(currentcard
->tag_9F0F
));
239 returnedlength
= sizeof(currentcard
->tag_9F0F
); goto exitfunction
;}
240 else if(*(tag
+1) == 0x10){
241 memcpy(&returnedtag
, currentcard
->tag_9F10
, currentcard
->tag_9F10_len
);
242 returnedlength
= currentcard
->tag_9F10_len
; goto exitfunction
;}
243 else if(*(tag
+1) == 0x11){
244 memcpy(&returnedtag
, currentcard
->tag_9F11
, sizeof(currentcard
->tag_9F11
));
245 returnedlength
= sizeof(currentcard
->tag_9F11
); goto exitfunction
;}
246 else if(*(tag
+1) == 0x12){
247 memcpy(&returnedtag
, currentcard
->tag_9F12
, currentcard
->tag_9F12_len
);
248 returnedlength
= currentcard
->tag_9F12_len
; goto exitfunction
;}
249 else if(*(tag
+1) == 0x1A){
250 memcpy(&returnedtag
, currentcard
->tag_9F1A
, sizeof(currentcard
->tag_9F1A
));
251 returnedlength
= sizeof(currentcard
->tag_9F1A
); goto exitfunction
;}
252 else if(*(tag
+1) == 0x1F){
253 memcpy(&returnedtag
, currentcard
->tag_9F1F
, currentcard
->tag_9F1F_len
);
254 returnedlength
= currentcard
->tag_9F1F_len
; goto exitfunction
;}
255 else if(*(tag
+1) == 0x32){
256 memcpy(&returnedtag
, currentcard
->tag_9F32
, currentcard
->tag_9F32_len
);
257 returnedlength
= currentcard
->tag_9F32_len
; goto exitfunction
;}
258 else if(*(tag
+1) == 0x34){
259 memcpy(&returnedtag
, currentcard
->tag_9F34
, sizeof(currentcard
->tag_9F34
));
260 returnedlength
= sizeof(currentcard
->tag_9F34
); goto exitfunction
;}
261 else if(*(tag
+1) == 0x35){
262 memcpy(&returnedtag
, currentcard
->tag_9F35
, sizeof(currentcard
->tag_9F35
));
263 returnedlength
= sizeof(currentcard
->tag_9F35
); goto exitfunction
;}
264 else if(*(tag
+1) == 0x37){
265 memcpy(&returnedtag
, currentcard
->tag_9F37
, sizeof(currentcard
->tag_9F37
));
266 returnedlength
= sizeof(currentcard
->tag_9F37
);goto exitfunction
;}
267 else if(*(tag
+1) == 0x38){
268 memcpy(&returnedtag
, currentcard
->tag_9F38
, currentcard
->tag_9F38_len
);
269 returnedlength
= currentcard
->tag_9F38_len
; goto exitfunction
;}
270 else if(*(tag
+1) == 0x44){
271 memcpy(&returnedtag
, currentcard
->tag_9F44
, sizeof(currentcard
->tag_9F44
));
272 returnedlength
= sizeof(currentcard
->tag_9F44
);goto exitfunction
;}
273 else if(*(tag
+1) == 0x45){
274 memcpy(&returnedtag
, currentcard
->tag_9F45
, sizeof(currentcard
->tag_9F45
));
275 returnedlength
= sizeof(currentcard
->tag_9F45
);goto exitfunction
;}
276 else if(*(tag
+1) == 0x46){
277 memcpy(&returnedtag
, currentcard
->tag_9F46
, currentcard
->tag_9F46_len
);
278 returnedlength
= currentcard
->tag_9F46_len
; goto exitfunction
;}
279 else if(*(tag
+1) == 0x47){
280 memcpy(&returnedtag
, currentcard
->tag_9F47
, currentcard
->tag_9F47_len
);
281 returnedlength
= currentcard
->tag_9F47_len
; goto exitfunction
;}
282 else if(*(tag
+1) == 0x48){
283 memcpy(&returnedtag
, currentcard
->tag_9F48
, currentcard
->tag_9F48_len
);
284 returnedlength
= currentcard
->tag_9F48_len
; goto exitfunction
;}
285 else if(*(tag
+1) == 0x49){
286 memcpy(&returnedtag
, currentcard
->tag_9F49
, currentcard
->tag_9F49_len
);
287 returnedlength
= currentcard
->tag_9F49_len
; goto exitfunction
;}
288 else if(*(tag
+1) == 0x4A){
289 memcpy(&returnedtag
, currentcard
->tag_9F4A
, sizeof(currentcard
->tag_9F4A
));
290 returnedlength
= sizeof(currentcard
->tag_9F4A
);goto exitfunction
;}
291 else if(*(tag
+1) == 0x4B){
292 memcpy(&returnedtag
, currentcard
->tag_9F4B
, currentcard
->tag_9F4B_len
);
293 returnedlength
= currentcard
->tag_9F4B_len
; goto exitfunction
;}
294 else if(*(tag
+1) == 0x4C){
295 memcpy(&returnedtag
, currentcard
->tag_9F4C
, sizeof(currentcard
->tag_9F4C
));
296 returnedlength
= sizeof(currentcard
->tag_9F4C
); goto exitfunction
;}
297 else if(*(tag
+1) == 0x60){
298 memcpy(&returnedtag
, currentcard
->tag_9F60
, sizeof(currentcard
->tag_9F60
));
299 returnedlength
= sizeof(currentcard
->tag_9F60
);goto exitfunction
;}
300 else if(*(tag
+1) == 0x61){
301 memcpy(&returnedtag
, currentcard
->tag_9F61
, sizeof(currentcard
->tag_9F61
));
302 returnedlength
= sizeof(currentcard
->tag_9F61
);goto exitfunction
;}
303 else if(*(tag
+1) == 0x62){
304 memcpy(&returnedtag
, currentcard
->tag_9F62
, sizeof(currentcard
->tag_9F62
));
305 returnedlength
= sizeof(currentcard
->tag_9F62
);goto exitfunction
;}
306 else if(*(tag
+1) == 0x63){
307 memcpy(&returnedtag
, currentcard
->tag_9F63
, sizeof(currentcard
->tag_9F63
));
308 returnedlength
= sizeof(currentcard
->tag_9F63
);goto exitfunction
;}
309 else if(*(tag
+1) == 0x64){
310 memcpy(&returnedtag
, currentcard
->tag_9F64
, sizeof(currentcard
->tag_9F64
));
311 returnedlength
= sizeof(currentcard
->tag_9F64
);goto exitfunction
;}
312 else if(*(tag
+1) == 0x65){
313 memcpy(&returnedtag
, currentcard
->tag_9F65
, sizeof(currentcard
->tag_9F65
));
314 returnedlength
= sizeof(currentcard
->tag_9F65
);goto exitfunction
;}
315 else if(*(tag
+1) == 0x66){
316 memcpy(&returnedtag
, currentcard
->tag_9F66
, sizeof(currentcard
->tag_9F66
));
317 returnedlength
= sizeof(currentcard
->tag_9F66
);goto exitfunction
;}
318 else if(*(tag
+1) == 0x67){
319 memcpy(&returnedtag
, currentcard
->tag_9F67
, sizeof(currentcard
->tag_9F67
));
320 returnedlength
= sizeof(currentcard
->tag_9F67
);goto exitfunction
;}
321 else if(*(tag
+1) == 0x68){
322 memcpy(&returnedtag
, currentcard
->tag_9F68
, currentcard
->tag_9F68_len
);
323 returnedlength
= currentcard
->tag_9F68_len
;goto exitfunction
;}
324 else if(*(tag
+1) == 0x69){
325 memcpy(&returnedtag
, currentcard
->tag_9F69
, currentcard
->tag_9F69_len
);
326 returnedlength
= currentcard
->tag_9F69_len
; goto exitfunction
;}
327 else if(*(tag
+1) == 0x6A){
328 memcpy(&returnedtag
, currentcard
->tag_9F6A
, sizeof(currentcard
->tag_9F6A
));
329 returnedlength
= sizeof(currentcard
->tag_9F6A
);goto exitfunction
;}
330 else if(*(tag
+1) == 0x6B){
331 memcpy(&returnedtag
, currentcard
->tag_9F6B
, currentcard
->tag_9F6B_len
);
332 returnedlength
= currentcard
->tag_9F6B_len
; goto exitfunction
;}
333 else if(*(tag
+1) == 0x6C){
334 memcpy(&returnedtag
, currentcard
->tag_9F6C
, sizeof(currentcard
->tag_9F6C
));
335 returnedlength
= sizeof(currentcard
->tag_9F6C
);goto exitfunction
;}
338 if(!memcmp(tag
, "\x61\x00",2)){
339 memcpy(&returnedtag
, currentcard
->tag_61
, currentcard
->tag_61_len
);
340 returnedlength
= currentcard
->tag_61_len
; goto exitfunction
;}
341 else if(!memcmp(tag
, "\x6F\x00",2)){
342 memcpy(&returnedtag
, currentcard
->tag_6F
, currentcard
->tag_6F_len
);
343 returnedlength
= currentcard
->tag_6F_len
; goto exitfunction
;}
344 else if(!memcmp(tag
, "\xAF\x00",2)){
345 memcpy(&returnedtag
, currentcard
->tag_AF
, currentcard
->tag_AF_len
);
346 returnedlength
= currentcard
->tag_AF_len
; goto exitfunction
;}
347 else if(!memcmp(tag
, "\x70\x00",2)){
348 memcpy(&returnedtag
, currentcard
->tag_70
, currentcard
->tag_70_len
);
349 returnedlength
= currentcard
->tag_70_len
; goto exitfunction
;}
350 else if(!memcmp(tag
, "\x77\x00",2)){
351 memcpy(&returnedtag
, currentcard
->tag_77
, currentcard
->tag_77_len
);
352 returnedlength
= currentcard
->tag_77_len
; goto exitfunction
;}
353 else if(!memcmp(tag
, "\x80\x00",2)){
354 memcpy(&returnedtag
, currentcard
->tag_80
, currentcard
->tag_80_len
);
355 returnedlength
= currentcard
->tag_80_len
; goto exitfunction
;}
356 else if(!memcmp(tag
, "\xBF\x0C",2)){
357 memcpy(&returnedtag
, currentcard
->tag_BF0C
, currentcard
->tag_BF0C_len
);
358 returnedlength
= currentcard
->tag_BF0C_len
; goto exitfunction
;}
359 else if(!memcmp(tag
, "\xFF\x01",2)){ //special DF tag
360 memcpy(&returnedtag
, currentcard
->tag_DFName
, currentcard
->tag_DFName_len
);
361 returnedlength
= currentcard
->tag_DFName_len
; goto exitfunction
;}
363 exitfunction
: //goto label to exit search quickly once found
364 memcpy(outputval
, &returnedtag
, returnedlength
);
365 *outputvallen
= returnedlength
;
370 int emv_settag(uint32_t tag
, uint8_t *datain
, emvcard
*currentcard
){
371 char binarydata
[255] = {0};
374 // if((strlen((const char *)datain)%2) != 0){ //must be an even string
377 // if(strlen((const char *)datain) > 255) {
382 uint8_t datalen
= strlen((const char *)datain
) / 2; //length of datain
383 for(int i
= 0; i
< strlen((const char *)datain
); i
+= 2){
384 binarydata
[i
/2] |= (char)hex2int(datain
[i
]) << 4;
385 binarydata
[i
/2] |= (char)hex2int(datain
[i
+1]);
387 Dbprintf("BINARYDATA=");
388 Dbhexdump(datalen
,(uint8_t *)binarydata
,false);
392 memcpy(currentcard
->tag_4F
, binarydata
, datalen
);
393 currentcard
->tag_4F_len
= datalen
;
396 memcpy(currentcard
->tag_50
, binarydata
, datalen
);
397 currentcard
->tag_50_len
= datalen
;
400 memcpy(currentcard
->tag_56
, binarydata
, datalen
);
401 currentcard
->tag_56_len
= datalen
;
404 memcpy(currentcard
->tag_57
, binarydata
, datalen
);
405 currentcard
->tag_57_len
= datalen
;
408 memcpy(currentcard
->tag_5A
, binarydata
, datalen
);
409 currentcard
->tag_5A_len
= datalen
;
412 memcpy(currentcard
->tag_61
, binarydata
, datalen
);
413 currentcard
->tag_61_len
= datalen
;
416 memcpy(currentcard
->tag_6F
, binarydata
, datalen
);
417 currentcard
->tag_6F_len
= datalen
;
420 memcpy(currentcard
->tag_70
, binarydata
, datalen
);
421 currentcard
->tag_70_len
= datalen
;
424 memcpy(currentcard
->tag_77
, binarydata
, datalen
);
425 currentcard
->tag_77_len
= datalen
;
428 memcpy(currentcard
->tag_80
, binarydata
, datalen
);
429 currentcard
->tag_80_len
= datalen
;
432 memcpy(currentcard
->tag_82
, binarydata
, sizeof(currentcard
->tag_82
));
435 memcpy(currentcard
->tag_84
, binarydata
, datalen
);
436 currentcard
->tag_84_len
= datalen
;
439 memcpy(currentcard
->tag_86
, binarydata
, datalen
);
440 currentcard
->tag_86_len
= datalen
;
443 memcpy(currentcard
->tag_87
, binarydata
, sizeof(currentcard
->tag_87
));
446 memcpy(currentcard
->tag_88
, binarydata
, sizeof(currentcard
->tag_88
));
449 memcpy(currentcard
->tag_8A
, binarydata
, sizeof(currentcard
->tag_8A
));
452 memcpy(currentcard
->tag_8C
, binarydata
, datalen
);
453 currentcard
->tag_8C_len
= datalen
;
456 memcpy(currentcard
->tag_8D
, binarydata
, datalen
);
457 currentcard
->tag_8D_len
= datalen
;
460 memcpy(currentcard
->tag_8E
, binarydata
, datalen
);
461 currentcard
->tag_8E_len
= datalen
;
464 memcpy(currentcard
->tag_8F
, binarydata
, sizeof(currentcard
->tag_8F
));
467 memcpy(currentcard
->tag_90
, binarydata
, datalen
);
468 currentcard
->tag_90_len
= datalen
;
471 memcpy(currentcard
->tag_91
, binarydata
, datalen
);
472 currentcard
->tag_91_len
= datalen
;
475 memcpy(currentcard
->tag_92
, binarydata
, datalen
);
476 currentcard
->tag_92_len
= datalen
;
479 memcpy(currentcard
->tag_93
, binarydata
, datalen
);
480 currentcard
->tag_93_len
= datalen
;
483 memcpy(currentcard
->tag_94
, binarydata
, datalen
);
484 currentcard
->tag_94_len
= datalen
;
487 memcpy(currentcard
->tag_95
, binarydata
, sizeof(currentcard
->tag_95
));
490 memcpy(currentcard
->tag_97
, binarydata
, datalen
);
491 currentcard
->tag_97_len
= datalen
;
494 memcpy(currentcard
->tag_98
, binarydata
, sizeof(currentcard
->tag_98
));
497 memcpy(currentcard
->tag_99
, binarydata
, datalen
);
498 currentcard
->tag_99_len
= datalen
;
501 memcpy(currentcard
->tag_9A
, binarydata
, sizeof(currentcard
->tag_9A
));
504 memcpy(currentcard
->tag_9B
, binarydata
, sizeof(currentcard
->tag_9B
));
507 memcpy(currentcard
->tag_9C
, binarydata
, sizeof(currentcard
->tag_9C
));
510 memcpy(currentcard
->tag_9D
, binarydata
, datalen
);
511 currentcard
->tag_9D_len
= datalen
;
514 memcpy(currentcard
->tag_A5
, binarydata
, datalen
);
515 currentcard
->tag_A5_len
= datalen
;
518 memcpy(currentcard
->tag_AF
, binarydata
, datalen
);
519 currentcard
->tag_AF_len
= datalen
;
522 memcpy(currentcard
->tag_CD
, binarydata
, sizeof(currentcard
->tag_CD
));
525 memcpy(currentcard
->tag_CE
, binarydata
, sizeof(currentcard
->tag_CE
));
528 memcpy(currentcard
->tag_CF
, binarydata
, sizeof(currentcard
->tag_CF
));
531 memcpy(currentcard
->tag_CF
, binarydata
, sizeof(currentcard
->tag_CF
));
534 memcpy(currentcard
->tag_CF
, binarydata
, sizeof(currentcard
->tag_CF
));
539 memcpy(currentcard
->tag_DA
, binarydata
, sizeof(currentcard
->tag_DA
));
542 memcpy(currentcard
->tag_DB
, binarydata
, sizeof(currentcard
->tag_DB
));
545 memcpy(currentcard
->tag_DB
, binarydata
, sizeof(currentcard
->tag_DB
));
548 memcpy(currentcard
->tag_DD
, binarydata
, sizeof(currentcard
->tag_DD
));
553 memcpy(currentcard
->tag_5F24
, binarydata
, sizeof(currentcard
->tag_5F24
));
556 memcpy(currentcard
->tag_5F25
, binarydata
, sizeof(currentcard
->tag_5F25
));
559 memcpy(currentcard
->tag_5F28
, binarydata
, sizeof(currentcard
->tag_5F28
));
562 memcpy(currentcard
->tag_5F2A
, binarydata
, sizeof(currentcard
->tag_5F2A
));
567 memcpy(currentcard
->tag_5F30
, binarydata
, sizeof(currentcard
->tag_5F30
));
570 memcpy(currentcard
->tag_5F34
, binarydata
, sizeof(currentcard
->tag_5F34
));
573 memcpy(currentcard
->tag_5F36
, binarydata
, sizeof(currentcard
->tag_5F36
));
578 memcpy(currentcard
->tag_5F54
, binarydata
, sizeof(currentcard
->tag_5F54
));
581 memcpy(currentcard
->tag_9F01
, binarydata
, sizeof(currentcard
->tag_9F01
));
584 memcpy(currentcard
->tag_9F02
, binarydata
, sizeof(currentcard
->tag_9F02
));
587 memcpy(currentcard
->tag_9F03
, binarydata
, sizeof(currentcard
->tag_9F03
));
590 memcpy(currentcard
->tag_9F04
, binarydata
, sizeof(currentcard
->tag_9F04
));
593 memcpy(currentcard
->tag_9F05
, binarydata
, datalen
);
594 currentcard
->tag_9F05_len
= datalen
;
597 memcpy(currentcard
->tag_9F06
, binarydata
, datalen
);
598 currentcard
->tag_9F06_len
= datalen
;
601 memcpy(currentcard
->tag_9F07
, binarydata
, sizeof(currentcard
->tag_9F07
));
604 memcpy(currentcard
->tag_9F08
, binarydata
, sizeof(currentcard
->tag_9F08
));
607 memcpy(currentcard
->tag_9F09
, binarydata
, sizeof(currentcard
->tag_9F09
));
610 memcpy(currentcard
->tag_9F0B
, binarydata
, sizeof(currentcard
->tag_9F0B
));
613 memcpy(currentcard
->tag_9F0D
, binarydata
, sizeof(currentcard
->tag_9F0D
));
616 memcpy(currentcard
->tag_9F0E
, binarydata
, sizeof(currentcard
->tag_9F0E
));
619 memcpy(currentcard
->tag_9F0F
, binarydata
, sizeof(currentcard
->tag_9F0F
));
622 memcpy(currentcard
->tag_9F10
, binarydata
, datalen
);
623 currentcard
->tag_9F10_len
= datalen
;break;
625 memcpy(currentcard
->tag_9F11
, binarydata
, sizeof(currentcard
->tag_9F11
));
628 memcpy(currentcard
->tag_9F12
, binarydata
, datalen
);
629 currentcard
->tag_9F12_len
= datalen
;break;
631 memcpy(currentcard
->tag_9F13
, binarydata
, sizeof(currentcard
->tag_9F13
));
634 memcpy(currentcard
->tag_9F14
, binarydata
, sizeof(currentcard
->tag_9F14
));
637 memcpy(currentcard
->tag_9F15
, binarydata
, sizeof(currentcard
->tag_9F15
));
640 memcpy(currentcard
->tag_9F16
, binarydata
, sizeof(currentcard
->tag_9F16
));
643 memcpy(currentcard
->tag_9F17
, binarydata
, sizeof(currentcard
->tag_9F17
));
646 memcpy(currentcard
->tag_9F18
, binarydata
, sizeof(currentcard
->tag_9F18
));
649 memcpy(currentcard
->tag_9F1A
, binarydata
, sizeof(currentcard
->tag_9F1A
));
652 memcpy(currentcard
->tag_9F1B
, binarydata
, sizeof(currentcard
->tag_9F1B
));
655 memcpy(currentcard
->tag_9F1C
, binarydata
, sizeof(currentcard
->tag_9F1C
));
658 memcpy(currentcard
->tag_9F1D
, binarydata
, datalen
);
659 currentcard
->tag_9F1D_len
= datalen
;break;
661 memcpy(currentcard
->tag_9F1E
, binarydata
, sizeof(currentcard
->tag_9F1E
));
664 memcpy(currentcard
->tag_9F1F
, binarydata
, datalen
);
665 currentcard
->tag_9F1F_len
= datalen
;break;
667 memcpy(currentcard
->tag_9F20
, binarydata
, datalen
);
668 currentcard
->tag_9F20_len
= datalen
;break;
670 memcpy(currentcard
->tag_9F21
, binarydata
, sizeof(currentcard
->tag_9F21
));
673 memcpy(currentcard
->tag_9F22
, binarydata
, sizeof(currentcard
->tag_9F22
));
676 memcpy(currentcard
->tag_9F23
, binarydata
, sizeof(currentcard
->tag_9F23
));
679 memcpy(currentcard
->tag_9F26
, binarydata
, sizeof(currentcard
->tag_9F26
));
682 memcpy(currentcard
->tag_9F27
, binarydata
, sizeof(currentcard
->tag_9F27
));
685 memcpy(currentcard
->tag_9F2D
, binarydata
, datalen
);
686 currentcard
->tag_9F2D_len
= datalen
;break;
688 memcpy(currentcard
->tag_9F2E
, binarydata
, sizeof(currentcard
->tag_9F2E
));
691 memcpy(currentcard
->tag_9F2F
, binarydata
, datalen
);
692 currentcard
->tag_9F2F_len
= datalen
;break;
694 memcpy(currentcard
->tag_9F32
, binarydata
, datalen
);
695 currentcard
->tag_9F32_len
= datalen
;break;
697 memcpy(currentcard
->tag_9F33
, binarydata
, sizeof(currentcard
->tag_9F33
));
700 memcpy(currentcard
->tag_9F34
, binarydata
, sizeof(currentcard
->tag_9F34
));
703 memcpy(currentcard
->tag_9F35
, binarydata
, sizeof(currentcard
->tag_9F35
));
706 memcpy(currentcard
->tag_9F36
, binarydata
, sizeof(currentcard
->tag_9F36
));
709 memcpy(currentcard
->tag_9F37
, binarydata
, sizeof(currentcard
->tag_9F37
));
714 memcpy(currentcard
->tag_9F39
, binarydata
, sizeof(currentcard
->tag_9F39
));
717 memcpy(currentcard
->tag_9F40
, binarydata
, sizeof(currentcard
->tag_9F40
));
720 memcpy(currentcard
->tag_9F41
, binarydata
, sizeof(currentcard
->tag_9F41
));
723 memcpy(currentcard
->tag_9F42
, binarydata
, sizeof(currentcard
->tag_9F42
));
726 memcpy(currentcard
->tag_9F43
, binarydata
, sizeof(currentcard
->tag_9F43
));
729 memcpy(currentcard
->tag_9F44
, binarydata
, sizeof(currentcard
->tag_9F44
));
732 memcpy(currentcard
->tag_9F45
, binarydata
, sizeof(currentcard
->tag_9F45
));
735 memcpy(currentcard
->tag_9F46
, binarydata
, datalen
);
736 currentcard
->tag_9F46_len
= datalen
;break;
738 memcpy(currentcard
->tag_9F47
, binarydata
, datalen
);
739 currentcard
->tag_9F47_len
= datalen
;break;
741 memcpy(currentcard
->tag_9F48
, binarydata
, datalen
);
742 currentcard
->tag_9F48_len
= datalen
;break;
744 memcpy(currentcard
->tag_9F49
, binarydata
, datalen
);
745 currentcard
->tag_9F49_len
= datalen
;break;
747 memcpy(currentcard
->tag_9F4A
, binarydata
, sizeof(currentcard
->tag_9F4A
));
750 memcpy(currentcard
->tag_9F4B
, binarydata
, datalen
);
751 currentcard
->tag_9F4B_len
= datalen
;break;
753 memcpy(currentcard
->tag_9F4C
, binarydata
, sizeof(currentcard
->tag_9F4C
));
756 memcpy(currentcard
->tag_9F4D
, binarydata
, sizeof(currentcard
->tag_9F4D
));
759 memcpy(currentcard
->tag_9F4E
, binarydata
, sizeof(currentcard
->tag_9F4E
));
762 memcpy(currentcard
->tag_9F60
, binarydata
, sizeof(currentcard
->tag_9F60
));
765 memcpy(currentcard
->tag_9F61
, binarydata
, sizeof(currentcard
->tag_9F61
));
768 memcpy(currentcard
->tag_9F62
, binarydata
, sizeof(currentcard
->tag_9F62
));
771 memcpy(currentcard
->tag_9F63
, binarydata
, sizeof(currentcard
->tag_9F63
));
774 memcpy(currentcard
->tag_9F64
, binarydata
, sizeof(currentcard
->tag_9F64
));
777 memcpy(currentcard
->tag_9F65
, binarydata
, sizeof(currentcard
->tag_9F65
));
780 memcpy(currentcard
->tag_9F66
, binarydata
, sizeof(currentcard
->tag_9F66
));
783 memcpy(currentcard
->tag_9F67
, binarydata
, sizeof(currentcard
->tag_9F67
));
786 memcpy(currentcard
->tag_9F68
, binarydata
, datalen
);
787 currentcard
->tag_9F68_len
= datalen
;break;
789 memcpy(currentcard
->tag_9F69
, binarydata
, datalen
);
790 currentcard
->tag_9F69_len
= datalen
;break;
792 memcpy(currentcard
->tag_9F6A
, binarydata
, sizeof(currentcard
->tag_9F6A
));
795 memcpy(currentcard
->tag_9F6B
, binarydata
, sizeof(currentcard
->tag_9F6B
));
798 memcpy(currentcard
->tag_9F6C
, binarydata
, sizeof(currentcard
->tag_9F6C
));
801 memcpy(currentcard
->tag_BF0C
, binarydata
, datalen
);
802 currentcard
->tag_BF0C_len
= datalen
;break;
809 /* generates an emv template based off tag values supplied */
810 int emv_generatetemplate(uint8_t* templateval
,emvcard
* currentcard
, uint8_t* returnedval
, uint8_t* returnedlen
,uint8_t numtags
, ...)
813 uint8_t* currenttag
; //value of the current tag
814 uint8_t tagval
[256]; //buffer to hold the extracted tag value
815 uint8_t taglen
= 0; //extracted tag length
816 uint8_t bufferval
[256];
818 uint32_t encodedlen
= 0;
819 va_start(arguments
, numtags
);
820 for(int x
=0; x
<numtags
; x
++){
821 currenttag
= va_arg(arguments
, uint8_t*);
822 emv_lookuptag(currenttag
, currentcard
, tagval
, &taglen
);
823 encode_ber_tlv_item(currenttag
, (uint8_t)strlen((const char*)currenttag
), tagval
, (uint32_t)taglen
, bufferval
+counter
, &encodedlen
);
824 counter
+=encodedlen
;
826 encode_ber_tlv_item(templateval
, strlen((const char*) templateval
), bufferval
, counter
, returnedval
, &encodedlen
);
827 *returnedlen
= encodedlen
;
832 //generate a valid pdol list
833 int emv_generateDOL(uint8_t* DOL
, uint8_t DOLlen
,emvcard
* currentcard
,uint8_t* DOLoutput
, uint8_t* DOLoutputlen
)
835 if(!DOL
|| !currentcard
|| !DOLoutput
) // null pointer checks
837 //scan through the DOL list and construct the result.
839 uint8_t DOLcounter
= 0; //points to the current DOL buffer location
840 uint8_t scannedtaglen
= 0; //length of a scanned tag
841 uint8_t scannedtag
[2] = {0x00,0x00}; //buffer for the scanned tag
842 uint8_t DOLoutputbuffer
[255];
843 uint8_t retrievedtagvallen
;
845 memset(DOLoutputbuffer
,0x00, 255); //clear the output buffer
849 if((*(DOL
+i
) & 0x1F) == 0x1F)
850 { scannedtaglen
= 2;}
853 memcpy(scannedtag
, DOL
+i
,scannedtaglen
);
854 //look up tag value and copy
855 //Dbhexdump(2,scannedtag,false);
856 emv_lookuptag(scannedtag
,currentcard
,&(DOLoutputbuffer
[DOLcounter
]),&retrievedtagvallen
);
857 DOLcounter
+= (uint8_t)DOL
[i
+scannedtaglen
];
858 i
+= scannedtaglen
+ 1;
859 memset(scannedtag
, 0x00, 2); //clear current tag
862 memcpy(DOLoutput
, DOLoutputbuffer
, DOLcounter
);
863 *DOLoutputlen
= DOLcounter
;
868 //decode the tag inputted and fill in the supplied structure. clean up the cleanup_passpass function
869 int emv_emvtags_decode_tag(tlvtag
* inputtag
, emvcard
* currentcard
)
871 if(!inputtag
|| !currentcard
) {
875 if(*(inputtag
->tag
) == 0x5F) {
876 if(*(inputtag
->tag
+1) == 0x20){
877 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_5F20
)))
879 memcpy(currentcard
->tag_5F20
, inputtag
->value
, inputtag
->valuelength
);
880 currentcard
->tag_5F20_len
= inputtag
->valuelength
;
882 if(*(inputtag
->tag
+1) == 0x24){
883 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_5F24
)))
885 memcpy(currentcard
->tag_5F24
, inputtag
->value
, sizeof(currentcard
->tag_5F24
));}
886 if(*(inputtag
->tag
+1) == 0x25){
887 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_5F25
)))
889 memcpy(currentcard
->tag_5F25
, inputtag
->value
, inputtag
->valuelength
);}
890 if(*(inputtag
->tag
+1) == 0x28){
891 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_5F28
)))
893 memcpy(currentcard
->tag_5F28
, inputtag
->value
, inputtag
->valuelength
);}
894 if(*(inputtag
->tag
+1) == 0x2A){
895 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_5F2A
)))
897 memcpy(currentcard
->tag_5F2A
, inputtag
->value
, inputtag
->valuelength
);}
898 if(*(inputtag
->tag
+1) == 0x2D){
899 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_5F2D
)))
901 memcpy(currentcard
->tag_5F2D
, inputtag
->value
, inputtag
->valuelength
);
902 currentcard
->tag_5F2D_len
= inputtag
->valuelength
;}
903 if(*(inputtag
->tag
+1) == 0x30){
904 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_5F30
)))
906 memcpy(currentcard
->tag_5F30
, inputtag
->value
, inputtag
->valuelength
);}
907 if(*(inputtag
->tag
+1) == 0x34){
908 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_5F34
)))
910 memcpy(currentcard
->tag_5F34
, inputtag
->value
, sizeof(currentcard
->tag_5F34
));}
911 if(*(inputtag
->tag
+1) == 0x36){
912 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_5F36
)))
914 memcpy(currentcard
->tag_5F36
, inputtag
->value
, sizeof(currentcard
->tag_5F36
));}
915 if(*(inputtag
->tag
+1) == 0x50){
916 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_5F50
)))
918 memcpy(currentcard
->tag_5F50
, inputtag
->value
, inputtag
->valuelength
);
919 currentcard
->tag_5F50_len
= inputtag
->valuelength
;}
920 if(*(inputtag
->tag
+1) == 0x54){
921 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_5F54
)))
923 memcpy(currentcard
->tag_5F54
, inputtag
->value
, inputtag
->valuelength
);
924 currentcard
->tag_5F54_len
= inputtag
->valuelength
;}
926 if(*(inputtag
->tag
) == 0x9F){
927 if(*(inputtag
->tag
+1) == 0x01){
928 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F01
)))
930 memcpy(currentcard
->tag_9F01
, inputtag
->value
, inputtag
->valuelength
);}
931 if(*(inputtag
->tag
+1) == 0x02){
932 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F02
)))
934 memcpy(currentcard
->tag_9F02
, inputtag
->value
, inputtag
->valuelength
);}
935 if(*(inputtag
->tag
+1) == 0x03){
936 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F03
)))
938 memcpy(currentcard
->tag_9F03
, inputtag
->value
, inputtag
->valuelength
);}
939 if(*(inputtag
->tag
+1) == 0x04){
940 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F04
)))
942 memcpy(currentcard
->tag_9F04
, inputtag
->value
, inputtag
->valuelength
);}
943 if(*(inputtag
->tag
+1) == 0x05){
944 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F05
)))
946 memcpy(currentcard
->tag_9F05
, inputtag
->value
, inputtag
->valuelength
);
947 currentcard
->tag_9F05_len
= inputtag
->valuelength
;}
948 if(*(inputtag
->tag
+1) == 0x06){
949 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F06
)))
951 memcpy(currentcard
->tag_9F06
, inputtag
->value
, inputtag
->valuelength
);
952 currentcard
->tag_9F06_len
= inputtag
->valuelength
;}
953 if(*(inputtag
->tag
+1) == 0x07){
954 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F07
)))
956 memcpy(currentcard
->tag_9F07
, inputtag
->value
, inputtag
->valuelength
);}
957 if(*(inputtag
->tag
+1) == 0x08){
958 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F08
)))
960 memcpy(currentcard
->tag_9F08
, inputtag
->value
, inputtag
->valuelength
);}
961 if(*(inputtag
->tag
+1) == 0x09){
962 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F09
)))
964 memcpy(currentcard
->tag_9F09
, inputtag
->value
, inputtag
->valuelength
);}
965 if(*(inputtag
->tag
+1) == 0x0B){
966 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F0B
)))
968 memcpy(currentcard
->tag_9F0B
, inputtag
->value
, inputtag
->valuelength
);
969 currentcard
->tag_9F0B_len
= inputtag
->valuelength
;}
970 if(*(inputtag
->tag
+1) == 0x0D){
971 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F0D
)))
973 memcpy(currentcard
->tag_9F0D
, inputtag
->value
, inputtag
->valuelength
);}
974 if(*(inputtag
->tag
+1) == 0x0E){
975 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F0E
)))
977 memcpy(currentcard
->tag_9F0E
, inputtag
->value
, inputtag
->valuelength
);}
978 if(*(inputtag
->tag
+1) == 0x0F){
979 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F0F
)))
981 memcpy(currentcard
->tag_9F0F
, inputtag
->value
, inputtag
->valuelength
);}
982 if(*(inputtag
->tag
+1) == 0x11){
983 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F11
)))
985 memcpy(currentcard
->tag_9F11
, inputtag
->value
, inputtag
->valuelength
);}
986 if(*(inputtag
->tag
+1) == 0x12){
987 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F12
)))
989 memcpy(currentcard
->tag_9F12
, inputtag
->value
, inputtag
->valuelength
);
990 currentcard
->tag_9F12_len
= inputtag
->valuelength
;}
991 if(*(inputtag
->tag
+1) == 0x13){
992 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F13
)))
994 memcpy(currentcard
->tag_9F13
, inputtag
->value
, inputtag
->valuelength
);}
995 if(*(inputtag
->tag
+1) == 0x14){
996 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F14
)))
998 memcpy(currentcard
->tag_9F14
, inputtag
->value
, inputtag
->valuelength
);}
999 if(*(inputtag
->tag
+1) == 0x15){
1000 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F15
)))
1002 memcpy(currentcard
->tag_9F15
, inputtag
->value
, inputtag
->valuelength
);}
1003 if(*(inputtag
->tag
+1) == 0x16){
1004 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F16
)))
1006 memcpy(currentcard
->tag_9F16
, inputtag
->value
, inputtag
->valuelength
);}
1007 if(*(inputtag
->tag
+1) == 0x17){
1008 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F17
)))
1010 memcpy(currentcard
->tag_9F17
, inputtag
->value
, inputtag
->valuelength
);}
1011 if(*(inputtag
->tag
+1) == 0x18){
1012 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F18
)))
1014 memcpy(currentcard
->tag_9F18
, inputtag
->value
, inputtag
->valuelength
);}
1015 if(*(inputtag
->tag
+1) == 0x1A){
1016 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F1A
)))
1018 memcpy(currentcard
->tag_9F1A
, inputtag
->value
, inputtag
->valuelength
);}
1019 if(*(inputtag
->tag
+1) == 0x1B){
1020 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F1B
)))
1022 memcpy(currentcard
->tag_9F1B
, inputtag
->value
, inputtag
->valuelength
);}
1023 if(*(inputtag
->tag
+1) == 0x1C){
1024 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F1C
)))
1026 memcpy(currentcard
->tag_9F1C
, inputtag
->value
, inputtag
->valuelength
);}
1027 if(*(inputtag
->tag
+1) == 0x1D){
1028 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F1D
)))
1030 memcpy(currentcard
->tag_9F1D
, inputtag
->value
, inputtag
->valuelength
);
1031 currentcard
->tag_9F1D_len
= inputtag
->valuelength
;}
1032 if(*(inputtag
->tag
+1) == 0x1E){
1033 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F1E
)))
1035 memcpy(currentcard
->tag_9F1E
, inputtag
->value
, inputtag
->valuelength
);}
1036 if(*(inputtag
->tag
+1) == 0x1F){
1037 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F1F
)))
1039 memcpy(currentcard
->tag_9F1F
, inputtag
->value
, inputtag
->valuelength
);
1040 currentcard
->tag_9F1F_len
= inputtag
->valuelength
;}
1041 if(*(inputtag
->tag
+1) == 0x32){
1042 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F32
)))
1044 currentcard
->tag_9F32_len
= inputtag
->valuelength
;
1045 memcpy(currentcard
->tag_9F32
, inputtag
->value
, inputtag
->valuelength
);
1047 if(*(inputtag
->tag
+1) == 0x34){
1048 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F34
)))
1050 memcpy(currentcard
->tag_9F34
, inputtag
->value
, inputtag
->valuelength
);}
1051 if(*(inputtag
->tag
+1) == 0x35){
1052 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F35
)))
1054 memcpy(currentcard
->tag_9F35
, inputtag
->value
, inputtag
->valuelength
);}
1055 if(*(inputtag
->tag
+1) == 0x37){
1056 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F37
)))
1058 memcpy(currentcard
->tag_9F37
, inputtag
->value
, inputtag
->valuelength
);}
1059 if(*(inputtag
->tag
+1) == 0x38){
1060 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F38
)))
1062 memcpy(currentcard
->tag_9F38
, inputtag
->value
, inputtag
->valuelength
);
1063 currentcard
->tag_9F38_len
= inputtag
->valuelength
;}
1064 if(*(inputtag
->tag
+1) == 0x44){
1065 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F44
)))
1067 memcpy(currentcard
->tag_9F44
, inputtag
->value
, inputtag
->valuelength
);}
1068 if(*(inputtag
->tag
+1) == 0x45){
1069 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F45
)))
1071 memcpy(currentcard
->tag_9F45
, inputtag
->value
, inputtag
->valuelength
);}
1072 if(*(inputtag
->tag
+1) == 0x46){
1073 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F46
)))
1075 memcpy(currentcard
->tag_9F46
, inputtag
->value
, inputtag
->valuelength
);
1076 currentcard
->tag_9F46_len
= inputtag
->valuelength
;}
1077 if(*(inputtag
->tag
+1) == 0x47){
1078 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F47
)))
1080 memcpy(currentcard
->tag_9F47
, inputtag
->value
, inputtag
->valuelength
);
1081 currentcard
->tag_9F47_len
= inputtag
->valuelength
;}
1082 if(*(inputtag
->tag
+1) == 0x48){
1083 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F48
)))
1085 memcpy(currentcard
->tag_9F48
, inputtag
->value
, inputtag
->valuelength
);
1086 currentcard
->tag_9F48_len
= inputtag
->valuelength
;}
1087 if(*(inputtag
->tag
+1) == 0x49){
1088 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F49
)))
1090 memcpy(currentcard
->tag_9F49
, inputtag
->value
, inputtag
->valuelength
);
1091 currentcard
->tag_9F49_len
= inputtag
->valuelength
;}
1092 if(*(inputtag
->tag
+1) == 0x4A){
1093 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F4A
)))
1095 memcpy(currentcard
->tag_9F4A
, inputtag
->value
, inputtag
->valuelength
);}
1096 if(*(inputtag
->tag
+1) == 0x4B){
1097 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F4B
)))
1099 memcpy(currentcard
->tag_9F4B
, inputtag
->value
, inputtag
->valuelength
);
1100 currentcard
->tag_9F4B_len
= inputtag
->valuelength
;}
1101 if(*(inputtag
->tag
+1) == 0x4C){
1102 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F4C
)))
1104 memcpy(currentcard
->tag_9F4C
, inputtag
->value
, inputtag
->valuelength
);}
1105 if(*(inputtag
->tag
+1) == 0x60){
1106 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F60
)))
1108 memcpy(currentcard
->tag_9F60
, inputtag
->value
, inputtag
->valuelength
);}
1109 if(*(inputtag
->tag
+1) == 0x61){
1110 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F61
)))
1112 memcpy(currentcard
->tag_9F61
, inputtag
->value
, inputtag
->valuelength
);}
1113 if(*(inputtag
->tag
+1) == 0x62){
1114 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F62
)))
1116 memcpy(currentcard
->tag_9F62
, inputtag
->value
, inputtag
->valuelength
);}
1117 if(*(inputtag
->tag
+1) == 0x63){
1118 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F63
)))
1120 memcpy(currentcard
->tag_9F63
, inputtag
->value
, inputtag
->valuelength
);}
1121 if(*(inputtag
->tag
+1) == 0x64){
1122 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F64
)))
1124 memcpy(currentcard
->tag_9F64
, inputtag
->value
, inputtag
->valuelength
);}
1125 if(*(inputtag
->tag
+1) == 0x65){
1126 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F65
)))
1128 memcpy(currentcard
->tag_9F65
, inputtag
->value
, inputtag
->valuelength
);}
1129 if(*(inputtag
->tag
+1) == 0x66){
1130 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F66
)))
1132 memcpy(currentcard
->tag_9F66
, inputtag
->value
, inputtag
->valuelength
);}
1133 if(*(inputtag
->tag
+1) == 0x67){
1134 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F67
)))
1136 memcpy(currentcard
->tag_9F67
, inputtag
->value
, inputtag
->valuelength
);}
1137 if(*(inputtag
->tag
+1) == 0x68){
1138 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F68
)))
1140 memcpy(currentcard
->tag_9F68
, inputtag
->value
, inputtag
->valuelength
);
1141 currentcard
->tag_9F68_len
= inputtag
->valuelength
;}
1142 if(*(inputtag
->tag
+1) == 0x69){
1143 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F69
)))
1145 memcpy(currentcard
->tag_9F69
, inputtag
->value
, inputtag
->valuelength
);
1146 currentcard
->tag_9F69_len
= inputtag
->valuelength
;}
1147 if(*(inputtag
->tag
+1) == 0x6A){
1148 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F6A
)))
1150 memcpy(currentcard
->tag_9F6A
, inputtag
->value
, inputtag
->valuelength
);}
1151 if(*(inputtag
->tag
+1) == 0x6B){
1152 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F6B
)))
1154 memcpy(currentcard
->tag_9F6B
, inputtag
->value
, inputtag
->valuelength
);
1155 currentcard
->tag_9F6B_len
= inputtag
->valuelength
;}
1156 if(*(inputtag
->tag
+1) == 0x6C){
1157 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9F6C
)))
1159 memcpy(currentcard
->tag_9F6C
, inputtag
->value
, inputtag
->valuelength
);}
1163 if(*(inputtag
->tag
) == 0xBF){ //BF0C
1164 if(*(inputtag
->tag
+1) == 0x0C){
1165 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_BF0C
)))
1167 memcpy(currentcard
->tag_BF0C
, inputtag
->value
, inputtag
->valuelength
);
1168 currentcard
->tag_BF0C_len
= inputtag
->valuelength
;}
1170 else if(*(inputtag
->tag
) == 0x4F){ //BF0C
1171 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_4F
)))
1173 memcpy(currentcard
->tag_4F
, inputtag
->value
, inputtag
->valuelength
);
1174 currentcard
->tag_4F_len
= inputtag
->valuelength
;}
1175 else if(*(inputtag
->tag
) == 0x50){ //BF0C
1176 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_50
)))
1178 memcpy(currentcard
->tag_50
, inputtag
->value
, inputtag
->valuelength
);
1179 currentcard
->tag_50_len
= inputtag
->valuelength
;
1181 else if(*(inputtag
->tag
) == 0x56){ //BF0C
1182 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_56
)))
1184 memcpy(currentcard
->tag_56
, inputtag
->value
, inputtag
->valuelength
);
1185 currentcard
->tag_56_len
= inputtag
->valuelength
;
1187 else if(*(inputtag
->tag
) == 0x57){ //BF0C
1188 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_57
)))
1190 memcpy(currentcard
->tag_57
, inputtag
->value
, inputtag
->valuelength
);
1191 currentcard
->tag_57_len
= inputtag
->valuelength
;
1193 else if(*(inputtag
->tag
) == 0x5A){ //BF0C
1194 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_5A
)))
1196 memcpy(currentcard
->tag_5A
, inputtag
->value
, inputtag
->valuelength
);
1197 currentcard
->tag_5A_len
= inputtag
->valuelength
;}
1198 else if(*(inputtag
->tag
) == 0x61){ //BF0C
1199 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_61
)))
1201 memcpy(currentcard
->tag_61
, inputtag
->value
, inputtag
->valuelength
);
1202 currentcard
->tag_61_len
= inputtag
->valuelength
;
1204 else if(*(inputtag
->tag
) == 0x6F){ //BF0C
1205 memcpy(currentcard
->tag_6F
,inputtag
->value
,inputtag
->valuelength
);}
1207 else if(*(inputtag
->tag
) == 0x70){ //BF0C
1208 memcpy(currentcard
->tag_70
,inputtag
->value
,inputtag
->valuelength
);}
1209 else if(*(inputtag
->tag
) == 0x77){ //BF0C
1210 memcpy(currentcard
->tag_77
,inputtag
->value
,inputtag
->valuelength
);}
1211 else if(*(inputtag
->tag
) == 0x80){ //BF0C
1212 memcpy(currentcard
->tag_80
,inputtag
->value
,inputtag
->valuelength
);}
1213 else if(*(inputtag
->tag
) == 0x82){ //BF0C
1214 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_82
)))
1216 memcpy(currentcard
->tag_82
, inputtag
->value
, inputtag
->valuelength
);}
1217 else if(*(inputtag
->tag
) == 0x84){ //BF0C
1218 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_84
)))
1220 memcpy(currentcard
->tag_84
, inputtag
->value
, inputtag
->valuelength
);
1221 currentcard
->tag_84_len
= inputtag
->valuelength
;
1223 else if(*(inputtag
->tag
) == 0x86){ //BF0C
1224 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_86
)))
1226 memcpy(currentcard
->tag_86
, inputtag
->value
, inputtag
->valuelength
);
1227 currentcard
->tag_86_len
= inputtag
->valuelength
;
1229 else if(*(inputtag
->tag
) == 0x87){ //BF0C
1230 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_87
)))
1232 memcpy(currentcard
->tag_87
, inputtag
->value
, inputtag
->valuelength
);}
1233 else if(*(inputtag
->tag
) == 0x88){ //BF0C
1234 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_88
)))
1236 memcpy(currentcard
->tag_88
, inputtag
->value
, inputtag
->valuelength
);}
1237 else if(*(inputtag
->tag
) == 0x8A){ //BF0C
1238 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_8A
)))
1240 memcpy(currentcard
->tag_8A
, inputtag
->value
, inputtag
->valuelength
);}
1241 else if(*(inputtag
->tag
) == 0x8C){ //BF0C
1242 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_8C
)))
1244 memcpy(currentcard
->tag_8C
, inputtag
->value
, inputtag
->valuelength
);
1245 currentcard
->tag_8C_len
= inputtag
->valuelength
;
1247 else if(*(inputtag
->tag
) == 0x8D){ //BF0C
1248 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_8D
)))
1250 memcpy(currentcard
->tag_8D
, inputtag
->value
, inputtag
->valuelength
);
1251 currentcard
->tag_8D_len
= inputtag
->valuelength
;
1253 else if(*(inputtag
->tag
) == 0x8E){ //BF0C
1254 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_8E
)))
1256 memcpy(currentcard
->tag_8E
, inputtag
->value
, inputtag
->valuelength
);
1257 currentcard
->tag_8E_len
= inputtag
->valuelength
;
1259 else if(*(inputtag
->tag
) == 0x8F){ //BF0C
1260 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_8F
)))
1262 memcpy(currentcard
->tag_8F
,inputtag
->value
,sizeof(currentcard
->tag_8F
));}
1263 else if(*(inputtag
->tag
) == 0x90){ //BF0C
1264 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_90
)))
1266 memcpy(currentcard
->tag_90
, inputtag
->value
, inputtag
->valuelength
);
1267 currentcard
->tag_90_len
= inputtag
->valuelength
;}
1268 else if(*(inputtag
->tag
) == 0x92){ //BF0C
1269 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_92
)))
1271 memcpy(currentcard
->tag_92
, inputtag
->value
, inputtag
->valuelength
);
1272 currentcard
->tag_92_len
= inputtag
->valuelength
;}
1273 else if(*(inputtag
->tag
) == 0x93){ //BF0C
1274 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_93
)))
1276 memcpy(currentcard
->tag_93
, inputtag
->value
, inputtag
->valuelength
);
1277 currentcard
->tag_93_len
= inputtag
->valuelength
;}
1278 else if(*(inputtag
->tag
) == 0x94){ //BF0C
1279 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_94
)))
1281 memcpy(currentcard
->tag_94
, inputtag
->value
, inputtag
->valuelength
);
1282 currentcard
->tag_94_len
= inputtag
->valuelength
;}
1283 else if(*(inputtag
->tag
) == 0x95){ //BF0C
1284 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_95
)))
1286 memcpy(currentcard
->tag_95
, inputtag
->value
, inputtag
->valuelength
);}
1287 else if(*(inputtag
->tag
) == 0x97){ //BF0C
1288 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_97
)))
1290 memcpy(currentcard
->tag_97
, inputtag
->value
, inputtag
->valuelength
);
1291 currentcard
->tag_97_len
= inputtag
->valuelength
;}
1292 else if(*(inputtag
->tag
) == 0x98){ //BF0C
1293 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_98
)))
1295 memcpy(currentcard
->tag_98
, inputtag
->value
, inputtag
->valuelength
);}
1296 else if(*(inputtag
->tag
) == 0x99){ //BF0C
1297 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_99
)))
1299 memcpy(currentcard
->tag_99
, inputtag
->value
, inputtag
->valuelength
);
1300 currentcard
->tag_99_len
= inputtag
->valuelength
;}
1301 else if(*(inputtag
->tag
) == 0x9A){ //BF0C
1302 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9A
)))
1304 memcpy(currentcard
->tag_9A
, inputtag
->value
, inputtag
->valuelength
);}
1305 else if(*(inputtag
->tag
) == 0x9B){ //BF0C
1306 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9B
)))
1308 memcpy(currentcard
->tag_9B
, inputtag
->value
, inputtag
->valuelength
);}
1309 else if(*(inputtag
->tag
) == 0x9C){ //BF0C
1310 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9C
)))
1312 memcpy(currentcard
->tag_9C
, inputtag
->value
, inputtag
->valuelength
);}
1313 else if(*(inputtag
->tag
) == 0x9D){ //BF0C
1314 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_9D
)))
1316 memcpy(currentcard
->tag_9D
, inputtag
->value
, inputtag
->valuelength
);
1317 currentcard
->tag_9D_len
= inputtag
->valuelength
;}
1318 else if(*(inputtag
->tag
) == 0xA5){ //BF0C
1319 if(!(inputtag
->valuelength
<= sizeof(currentcard
->tag_A5
)))
1321 memcpy(currentcard
->tag_A5
, inputtag
->value
, inputtag
->valuelength
);
1322 currentcard
->tag_A5_len
= inputtag
->valuelength
;}
1327 int emv_decode_field(uint8_t* inputfield
,uint16_t inputlength
, emvcard
*result
)
1329 uint16_t lengthcounter
=0;
1331 //copy result to the testtag
1335 //loop through and decode template
1336 while(lengthcounter
< inputlength
)
1338 //decode the tlv tag
1339 decode_ber_tlv_item((inputfield
+lengthcounter
),&newtag
);
1340 //write the emvcard strucutre
1341 emv_emvtags_decode_tag(&newtag
,result
);
1342 //move to next value and decode
1343 lengthcounter
+= newtag
.fieldlength
-1;
1348 int emv_select(uint8_t* AID
, uint8_t AID_len
, void* data
)
1350 uint16_t selectCmd_len
= 4 + 1 + AID_len
+ 1;
1351 uint8_t selectCmd
[selectCmd_len
];
1353 selectCmd
[0] = 0x00;
1354 selectCmd
[1] = 0xA4;
1355 selectCmd
[2] = 0x04;
1356 selectCmd
[3] = 0x00;
1357 selectCmd
[4] = AID_len
;
1358 memcpy(&(selectCmd
[5]), AID
, AID_len
);
1359 selectCmd
[selectCmd_len
-1] = 0x00;
1360 return iso14_apdu(selectCmd
, selectCmd_len
, data
);
1363 //perform READ RECORD
1364 int emv_readrecord(uint8_t recordnumber
, uint8_t sfi
, void* data
)
1366 uint16_t readRecordCmd_len
= 5;
1367 uint8_t readRecordCmd
[readRecordCmd_len
];
1368 readRecordCmd
[0] = 0x00;
1369 readRecordCmd
[1] = 0xB2;
1370 readRecordCmd
[2] = recordnumber
;
1371 readRecordCmd
[3] = ((sfi
<< 3) | 0x04);
1372 readRecordCmd
[4] = 0x00;
1373 return iso14_apdu(readRecordCmd
, readRecordCmd_len
, data
);
1376 int emv_getprocessingoptions(uint8_t* pdol
, uint8_t pdol_len
, void* data
)
1378 uint16_t processingCmd_len
= 4 + 1 + 2 + pdol_len
+ 1;
1379 uint8_t processingCmd
[processingCmd_len
];
1380 processingCmd
[0] = 0x80;
1381 processingCmd
[1] = 0xA8;
1382 processingCmd
[2] = 0x00;
1383 processingCmd
[3] = 0x00;
1384 processingCmd
[4] = pdol_len
+ 2;
1385 processingCmd
[5] = 0x83; //template
1386 processingCmd
[6] = pdol_len
;
1388 memcpy(&(processingCmd
[7]), pdol
, pdol_len
);}
1389 processingCmd
[processingCmd_len
-1] = 0x00;
1390 return iso14_apdu(processingCmd
, processingCmd_len
, data
);
1393 int emv_computecryptogram(uint8_t* UDOL
, uint8_t UDOL_len
, void *data
)
1395 uint16_t cryptogramCmd_len
= 4 + 1 + UDOL_len
+ 1;
1396 uint8_t cryptogramCmd
[cryptogramCmd_len
];
1397 cryptogramCmd
[0] = 0x80;
1398 cryptogramCmd
[1] = 0x2A;
1399 cryptogramCmd
[2] = 0x8E;
1400 cryptogramCmd
[3] = 0x80;
1401 cryptogramCmd
[4] = UDOL_len
;
1402 memcpy(&(cryptogramCmd
[5]), UDOL
, UDOL_len
);
1403 cryptogramCmd
[cryptogramCmd_len
-1] = 0x00;
1404 return iso14_apdu(cryptogramCmd
, cryptogramCmd_len
, data
);
1407 int emv_getchallenge(void *data
)
1409 uint16_t challengeCmd_len
= 5;
1410 uint8_t challengeCmd
[challengeCmd_len
];
1411 challengeCmd
[0] = 0x00;
1412 challengeCmd
[1] = 0x84;
1413 challengeCmd
[2] = 0x00;
1414 challengeCmd
[3] = 0x00;
1415 challengeCmd
[4] = 0x00;
1416 return iso14_apdu(challengeCmd
, challengeCmd_len
, data
);
1419 int emv_loopback(uint8_t* transData
, uint8_t transData_len
, void *data
)
1421 uint16_t loopbackCmd_len
= 4 + 1 + transData_len
+ 1;
1422 uint8_t loopbackCmd
[loopbackCmd_len
];
1423 loopbackCmd
[0] = 0x00;
1424 loopbackCmd
[1] = 0xEE;
1425 loopbackCmd
[2] = 0x00;
1426 loopbackCmd
[3] = 0x00;
1427 loopbackCmd
[4] = loopbackCmd_len
;
1428 memcpy(&(loopbackCmd
[5]), transData
, transData_len
);
1429 return iso14_apdu(loopbackCmd
, loopbackCmd_len
, data
);
1433 int emv_generateAC(uint8_t refcontrolparam
, uint8_t* cdolinput
, uint8_t cdolinputlen
, void* data
)
1435 uint16_t acCmd_len
= 4 + 1 + cdolinputlen
+ 1;
1436 uint8_t acCmd
[acCmd_len
];
1439 acCmd
[2] = refcontrolparam
;
1441 acCmd
[4] = cdolinputlen
;
1442 memcpy(&(acCmd
[5]), cdolinput
, cdolinputlen
);
1443 acCmd
[acCmd_len
-1] = 0x00;
1444 Dbhexdump(acCmd_len
, acCmd
,false);
1445 return iso14_apdu(acCmd
, acCmd_len
, data
);
1448 int emv_decodeAFL(uint8_t* AFL
, uint8_t AFLlen
){
1452 //ICEMAN: move to client
1453 //Print out AIP Bit meanings
1454 int emv_decodeAIP(uint8_t* AIP
)
1456 if ((AIP
[0] & AIP_SDA_SUPPORTED
) == AIP_SDA_SUPPORTED
) Dbprintf("SDA supported");
1457 if ((AIP
[0] & AIP_DDA_SUPPORTED
) == AIP_DDA_SUPPORTED
) Dbprintf("DDA supported");
1458 if ((AIP
[0] & AIP_CARDHOLDER_VERIFICATION
) == AIP_CARDHOLDER_VERIFICATION
) Dbprintf("Cardholder verification is supported");
1459 if ((AIP
[0] & AIP_TERMINAL_RISK
) == AIP_TERMINAL_RISK
) Dbprintf("Terminal risk management is to be performed");
1460 if ((AIP
[0] & AIP_ISSUER_AUTH
) == AIP_ISSUER_AUTH
) Dbprintf("Issuer authentication is supported ");
1461 if ((AIP
[0] & AIP_CDA_SUPPORTED
) == AIP_CDA_SUPPORTED
) Dbprintf("CDA supported");
1462 if ((AIP
[1] & AIP_CHIP_SUPPORTED
) == AIP_CHIP_SUPPORTED
) Dbprintf("Chip supported");
1463 if ((AIP
[1] & AIP_MSR_SUPPORTED
) == AIP_MSR_SUPPORTED
) Dbprintf("MSR supported");
1467 //ICEMAN: move to client
1468 int emv_decodeCVM(uint8_t* CVM
, uint8_t CVMlen
)
1470 uint8_t counter
= 0;
1471 uint32_t amountX
= 0;
1472 uint32_t amountY
= 0;
1473 amountX
= bytes_to_num(CVM
, 4);
1474 amountY
= bytes_to_num(CVM
+4, 4);
1476 while (counter
< CVMlen
)
1478 if ((CVM
[counter
] & 0x40) == 0x40){
1479 if ((CVM
[counter
] & 0x3F)== 0x00){ Dbprintf("Fail CVM processing");}
1480 if ((CVM
[counter
] & 0x3F) == 0x01){ Dbprintf("Plaintext PIN verification performed by ICC");}
1481 if ((CVM
[counter
] & 0x3F) == 0x02){ Dbprintf("Enciphered PIN verified online");}
1482 if ((CVM
[counter
] & 0x3F) == 0x03){ Dbprintf("Plaintext PIN verification performed by ICC and signature (paper)");}
1483 if ((CVM
[counter
] & 0x3F) == 0x04){ Dbprintf("Enciphered PIN verification performed by ICC");}
1484 if ((CVM
[counter
] & 0x3F) == 0x05){ Dbprintf("Enciphered PIN verification performed by ICC and signature (paper)");}
1485 if ((CVM
[counter
] & 0x3F) == 0x30){ Dbprintf("Signature (paper)");}
1486 // iceman, wrong masked used? changed from 0x3f -> 0x7f
1487 if ((CVM
[counter
] & 0x7F) == 0x40){ Dbprintf("No CVM required");}
1490 Dbprintf("Fail cardholder verification if this CVM is unsuccessful");
1493 if (CVM
[counter
+1] == 0x00){ Dbprintf("Always");}
1494 if (CVM
[counter
+1] == 0x01){ Dbprintf("If unattended cash");}
1495 if (CVM
[counter
+1] == 0x02){ Dbprintf("If not unattended cash and not manual cash and not purchase with cashback");}
1496 if (CVM
[counter
+1] == 0x03){ Dbprintf("If terminal supports the CVM");}
1497 if (CVM
[counter
+1] == 0x04){ Dbprintf("If manual cash");}
1498 if (CVM
[counter
+1] == 0x05){ Dbprintf("If purchase with cashback");}
1499 if (CVM
[counter
+1] == 0x06){ Dbprintf("If transaction is in the application currency and is under %" PRIu32
" value", amountX
);}
1500 if (CVM
[counter
+1] == 0x07){ Dbprintf("If transaction is in the application currency and is over %" PRIu32
" value", amountX
);}
1501 if (CVM
[counter
+1] == 0x08){ Dbprintf("If transaction is in the application currency and is under %" PRIu32
" value", amountY
);}
1502 if (CVM
[counter
+1] == 0x09){ Dbprintf("If transaction is in the application currency and is over %" PRIu32
" value", amountY
);}
1506 //simulate a emvcard card
1507 //input is a structure containing values to simulate
1508 //clones an EMV card
1511 int cardSTATE
= EMVEMUL_NOFIELD
;
1515 uint8_t* receivedCmd
= BigBuf_malloc(MAX_MIFARE_FRAME_SIZE
);
1516 uint8_t par
[MAX_MIFARE_PARITY_SIZE
] = {0x00};
1517 uint8_t rATQA
[] = {0x04,0x00};
1518 uint8_t rUIDBCC
[] = {0x8F,0x2F,0x27,0xE1, 0x66};
1519 uint8_t rSAK
[] = {0x28, 0xB4, 0xFC};
1521 iso14443a_setup(FPGA_HF_ISO14443A_TAGSIM_LISTEN
);
1522 bool finished
= FALSE
;
1524 while (!BUTTON_PRESS() && !finished
){
1527 if(cardSTATE
== EMVEMUL_NOFIELD
){
1528 vHf
= (33000 * AvgAdc(ADC_CHAN_HF
)) >> 10;
1529 if(vHf
> EMV_MINFIELDV
){
1530 cardSTATE_TO_IDLE();
1534 if(cardSTATE
== EMVEMUL_NOFIELD
) continue;
1538 res
= EmGetCmd(receivedCmd
, &len
, par
);
1539 if(res
== 2) { //field is off
1540 cardSTATE
= EMVEMUL_NOFIELD
;
1545 break; // button press
1548 if(len
==1 && ((receivedCmd
[0] == 0x26 && cardSTATE
!= EMVEMUL_HALTED
) || receivedCmd
[0] == 0x52)){
1549 EmSendCmd(rATQA
, sizeof(rATQA
));
1550 cardSTATE
= EMVEMUL_SELECT1
;
1554 case EMVEMUL_NOFIELD
:
1555 case EMVEMUL_HALTED
:
1559 case EMVEMUL_SELECT1
:{
1561 if(len
==2 && (receivedCmd
[0] == 0x93 && receivedCmd
[1] == 0x20)) {
1562 EmSendCmd(rUIDBCC
, sizeof(rUIDBCC
));
1565 if(len
==2 && (receivedCmd
[0] == 0x93 && receivedCmd
[1] == 0x70 && memcmp(&receivedCmd
[2], rUIDBCC
, 4) == 0)) {
1566 EmSendCmd(rSAK
, sizeof(rSAK
));
1572 FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF
);
1576 //ICEMAN: move to client
1577 //dump the current card to the console
1578 void dumpCard(emvcard
* currentcard
){
1579 DUMP(currentcard
->ATQA
);
1580 Dbhexdump(sizeof(currentcard
->ATQA
), currentcard
->ATQA
, false);
1581 DUMP(currentcard
->UID
);
1582 Dbhexdump(currentcard
->UID_len
, currentcard
->UID
, false);
1583 DUMP(currentcard
->SAK
);
1584 Dbhexdump(1, ¤tcard
->SAK
, false);
1585 DUMP(currentcard
->ATS
);
1586 Dbhexdump(currentcard
->ATS_len
, currentcard
->ATS
, false);
1587 DUMP(currentcard
->tag_4F
);
1588 Dbhexdump(currentcard
->tag_4F_len
, currentcard
->tag_4F
, false);
1589 DUMP(currentcard
->tag_50
);
1590 Dbhexdump(currentcard
->tag_50_len
, currentcard
->tag_50
, false);
1591 DUMP(currentcard
->tag_56
);
1592 Dbhexdump(currentcard
->tag_56_len
, currentcard
->tag_56
, false);
1593 DUMP(currentcard
->tag_57
);
1594 Dbhexdump(currentcard
->tag_57_len
, currentcard
->tag_57
, false);
1595 DUMP(currentcard
->tag_5A
);
1596 Dbhexdump(currentcard
->tag_5A_len
, currentcard
->tag_5A
, false);
1597 DUMP(currentcard
->tag_82
);
1598 Dbhexdump(sizeof(currentcard
->tag_82
), currentcard
->tag_82
, false);
1599 DUMP(currentcard
->tag_84
);
1600 Dbhexdump(currentcard
->tag_84_len
, currentcard
->tag_84
, false);
1601 DUMP(currentcard
->tag_86
);
1602 Dbhexdump(currentcard
->tag_86_len
, currentcard
->tag_86
, false);
1603 DUMP(currentcard
->tag_87
);
1604 Dbhexdump(1, currentcard
->tag_87
, false);
1605 DUMP(currentcard
->tag_88
);
1606 Dbhexdump(1, currentcard
->tag_88
, false);
1607 DUMP(currentcard
->tag_8A
);
1608 Dbhexdump(2, currentcard
->tag_8A
, false);
1609 DUMP(currentcard
->tag_8C
);
1610 Dbhexdump(currentcard
->tag_8C_len
, currentcard
->tag_8C
, false);
1611 DUMP(currentcard
->tag_8D
);
1612 Dbhexdump(currentcard
->tag_8D_len
, currentcard
->tag_8D
, false);
1613 DUMP(currentcard
->tag_8E
);
1614 Dbhexdump(currentcard
->tag_8E_len
, currentcard
->tag_8E
, false);
1615 DUMP(currentcard
->tag_8F
);
1616 Dbhexdump(1, currentcard
->tag_8F
, false);
1617 DUMP(currentcard
->tag_90
);
1618 Dbhexdump(currentcard
->tag_90_len
, currentcard
->tag_90
, false);
1619 DUMP(currentcard
->tag_92
);
1620 Dbhexdump(currentcard
->tag_92_len
, currentcard
->tag_92
, false);
1621 DUMP(currentcard
->tag_93
);
1622 Dbhexdump(currentcard
->tag_93_len
, currentcard
->tag_93
, false);
1623 DUMP(currentcard
->tag_94
);
1624 Dbhexdump(currentcard
->tag_94_len
, currentcard
->tag_94
, false);
1625 DUMP(currentcard
->tag_95
);
1626 Dbhexdump(5, currentcard
->tag_95
, false);
1627 DUMP(currentcard
->tag_97
);
1628 Dbhexdump(currentcard
->tag_97_len
, currentcard
->tag_97
, false);
1629 DUMP(currentcard
->tag_98
);
1630 Dbhexdump(20, currentcard
->tag_98
, false);
1631 DUMP(currentcard
->tag_99
);
1632 Dbhexdump(currentcard
->tag_99_len
, currentcard
->tag_99
, false);
1633 DUMP(currentcard
->tag_9A
);
1634 Dbhexdump(3, currentcard
->tag_9A
, false);
1635 DUMP(currentcard
->tag_9B
);
1636 Dbhexdump(2, currentcard
->tag_9B
, false);
1637 DUMP(currentcard
->tag_9C
);
1638 Dbhexdump(1, currentcard
->tag_9C
, false);
1639 DUMP(currentcard
->tag_9D
);
1640 Dbhexdump(currentcard
->tag_9D_len
, currentcard
->tag_9D
, false);
1641 DUMP(currentcard
->tag_CD
);
1642 Dbhexdump(3, currentcard
->tag_CD
, false);
1643 DUMP(currentcard
->tag_CE
);
1644 Dbhexdump(3, currentcard
->tag_CE
, false);
1645 DUMP(currentcard
->tag_CF
);
1646 Dbhexdump(3, currentcard
->tag_CF
, false);
1647 DUMP(currentcard
->tag_D7
);
1648 Dbhexdump(3, currentcard
->tag_D7
, false);
1649 DUMP(currentcard
->tag_D8
);
1650 Dbhexdump(2, currentcard
->tag_D8
, false);
1651 DUMP(currentcard
->tag_D9
);
1652 Dbhexdump(currentcard
->tag_D9_len
, currentcard
->tag_D9
, false);
1653 DUMP(currentcard
->tag_DA
);
1654 Dbhexdump(2, currentcard
->tag_DA
, false);
1655 DUMP(currentcard
->tag_DB
);
1656 Dbhexdump(2, currentcard
->tag_DB
, false);
1657 DUMP(currentcard
->tag_DC
);
1658 Dbhexdump(2, currentcard
->tag_DC
, false);
1659 DUMP(currentcard
->tag_DD
);
1660 Dbhexdump(2, currentcard
->tag_DD
, false);
1661 DUMP(currentcard
->tag_AF
);
1662 Dbhexdump(currentcard
->tag_AF_len
, currentcard
->tag_AF
, false);
1663 DUMP(currentcard
->tag_5F20
);
1664 Dbhexdump(currentcard
->tag_5F20_len
, currentcard
->tag_5F20
, false);
1665 DUMP(currentcard
->tag_5F24
);
1666 Dbhexdump(3, currentcard
->tag_5F24
, false);
1667 DUMP(currentcard
->tag_5F25
);
1668 Dbhexdump(3, currentcard
->tag_5F25
, false);
1669 DUMP(currentcard
->tag_5F28
);
1670 Dbhexdump(2, currentcard
->tag_5F28
, false);
1671 DUMP(currentcard
->tag_5F2A
);
1672 Dbhexdump(2, currentcard
->tag_5F2A
, false);
1673 DUMP(currentcard
->tag_5F2D
);
1674 Dbhexdump(currentcard
->tag_5F2D_len
, currentcard
->tag_5F2D
, false);
1675 DUMP(currentcard
->tag_5F30
);
1676 Dbhexdump(3, currentcard
->tag_5F30
, false);
1677 DUMP(currentcard
->tag_5F34
);
1678 Dbhexdump(1, currentcard
->tag_5F34
, false);
1679 DUMP(currentcard
->tag_5F36
);
1680 Dbhexdump(2, currentcard
->tag_5F36
, false);
1681 DUMP(currentcard
->tag_5F50
);
1682 Dbhexdump(currentcard
->tag_5F50_len
, currentcard
->tag_5F50
, false);
1683 DUMP(currentcard
->tag_5F54
);
1684 Dbhexdump(currentcard
->tag_5F54_len
, currentcard
->tag_5F54
, false);
1685 DUMP(currentcard
->tag_9F01
);
1686 Dbhexdump(6, currentcard
->tag_9F01
, false);
1687 DUMP(currentcard
->tag_9F02
);
1688 Dbhexdump(6, currentcard
->tag_9F02
, false);
1689 DUMP(currentcard
->tag_9F03
);
1690 Dbhexdump(6, currentcard
->tag_9F03
, false);
1691 DUMP(currentcard
->tag_9F04
);
1692 Dbhexdump(4, currentcard
->tag_9F04
, false);
1693 DUMP(currentcard
->tag_9F05
);
1694 Dbhexdump(currentcard
->tag_9F05_len
, currentcard
->tag_9F05
, false);
1695 DUMP(currentcard
->tag_9F06
);
1696 Dbhexdump(currentcard
->tag_9F06_len
, currentcard
->tag_9F06
, false);
1697 DUMP(currentcard
->tag_9F07
);
1698 Dbhexdump(2, currentcard
->tag_9F07
, false);
1699 DUMP(currentcard
->tag_9F08
);
1700 Dbhexdump(2, currentcard
->tag_9F08
, false);
1701 DUMP(currentcard
->tag_9F09
);
1702 Dbhexdump(2, currentcard
->tag_9F09
, false);
1703 DUMP(currentcard
->tag_9F0B
);
1704 Dbhexdump(currentcard
->tag_9F0B_len
, currentcard
->tag_9F0B
, false);
1705 DUMP(currentcard
->tag_9F0D
);
1706 Dbhexdump(5, currentcard
->tag_9F0D
, false);
1707 DUMP(currentcard
->tag_9F0E
);
1708 Dbhexdump(5, currentcard
->tag_9F0E
, false);
1709 DUMP(currentcard
->tag_9F0F
);
1710 Dbhexdump(5, currentcard
->tag_9F0F
, false);
1711 DUMP(currentcard
->tag_9F10
);
1712 Dbhexdump(currentcard
->tag_9F10_len
, currentcard
->tag_9F10
, false);
1713 DUMP(currentcard
->tag_9F11
);
1714 Dbhexdump(1, currentcard
->tag_9F11
, false);
1715 DUMP(currentcard
->tag_9F12
);
1716 Dbhexdump(currentcard
->tag_9F12_len
, currentcard
->tag_9F12
, false);
1717 DUMP(currentcard
->tag_9F13
);
1718 Dbhexdump(2, currentcard
->tag_9F13
, false);
1719 DUMP(currentcard
->tag_9F14
);
1720 Dbhexdump(1, currentcard
->tag_9F14
, false);
1721 DUMP(currentcard
->tag_9F15
);
1722 Dbhexdump(2, currentcard
->tag_9F15
, false);
1723 DUMP(currentcard
->tag_9F16
);
1724 Dbhexdump(15, currentcard
->tag_9F16
, false);
1725 DUMP(currentcard
->tag_9F17
);
1726 Dbhexdump(1, currentcard
->tag_9F17
, false);
1727 DUMP(currentcard
->tag_9F18
);
1728 Dbhexdump(4, currentcard
->tag_9F18
, false);
1729 DUMP(currentcard
->tag_9F1A
);
1730 Dbhexdump(2, currentcard
->tag_9F1A
, false);
1731 DUMP(currentcard
->tag_9F1B
);
1732 Dbhexdump(4, currentcard
->tag_9F1B
, false);
1733 DUMP(currentcard
->tag_9F1C
);
1734 Dbhexdump(8, currentcard
->tag_9F1C
, false);
1735 DUMP(currentcard
->tag_9F1D
);
1736 Dbhexdump(currentcard
->tag_9F1D_len
, currentcard
->tag_9F1D
, false);
1737 DUMP(currentcard
->tag_9F1E
);
1738 Dbhexdump(8, currentcard
->tag_9F1E
, false);
1739 DUMP(currentcard
->tag_9F1F
);
1740 Dbhexdump(currentcard
->tag_9F1F_len
, currentcard
->tag_9F1F
, false);
1741 DUMP(currentcard
->tag_9F20
);
1742 Dbhexdump(currentcard
->tag_9F20_len
, currentcard
->tag_9F20
, false);
1743 DUMP(currentcard
->tag_9F21
);
1744 Dbhexdump(3, currentcard
->tag_9F1E
, false);
1745 DUMP(currentcard
->tag_9F22
);
1746 Dbhexdump(1, currentcard
->tag_9F22
, false);
1747 DUMP(currentcard
->tag_9F23
);
1748 Dbhexdump(1, currentcard
->tag_9F23
, false);
1749 DUMP(currentcard
->tag_9F26
);
1750 Dbhexdump(8, currentcard
->tag_9F26
, false);
1751 DUMP(currentcard
->tag_9F27
);
1752 Dbhexdump(1, currentcard
->tag_9F27
, false);
1753 DUMP(currentcard
->tag_9F2D
);
1754 Dbhexdump(currentcard
->tag_9F2D_len
, currentcard
->tag_9F2D
, false);
1755 DUMP(currentcard
->tag_9F2E
);
1756 Dbhexdump(3, currentcard
->tag_9F2E
, false);
1757 DUMP(currentcard
->tag_9F2F
);
1758 Dbhexdump(currentcard
->tag_9F2F_len
, currentcard
->tag_9F2F
, false);
1759 DUMP(currentcard
->tag_9F32
);
1760 Dbhexdump(currentcard
->tag_9F32_len
, currentcard
->tag_9F32
, false);
1761 DUMP(currentcard
->tag_9F33
);
1762 Dbhexdump(3, currentcard
->tag_9F33
, false);
1763 DUMP(currentcard
->tag_9F34
);
1764 Dbhexdump(3, currentcard
->tag_9F34
, false);
1765 DUMP(currentcard
->tag_9F35
);
1766 Dbhexdump(1, currentcard
->tag_9F35
, false);
1767 DUMP(currentcard
->tag_9F36
);
1768 Dbhexdump(2, currentcard
->tag_9F36
, false);
1769 DUMP(currentcard
->tag_9F37
);
1770 Dbhexdump(4, currentcard
->tag_9F37
, false);
1771 DUMP(currentcard
->tag_9F38
);
1772 Dbhexdump(currentcard
->tag_9F38_len
, currentcard
->tag_9F38
, false);
1773 DUMP(currentcard
->tag_9F39
);
1774 Dbhexdump(1, currentcard
->tag_9F39
, false);
1775 DUMP(currentcard
->tag_9F39
);
1776 Dbhexdump(1, currentcard
->tag_9F39
, false);
1777 DUMP(currentcard
->tag_9F40
);
1778 Dbhexdump(5, currentcard
->tag_9F40
, false);
1779 DUMP(currentcard
->tag_9F41
);
1780 Dbhexdump(4, currentcard
->tag_9F41
, false);
1781 DUMP(currentcard
->tag_9F42
);
1782 Dbhexdump(2, currentcard
->tag_9F42
, false);
1783 DUMP(currentcard
->tag_9F43
);
1784 Dbhexdump(4, currentcard
->tag_9F43
, false);
1785 DUMP(currentcard
->tag_9F44
);
1786 Dbhexdump(1, currentcard
->tag_9F44
, false);
1787 DUMP(currentcard
->tag_9F45
);
1788 Dbhexdump(2, currentcard
->tag_9F45
, false);
1789 DUMP(currentcard
->tag_9F46
);
1790 Dbhexdump(currentcard
->tag_9F46_len
, currentcard
->tag_9F46
, false);
1791 DUMP(currentcard
->tag_9F47
);
1792 Dbhexdump(currentcard
->tag_9F47_len
, currentcard
->tag_9F47
, false);
1793 DUMP(currentcard
->tag_9F48
);
1794 Dbhexdump(currentcard
->tag_9F48_len
, currentcard
->tag_9F48
, false);
1795 DUMP(currentcard
->tag_9F49
);
1796 Dbhexdump(currentcard
->tag_9F49_len
, currentcard
->tag_9F49
, false);
1797 DUMP(currentcard
->tag_9F4A
);
1798 Dbhexdump(1, currentcard
->tag_9F4A
, false);
1799 DUMP(currentcard
->tag_9F4B
);
1800 Dbhexdump(currentcard
->tag_9F4B_len
, currentcard
->tag_9F4B
, false);
1801 DUMP(currentcard
->tag_9F4C
);
1802 Dbhexdump(8, currentcard
->tag_9F4C
, false);
1803 DUMP(currentcard
->tag_9F4D
);
1804 Dbhexdump(2, currentcard
->tag_9F4D
, false);
1805 DUMP(currentcard
->tag_9F4E
);
1806 Dbhexdump(255, currentcard
->tag_9F4E
, false);
1807 DUMP(currentcard
->tag_9F60
);
1808 Dbhexdump(2, currentcard
->tag_9F60
, false);
1809 DUMP(currentcard
->tag_9F61
);
1810 Dbhexdump(2, currentcard
->tag_9F61
, false);
1811 DUMP(currentcard
->tag_9F62
);
1812 Dbhexdump(6, currentcard
->tag_9F62
, false);
1813 DUMP(currentcard
->tag_9F63
);
1814 Dbhexdump(6, currentcard
->tag_9F63
, false);
1815 DUMP(currentcard
->tag_9F64
);
1816 Dbhexdump(1, currentcard
->tag_9F64
, false);
1817 DUMP(currentcard
->tag_9F65
);
1818 Dbhexdump(2, currentcard
->tag_9F65
, false);
1819 DUMP(currentcard
->tag_9F66
);
1820 Dbhexdump(2, currentcard
->tag_9F66
, false);
1821 DUMP(currentcard
->tag_9F67
);
1822 Dbhexdump(1, currentcard
->tag_9F67
, false);
1823 DUMP(currentcard
->tag_9F68
);
1824 Dbhexdump(currentcard
->tag_9F68_len
, currentcard
->tag_9F68
, false);
1825 DUMP(currentcard
->tag_9F69
);
1826 Dbhexdump(currentcard
->tag_9F69_len
, currentcard
->tag_9F69
, false);
1827 DUMP(currentcard
->tag_9F6A
);
1828 Dbhexdump(8, currentcard
->tag_9F6A
, false);
1829 DUMP(currentcard
->tag_9F6B
);
1830 Dbhexdump(currentcard
->tag_9F6B_len
, currentcard
->tag_9F6B
, false);
1831 DUMP(currentcard
->tag_9F6C
);
1832 Dbhexdump(2, currentcard
->tag_9F6C
, false);
1833 DUMP(currentcard
->tag_61
);
1834 Dbhexdump(currentcard
->tag_61_len
, currentcard
->tag_61
, false);
1835 DUMP(currentcard
->tag_A5
);
1836 Dbhexdump(currentcard
->tag_A5_len
, currentcard
->tag_A5
, false);
1837 DUMP(currentcard
->tag_DFNAME
);
1838 Dbhexdump(currentcard
->tag_DFNAME_len
, currentcard
->tag_DFNAME
, false);
1839 DUMP(currentcard
->tag_70
);
1840 Dbhexdump(currentcard
->tag_70_len
, currentcard
->tag_70
, false);
1841 DUMP(currentcard
->tag_77
);
1842 Dbhexdump(currentcard
->tag_77_len
, currentcard
->tag_77
, false);
1843 DUMP(currentcard
->tag_80
);
1844 Dbhexdump(currentcard
->tag_80_len
, currentcard
->tag_80
, false);
1845 DUMP(currentcard
->tag_91
);
1846 Dbhexdump(currentcard
->tag_91_len
, currentcard
->tag_91
, false);
1847 DUMP(currentcard
->tag_BF0C
);
1848 Dbhexdump(currentcard
->tag_BF0C_len
, currentcard
->tag_BF0C
, false);
1849 DUMP(currentcard
->tag_DFName
);
1850 Dbhexdump(currentcard
->tag_DFName_len
, currentcard
->tag_DFName
, false);