37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
const char *smartcardManagerAppId = NULL;
unsigned char buffer[8192];
struct cackey_certificate *certificates, incomingCertificateCACKey;
pp::VarDictionary *reply;
pp::VarArray certificatesPPArray;
pp::VarArrayBuffer *certificateContents, *incomingCertificateContents, *incomingData, *outgoingData;
pp::Var command;
const pp::Var *outgoingDataAsVar = NULL;
int numCertificates, i;
unsigned long outgoingDataLength;
/*
* Extract the command
*/
command = message->Get("command");
|
<
|
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
const char *smartcardManagerAppId = NULL;
unsigned char buffer[8192];
struct cackey_certificate *certificates, incomingCertificateCACKey;
pp::VarDictionary *reply;
pp::VarArray certificatesPPArray;
pp::VarArrayBuffer *certificateContents, *incomingCertificateContents, *incomingData, *outgoingData;
pp::Var command;
int numCertificates, i;
unsigned long outgoingDataLength;
/*
* Extract the command
*/
command = message->Get("command");
|
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
case CACKEY_CHROME_OK:
outgoingData = new pp::VarArrayBuffer(outgoingDataLength);
memcpy(outgoingData->Map(), buffer, outgoingDataLength);
outgoingData->Unmap();
outgoingDataAsVar = new pp::Var(outgoingData->pp_var());
delete outgoingData;
reply->Set("status", "success");
reply->Set("signedData", outgoingDataAsVar);
break;
case CACKEY_CHROME_ERROR:
reply->Set("status", "error");
reply->Set("error", "Unable to sign data");
break;
case CACKEY_CHROME_NEEDLOGIN:
|
>
|
<
<
<
|
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
case CACKEY_CHROME_OK:
outgoingData = new pp::VarArrayBuffer(outgoingDataLength);
memcpy(outgoingData->Map(), buffer, outgoingDataLength);
outgoingData->Unmap();
reply->Set("status", "success");
reply->Set("signedData", *outgoingData);
delete outgoingData;
break;
case CACKEY_CHROME_ERROR:
reply->Set("status", "error");
reply->Set("error", "Unable to sign data");
break;
case CACKEY_CHROME_NEEDLOGIN:
|
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
|
delete reply;
delete message;
delete messagePlain;
if (outgoingDataAsVar) {
delete outgoingDataAsVar;
}
return;
}
virtual void HandleMessage(const pp::Var& messagePlain) {
pp::VarDictionary *message;
pp::Var *messagePlainCopy;
pp::Var target;
|
<
<
<
<
|
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
delete reply;
delete message;
delete messagePlain;
return;
}
virtual void HandleMessage(const pp::Var& messagePlain) {
pp::VarDictionary *message;
pp::Var *messagePlainCopy;
pp::Var target;
|