︙ | | |
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
|
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
|
-
+
+
-
-
+
+
+
|
var nextFunction = null;
var chromeCallback = null;
if (messageEvent.data.target != "cackey") {
return;
}
if (!GoogleSmartCard.IS_DEBUG_BUILD) {
if (GoogleSmartCard.IS_DEBUG_BUILD) {
console.log("START MESSAGE");
console.log(messageEvent.data);
console.log("END MESSAGE");
}
/*
* If we failed for some reason and we have a certificate in the original
* request then forget any PIN associated with that certificate
*/
if (messageEvent.data.status != "success") {
if (messageEvent.data.originalrequest) {
if (messageEvent.data.originalrequest.certificate) {
delete cackeyCertificateToPINMap[cackeyCertificateToPINID(messageEvent.data.originalrequest.certificate)];
if (messageEvent.data.originalrequest.certificate) {
delete cackeyCertificateToPINMap[cackeyCertificateToPINID(messageEvent.data.originalrequest.certificate)];
}
}
}
if (messageEvent.data.id == null) {
return;
}
|
︙ | | |
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
|
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
|
-
+
|
for (messageIdx = 0; messageIdx < cackeyMessagesToRetry.length; messageIdx++) {
var tmpMessageEvent;
tmpMessageEvent = cackeyMessagesToRetry[messageIdx];
if (pinWindowPINValue == "") {
if (!GoogleSmartCard.IS_DEBUG_BUILD) {
if (GoogleSmartCard.IS_DEBUG_BUILD) {
console.log("[cackey] The PIN dialog was closed without gathering a PIN, treating it as a failure.");
}
tmpMessageEvent.data.status = "error";
tmpMessageEvent.data.error = "PIN window closed without a PIN being provided";
cackeyMessageIncoming(tmpMessageEvent);
|
︙ | | |
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
|
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
|
-
+
-
+
|
/*
* Handler for messages from Chrome related to listing certificates
*/
function cackeyListCertificates(chromeCallback) {
var callbackId;
if (!GoogleSmartCard.IS_DEBUG_BUILD) {
if (GoogleSmartCard.IS_DEBUG_BUILD) {
console.log("[cackey] Asked to provide a list of certificates -- throwing that request over to the NaCl side... ");
}
callbackId = cackeyOutstandingCallbackCounter + 1;
cackeyHandle.postMessage(
{
'target': "cackey",
'command': "listcertificates",
'id': callbackId
}
);
cackeyOutstandingCallbackCounter = callbackId;
cackeyOutstandingCallbacks[callbackId] = chromeCallback;
if (!GoogleSmartCard.IS_DEBUG_BUILD) {
if (GoogleSmartCard.IS_DEBUG_BUILD) {
console.log("[cackey] Thrown.");
}
return;
}
/*
|
︙ | | |
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
|
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
|
-
+
|
digest = new Uint8Array(digestHeader.length + signRequest.digest.byteLength);
digest.set(digestHeader, 0);
digest.set(new Uint8Array(signRequest.digest), digestHeader.length);
delete digestHeader;
if (!GoogleSmartCard.IS_DEBUG_BUILD) {
if (GoogleSmartCard.IS_DEBUG_BUILD) {
console.log("[cackey] Asked to sign a message -- throwing that request over to the NaCl side... ");
}
callbackId = cackeyOutstandingCallbackCounter + 1;
command = {
'target': "cackey",
|
︙ | | |
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
|
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
|
-
+
|
}
cackeyHandle.postMessage(command);
cackeyOutstandingCallbackCounter = callbackId;
cackeyOutstandingCallbacks[callbackId] = chromeCallback;
if (!GoogleSmartCard.IS_DEBUG_BUILD) {
if (GoogleSmartCard.IS_DEBUG_BUILD) {
console.log("[cackey] Thrown.");
}
return;
}
/*
|
︙ | | |