Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: pkcs11.h

Issue 2833006: Eliminate stale pkcs11 certificate handler implementations. (Closed) Base URL: ssh://git@chromiumos-git/entd.git
Patch Set: Changed default pkcs11 mode and updated tests. Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « main.cc ('k') | pkcs11.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ENTD_PKCS11_H_ 5 #ifndef ENTD_PKCS11_H_
6 #define ENTD_PKCS11_H_ 6 #define ENTD_PKCS11_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 Pkcs11SlotHandler* slot_handler_; 77 Pkcs11SlotHandler* slot_handler_;
78 }; 78 };
79 79
80 // Pkcs11 JavaScript Interface class. 80 // Pkcs11 JavaScript Interface class.
81 // 81 //
82 // This class wraps a V8 singleton object to handle the PKCS11 interface. 82 // This class wraps a V8 singleton object to handle the PKCS11 interface.
83 class Pkcs11 : public JSObjectWrapper<Pkcs11> { 83 class Pkcs11 : public JSObjectWrapper<Pkcs11> {
84 public: 84 public:
85 // The constructor takes two handlers: 85 // The constructor takes two handlers:
86 // * cert_handler builds CSRs and certificates. 86 // * cert_handler builds CSRs and certificates.
87 // - builds CSRs
88 // - may generate a public/private key pair
89 // - parses Certificates and extracts the subject
87 // * slot_handler handles the interface with a pkcs11 device: 90 // * slot_handler handles the interface with a pkcs11 device:
88 // - generates public/private key pairs 91 // - may generate public/private key pairs
89 // - adds certificates 92 // - stores key pairs and certificates
90 // - retrieves a list of slot labels and the contents of a named slot. 93 // - retrieves a list of existing token objects in a slot
91 // 94 //
92 // If cert_handler is NULL, a Pkcs11CertificateHandlerLocalFile is built, 95 // If cert_handler or slot_handler NULL,
93 // with empty filenames (see below). 96 // the class is initialized with the default handler (see code).
94 // If slot_handler is NULL, a Pkcs11SlotHandlerInMemory is built
95 // (see code).
96 Pkcs11(Pkcs11CertificateHandler* cert_handler, 97 Pkcs11(Pkcs11CertificateHandler* cert_handler,
97 Pkcs11SlotHandler* slot_handler); 98 Pkcs11SlotHandler* slot_handler);
98 virtual ~Pkcs11(); 99 virtual ~Pkcs11();
99 virtual bool Initialize(); 100 virtual bool Initialize();
100 // Call this *instead of* Initialize() to use opencryptoki with openssl 101 // Set the Certificate handler to use openssl to generate CSRs
101 bool InitializeOpenCryptoki(const std::string& engine); 102 bool SetOpenSSLHandlers();
102 // Call this *instead of* Initialize() to use openssl to generate keys 103 // Set the Slot handler to use opencryptoki,
103 // and to store the private key in the tpm (like glaptop does) 104 // and the Certificate handler to use openssl
104 bool InitializeGLaptop(); 105 bool SetOpenCryptokiHandlers();
105 // Call this *instead of* Initialize() to use openssl without opencryptoki
106 bool InitializeOpenSSL();
107 // Call this *instead of* Initialize() to use local files
108 bool InitializeLocalFiles(const std::string& csr, const std::string& cert);
109 106
110 // Adds slot_object to "pkcs11.slots" 107 // Adds slot_object to "pkcs11.slots"
111 bool AddJSSlotObject(const SlotObject* slot_object); 108 bool AddJSSlotObject(const SlotObject* slot_object);
112 bool RemoveJSSlotObject(const std::string& label); 109 bool RemoveJSSlotObject(const std::string& label);
113 110
114 // JSObjectWrapper functions 111 // JSObjectWrapper functions
115 static const char* GetClassName() { return "pkcs11"; } 112 static const char* GetClassName() { return "pkcs11"; }
116 static void SetTemplateBindings( 113 static void SetTemplateBindings(
117 v8::Handle<v8::ObjectTemplate> template_object); 114 v8::Handle<v8::ObjectTemplate> template_object);
118 115
(...skipping 10 matching lines...) Expand all
129 scoped_ptr<Pkcs11SlotHandler> slot_handler_; 126 scoped_ptr<Pkcs11SlotHandler> slot_handler_;
130 127
131 void SetupHandlers(); 128 void SetupHandlers();
132 129
133 DISALLOW_COPY_AND_ASSIGN(Pkcs11); 130 DISALLOW_COPY_AND_ASSIGN(Pkcs11);
134 }; 131 };
135 132
136 } // namespace entd 133 } // namespace entd
137 134
138 #endif // ENTD_PKCS11_H_ 135 #endif // ENTD_PKCS11_H_
OLDNEW
« no previous file with comments | « main.cc ('k') | pkcs11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698