Diff

Differences From Artifact [02273309f5]:

To Artifact [cf6e270a5f]:


33
34
35
36
37
38
39

40
41
42
43
44
45
46
47
48
49
50
51
		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;

			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");








>
|
|


|







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
		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;
			int numCertificates, numReaders, i;
			unsigned long outgoingDataLength;

			/*
			 * Extract the command
			 */
			command = message->Get("command");

83
84
85
86
87
88
89




















90
91
92
93
94
95
96
					delete certificateContents;
				}

				cackey_chrome_freeCertificates(certificates, numCertificates);

				reply->Set("status", "success");
				reply->Set("certificates", certificatesPPArray);




















			} else if (command.AsString() == "sign") {
				if (!message->HasKey("certificate")) {
					reply->Set("status", "error");
					reply->Set("error", "Certificate not supplied");
				} else if (!message->HasKey("data")) {
					reply->Set("status", "error");
					reply->Set("error", "Data not supplied");







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
					delete certificateContents;
				}

				cackey_chrome_freeCertificates(certificates, numCertificates);

				reply->Set("status", "success");
				reply->Set("certificates", certificatesPPArray);
			} else if (command.AsString() == "listreaders") {
				numReaders = cackey_chrome_listReaders(&readers);

				readersPPArray.SetLength(numReaders);

				for (i = 0; i < numReaders; i++) {
					readerInfo = new pp::VarDictionary;

					readerInfo->Set("readerName", readers[i].reader);
					readerInfo->Set("cardInserted", readers[i].cardInserted);

					readersPPArray.Set(i, *readerInfo);

					delete readerInfo;
				}

				cackey_chrome_freeReaders(readers, numReaders);

				reply->Set("status", "success");
				reply->Set("readers", readersPPArray);
			} else if (command.AsString() == "sign") {
				if (!message->HasKey("certificate")) {
					reply->Set("status", "error");
					reply->Set("error", "Certificate not supplied");
				} else if (!message->HasKey("data")) {
					reply->Set("status", "error");
					reply->Set("error", "Data not supplied");