Overview
Comment: | ChromeOS: Started work on supporting signing messages |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
75140d9f777b6c8ad88c164b3e99fb24 |
User & Date: | rkeene on 2016-02-12 04:06:52 |
Other Links: | manifest | tags |
Context
2016-02-12
| ||
04:10 | ChromeOS: Removed extra debugging initialization, should now be centralized check-in: 39884d86b4 user: rkeene tags: trunk | |
04:06 | ChromeOS: Started work on supporting signing messages check-in: 75140d9f77 user: rkeene tags: trunk | |
04:06 | ChromeOS: Removed debugging from PCSC bridge initialization check-in: 433d53f019 user: rkeene tags: trunk | |
Changes
Modified build/chrome/cackey-chrome-init.cc from [9641a2fef0] to [75e6704a49].
︙ | ︙ | |||
8 9 10 11 12 13 14 | #include <ppapi/cpp/module.h> #include <ppapi/cpp/core.h> #include <ppapi/cpp/var.h> #include <ppapi/cpp/var_dictionary.h> #include <ppapi/cpp/var_array.h> #include <ppapi/cpp/var_array_buffer.h> | < < < < < < | > > < < | > > > > < | | > | > | > > | > > > | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | #include <ppapi/cpp/module.h> #include <ppapi/cpp/core.h> #include <ppapi/cpp/var.h> #include <ppapi/cpp/var_dictionary.h> #include <ppapi/cpp/var_array.h> #include <ppapi/cpp/var_array_buffer.h> #include "pcsc-nacl.h" #include "cackey-chrome.h" class CACKeyInstance : public pp::Instance { private: void pcscNaClInitWrapper(pp::Core *core) { pcscNaClInit(this, core); } public: explicit CACKeyInstance(PP_Instance instance, pp::Core *core) : pp::Instance(instance) { std::thread(&CACKeyInstance::pcscNaClInitWrapper, this, core).detach(); } virtual ~CACKeyInstance() {} virtual void HandleMessageThread(pp::VarDictionary *message) { int numCertificates, i; struct cackey_certificate *certificates; pp::VarDictionary *reply; pp::VarArray certificatesPPArray; pp::VarArrayBuffer *certificateContents; pp::Var command, incomingCertificateContents; /* * Extract the command */ command = message->Get("command"); /* * Do the thing we are being asked to do */ reply = new pp::VarDictionary(); if (command.AsString() == "listcertificates") { numCertificates = cackey_chrome_listCertificates(&certificates); certificatesPPArray.SetLength(numCertificates); for (i = 0; i < numCertificates; i++) { certificateContents = new pp::VarArrayBuffer(certificates[i].certificate_len); memcpy(certificateContents->Map(), certificates[i].certificate, certificates[i].certificate_len); certificateContents->Unmap(); certificatesPPArray.Set(i, *certificateContents); 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 { incomingCertificateContents = message->Get("certificate"); reply->Set("status", "error"); reply->Set("error", "This function is not yet implemented"); } } else { reply->Set("status", "error"); reply->Set("error", "Invalid command"); } /* * If a message ID was sent in the request, include it in the reply */ if (message->HasKey("id")) { reply->Set("id", message->Get("id")); } /* * Send the reply back to the requestor, hopefully they are waiting for this message */ PostMessage(*reply); delete reply; delete message; return; } virtual void HandleMessage(const pp::Var& messagePlain) { |
︙ | ︙ |