1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
|
<style>
.clickable:hover,#expand-all:hover,#collapse-all:hover {
cursor: pointer;
}
#result-table {
margin-top: -110px;
margin-bottom: 2em;
}
#result-table th, #result-table td {
border: 1.25px solid #606c71;
}
#expand-all {
position: sticky;
top: 100px;
transform: translateX(-150px);
}
#collapse-all {
position: sticky;
top: 160px;
transform: translateX(-150px);
margin-top: 20px;
}
@media screen and (max-width: 64em) {
#expand-all, #collapse-all {
position: relative;
top: 0;
transform: none;
}
#result-table {
margin-top: 1em;
}
}
</style>
<span id="expand-all" class="btn body-btn">Expand all</span><br/>
<span id="collapse-all" class="btn body-btn">Collapse all</span>
<table id="result-table" style="width: 100%;">
<colgroup>
<col span="1" style="width: 6%">
<col span="1" style="width: 6%">
<col span="1" style="width: 78%">
<col span="1" style="width: 10%">
{% if include.testRun.device.type == "card" %}
<col span="1" style="width: 5%">
{% endif %}
</colgroup>
<tr>
<th title="Dropdown"><i class="fa fa-list"></i></th>
<th>Test result</th>
<th>Description</th>
<th>Result</th>
{% if include.testRun.device.type == "card" %}
<th>Duration</th>
{% endif %}
</tr>
{% for test in include.testRun.tests %}
{% include result_row.html test=test depth=1 %}
{% endfor %}
</table>
<script>
function expand(elem, all, timeout) {
var parent = elem.parent();
var parent_depth = parent.data("depth");
var objs = $();
parent.nextAll().each(function() {
var depth = $(this).data("depth");
if ((all && depth > parent_depth + 1) || depth == parent_depth + 1) {
objs = objs.add($(this));
var clickable = $(this).children(":first");
if (all && clickable.hasClass("clickable") && !clickable.data("toggled")) {
clickable.data("toggled", true);
clickable.children().toggleClass("fa-plus-square").toggleClass("fa-minus-square");
}
} else if (depth == parent_depth) {
return false;
}
return true;
});
elem.children(":first").removeClass("fa-plus-square").addClass("fa-minus-square");
elem.data("toggled", true);
objs.show(timeout);
}
function collapse(elem, timeout) {
var parent = elem.parent();
var parent_depth = parent.data("depth");
var objs = $();
parent.nextAll().each(function() {
var depth = $(this).data("depth");
if (depth >= parent_depth + 1) {
objs = objs.add($(this));
var clickable = $(this).children(":first");
if (clickable.data("toggled")) {
clickable.data("toggled", false);
clickable.children().toggleClass("fa-plus-square").toggleClass("fa-minus-square");
}
} else if (depth <= parent_depth) {
return false;
}
return true;
});
elem.children(":first").removeClass("fa-minus-square").addClass("fa-plus-square");
elem.data("toggled", false);
objs.hide(timeout);
}
$(".clickable").click(function(e) {
if ($(this).data("toggled")) {
collapse($(this), 200);
} else {
expand($(this), e.ctrlKey, 200);
}
});
$("#expand-all").click(function() {
$(".clickable").filter(function(i, e) {
return $(e).parent().data("depth") == 1;
}).each(function(i, e) {
expand($(e), true, 200);
});
});
$("#collapse-all").click(function() {
$(".clickable").filter(function(i, e) {
return $(e).parent().data("depth") == 1 && $(e).data("toggled") == true;
}).each(function(i, e) {
collapse($(e), 200);
});
});
var ISO7816 = {
"SW_FILE_FULL": 0x6A84,
"SW_UNKNOWN": 0x6F00,
"SW_CLA_NOT_SUPPORTED": 0x6E00,
"SW_INS_NOT_SUPPORTED": 0x6D00,
"SW_CORRECT_LENGTH_00": 0x6C00,
"SW_WRONG_P1P2": 0x6B00,
"SW_INCORRECT_P1P2": 0x6A86,
"SW_RECORD_NOT_FOUND": 0x6A83,
"SW_FILE_NOT_FOUND": 0x6A82,
"SW_FUNC_NOT_SUPPORTED": 0x6A81,
"SW_WRONG_DATA": 0x6A80,
"SW_APPLET_SELECT_FAILED": 0x6999,
"SW_COMMAND_NOT_ALLOWED": 0x6986,
"SW_CONDITIONS_NOT_SATISFIED": 0x6985,
"SW_DATA_INVALID": 0x6984,
"SW_FILE_INVALID": 0x6983,
"SW_SECURITY_STATUS_NOT_SATISFIED": 0x6982,
"SW_WRONG_LENGTH": 0x6700,
"SW_BYTES_REMAINING_00": 0x6100,
"SW_NO_ERROR": 0x9000
};
var CryptoException = {
"ILLEGAL_VALUE": 1,
"UNINITIALIZED_KEY": 2,
"NO_SUCH_ALGORITHM": 3,
"INVALID_INIT": 4,
"ILLEGAL_USE": 5
};
var ECTesterApplet = {
"SW_SIG_VERIFY_FAIL": 0x0ee1,
"SW_DH_DHC_MISMATCH": 0x0ee2,
"SW_KEYPAIR_NULL": 0x0ee3,
"SW_KA_NULL": 0x0ee4,
"SW_SIGNATURE_NULL": 0x0ee5,
"SW_OBJECT_NULL": 0x0ee6,
"SW_Exception": 0xff01,
"SW_ArrayIndexOutOfBoundsException": 0xff02,
"SW_ArithmeticException": 0xff03,
"SW_ArrayStoreException": 0xff04,
"SW_NullPointerException": 0xff05,
"SW_NegativeArraySizeException": 0xff06,
"SW_CryptoException_prefix": 0xf100,
"SW_SystemException_prefix": 0xf200,
"SW_PINException_prefix": 0xf300,
"SW_TransactionException_prefix": 0xf400,
"SW_CardRuntimeException_prefix": 0xf500
};
function format_sw(sw) {
var upper = (sw & 0xff00) >> 8;
var lower = (sw & 0xff);
switch (upper) {
case 0xf1:
return "CryptoException(" + lower + ")";
case 0xf2:
return "SystemException(" + lower + ")";
case 0xf3:
return "PINException(" + lower + ")";
case 0xf4:
return "TransactionException(" + lower + ")";
case 0xf5:
return "CardRuntimeException(" + lower + ")";
default:
switch (sw) {
case ISO7816.SW_APPLET_SELECT_FAILED:
return "APPLET_SELECT_FAILED";
case ISO7816.SW_BYTES_REMAINING_00:
return "BYTES_REMAINING";
case ISO7816.SW_CLA_NOT_SUPPORTED:
return "CLA_NOT_SUPPORTED";
case ISO7816.SW_COMMAND_NOT_ALLOWED:
return "COMMAND_NOT_ALLOWED";
case ISO7816.SW_CONDITIONS_NOT_SATISFIED:
return "CONDITIONS_NOT_SATISFIED";
case ISO7816.SW_CORRECT_LENGTH_00:
return "CORRECT_LENGTH";
case ISO7816.SW_DATA_INVALID:
return "DATA_INVALID";
case ISO7816.SW_FILE_FULL:
return "FILE_FULL";
case ISO7816.SW_FILE_INVALID:
return "FILE_INVALID";
case ISO7816.SW_FILE_NOT_FOUND:
return "FILE_NOT_FOUND";
case ISO7816.SW_FUNC_NOT_SUPPORTED:
return "FUNC_NOT_SUPPORTED";
case ISO7816.SW_INCORRECT_P1P2:
return "INCORRECT_P1P2";
case ISO7816.SW_INS_NOT_SUPPORTED:
return "INS_NOT_SUPPORTED";
case ISO7816.SW_LOGICAL_CHANNEL_NOT_SUPPORTED:
return "LOGICAL_CHANNEL_NOT_SUPPORTED";
case ISO7816.SW_RECORD_NOT_FOUND:
return "RECORD_NOT_FOUND";
case ISO7816.SW_SECURE_MESSAGING_NOT_SUPPORTED:
return "SECURE_MESSAGING_NOT_SUPPORTED";
case ISO7816.SW_SECURITY_STATUS_NOT_SATISFIED:
return "SECURITY_STATUS_NOT_SATISFIED";
case ISO7816.SW_UNKNOWN:
return "UNKNOWN";
case ISO7816.SW_WARNING_STATE_UNCHANGED:
return "WARNING_STATE_UNCHANGED";
case ISO7816.SW_WRONG_DATA:
return "WRONG_DATA";
case ISO7816.SW_WRONG_LENGTH:
return "WRONG_LENGTH";
case ISO7816.SW_WRONG_P1P2:
return "WRONG_P1P2";
case ISO7816.SW_NO_ERROR:
return "OK";
case CryptoException.ILLEGAL_VALUE:
return "ILLEGAL_VALUE";
case CryptoException.UNINITIALIZED_KEY:
return "UNINITIALIZED_KEY";
case CryptoException.NO_SUCH_ALGORITHM:
return "NO_SUCH_ALG";
case CryptoException.INVALID_INIT:
return "INVALID_INIT";
case CryptoException.ILLEGAL_USE:
return "ILLEGAL_USE";
case ECTesterApplet.SW_SIG_VERIFY_FAIL:
return "SIG_VERIFY_FAIL";
case ECTesterApplet.SW_DH_DHC_MISMATCH:
return "DH_DHC_MISMATCH";
case ECTesterApplet.SW_KEYPAIR_NULL:
return "KEYPAIR_NULL";
case ECTesterApplet.SW_KA_NULL:
return "KA_NULL";
case ECTesterApplet.SW_SIGNATURE_NULL:
return "SIGNATURE_NULL";
case ECTesterApplet.SW_OBJECT_NULL:
return "OBJECT_NULL";
case ECTesterApplet.SW_Exception:
return "Exception";
case ECTesterApplet.SW_ArrayIndexOutOfBoundsException:
return "ArrayIndexOutOfBoundsException";
case ECTesterApplet.SW_ArithmeticException:
return "ArithmeticException";
case ECTesterApplet.SW_ArrayStoreException:
return "ArrayStoreException";
case ECTesterApplet.SW_NullPointerException:
return "NullPointerException";
case ECTesterApplet.SW_NegativeArraySizeException:
return "NegativeArraySizeException";
default:
return "unknown";
}
}
}
// Common settings of all tooltips.
var common_tooltip = {
position: {
my: "left center",
at: "right center"
},
// Let the tooltip stay up if the mouse is over it.
show: null,
hide: {
effect: ""
},
close: function(event, ui) {
ui.tooltip.hover(
function() {
$(this).stop(true).fadeTo(400, 1);
},
function() {
$(this).fadeOut("400", function() {
$(this).remove();
})
}
);
}
};
$(".sw-tooltip").tooltip($.extend({}, common_tooltip, {
items: ".sw-tooltip",
content: function() {
var natural_sw = $(this).data("natural-sw").replace(/'/g, "");
var sws = $(this).data("sws").replace(/'/g, "").split(",");
sws = sws.map(function(t) {
var num = parseInt(t);
if (isNaN(num)) {
return "";
} else {
return "0x" + num.toString(16) + " (" + format_sw(num) + ")";
}
}).join(",<br/>");
var nat_sws = $("<span></span>").text("0x" + parseInt(natural_sw).toString(16));
var ectester_sws = $("<span></span>").html(sws);
var natural_label = $("<b>Natural SW:</b>");
var sws_label = $("<b>SWs:</b>");
return natural_label.add(nat_sws).add($("<br/>")).add(sws_label).add(ectester_sws);
}
}));
$(".cause-tooltip").tooltip($.extend({}, common_tooltip, {
items: ".cause-tooltip",
content: function() {
return $(this).data("cause");
}
}));
$(".kpg-tooltip").tooltip($.extend({}, common_tooltip, {
items: ".kpg-tooltip",
content: function() {
var pubkey = $(this).data("pubkey");
var privkey = $(this).data("privkey");
var pubkey_label = $("<b>Public key:</b>");
var privkey_label = $("<b>Private key:</b>");
return pubkey_label.add($("<span></span>").text(pubkey)).add($("<br/>")).add(privkey_label).add($("<span></span>").text(privkey));
}
}));
$(".ka-tooltip").tooltip($.extend({}, common_tooltip, {
items: ".ka-tooltip",
content: function() {
var pubkey = $(this).data("pubkey");
var privkey = $(this).data("privkey");
var secret = $(this).data("secret");
var pubkey_label = $("<b>Public key:</b>");
var privkey_label = $("<b>Private key:</b>");
var secret_label = $("<b>Derived secret:</b>");
return pubkey_label.add($("<span></span>").text(pubkey)).add($("<br/>")).add(privkey_label).add($("<span></span>").text(privkey)).add($("<br/>")).add(secret_label).add($("<span></span>").text(secret));
}
}));
$(".sig-tooltip").tooltip($.extend({}, common_tooltip, {
items: ".sig-tooltip",
content: function() {
var sig = $(this).data("signature");
var sig_label = $("<b>Signature:</b>");
return sig_label.add($("<span></span>").text(sig));
}
}));
</script>
|