30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
-
|
virtual ~CACKeyInstance() {}
virtual void HandleMessageThread(pp::VarDictionary *message, pp::Var *messagePlain) {
cackey_chrome_returnType signRet;
char *pinPrompt = NULL;
const char *pin;
const char *smartcardManagerAppId = NULL;
unsigned char buffer[8192];
struct cackey_certificate *certificates, incomingCertificateCACKey;
struct cackey_reader *readers;
pp::VarDictionary *reply, *readerInfo;
pp::VarArray certificatesPPArray, readersPPArray;
pp::VarArrayBuffer *certificateContents, *incomingCertificateContents, *incomingData, *outgoingData;
pp::Var command;
|
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
-
-
-
-
-
+
-
-
-
-
|
/*
* Do the thing we are being asked to do
*/
reply = new pp::VarDictionary();
if (command.AsString() == "init") {
if (message->HasKey("smartcardManagerAppId")) {
smartcardManagerAppId = strdup(message->Get("smartcardManagerAppId").AsString().c_str());
}
pcscNaClInit(this, corePointer, smartcardManagerAppId, "CACKey");
pcscNaClInit(this, corePointer);
if (smartcardManagerAppId) {
free((void *) smartcardManagerAppId);
}
reply->Set("status", "success");
} else if (command.AsString() == "listcertificates") {
numCertificates = cackey_chrome_listCertificates(&certificates);
certificatesPPArray.SetLength(numCertificates);
|