1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
+
+
+
+
+
+
+
|
/*
* CACKey ChromeOS chrome.certificateProvider Implementation
*/
function onCertificatesRejected(rejectedCerts) {
// If certificates were rejected by the API, log an error, for example.
console.error(rejectedCerts.length + ' certificates were rejected.');
return;
}
/*
* Optional features for CACKey
*/
var cackeyFeatures = {
customPINPrompt: true
};
/*
* Handle for the CACKey NaCl Target
*/
var cackeyHandle = null;
var cackeyPCSCHandle = null;
var cackeyPCSCHandleUsable = false;
var cackeyPCSCHandleLastUsed = (new Date()).getTime();
|
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
|
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
|
-
+
|
if (!pinWindow) {
console.error("[cackey] No window was provided for PIN entry, this will not go well.");
return;
}
pinWindowPreviousHandle = pinWindow;
pinWindow.drawAttention();
pinWindow.focus();
/*
* Register a handler to handle the window being closed without
* having sent anything
*/
|
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
|
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
|
+
+
+
+
+
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
+
+
-
-
-
+
+
+
-
+
-
|
})
/*
* Pass this message off to the other window so that it may resubmit the request.
*/
pinWindow.contentWindow.parentWindow = window;
pinWindow.contentWindow.messageEvent = messageEvent;
if (cackeyFeatures.customPINPrompt) {
pinWindow.contentWindow.pinprompt = messageEvent.data.pinprompt;
}
return;
});
} else {
chrome.certificateProvider.requestPin({
signRequestId: messageEvent.data.originalrequest.signRequestId,
requestType: "PIN"
}, function(userInfo) {
var destroyError;
var pinValue = "";
try {
chrome.certificateProvider.stopPinRequest({
signRequestId: messageEvent.data.originalrequest.signRequestId
}, function() {
chrome.certificateProvider.stopPinRequest({
signRequestId: messageEvent.data.originalrequest.signRequestId
}, function() {});
var pinValue = "";
pinWindowPreviousHandle = null;
} catch (destroyError) {
/* Do nothing, we don't care if it fails really */
}
pinWindowPreviousHandle = null;
if (userInfo && userInfo.userInput) {
pinValue = userInfo.userInput;
}
if (userInfo && userInfo.userInput) {
pinValue = userInfo.userInput;
}
return(cackeyPINPromptCompleted(pinValue));
return(cackeyPINPromptCompleted(pinValue));
});
});
}
/*
* We return here instead of break to avoid deleting the callback
* entry.
*/
|