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

Unified Diff: net/base/keygen_handler.h

Issue 843005: Adds support for the <keygen> element to Windows, matching support present on... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Fixing remaining issues Created 10 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/cert_database_win.cc ('k') | net/base/keygen_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/keygen_handler.h
===================================================================
--- net/base/keygen_handler.h (revision 43235)
+++ net/base/keygen_handler.h (working copy)
@@ -5,8 +5,12 @@
#ifndef NET_BASE_KEYGEN_HANDLER_H_
#define NET_BASE_KEYGEN_HANDLER_H_
+#include <map>
#include <string>
+#include "base/lock.h"
+#include "base/singleton.h"
+
namespace net {
// This class handles keypair generation for generating client
@@ -16,6 +20,53 @@
class KeygenHandler {
public:
+ // This class stores the relative location for a given private key. It does
+ // not store the private key, or a handle to the private key, on the basis
+ // that the key may be located on a smart card or device which may not be
+ // present at the time of retrieval.
+ class KeyLocation {
+ public:
+#if defined(OS_WIN)
+ std::wstring container_name;
+ std::wstring provider_name;
+#elif defined(OS_MACOSX)
+ std::string keychain_path;
+#elif defined(USE_NSS)
+ std::string slot_name;
+#endif
+
+ // Only used by unit tests
+ bool Equals(const KeyLocation& location) const;
+ };
+
+ // This class stores information about the keys the KeygenHandler has
+ // generated, so that the private keys can be properly associated with any
+ // certificates that might be sent to the client based on those keys.
+ class Cache {
+ public:
+ static Cache* GetInstance();
+ void Insert(const std::string& public_key_info,
+ const KeyLocation& location);
+
+ // True if the |public_key_info| was located and the location stored into
+ // |*location|
+ bool Find(const std::string& public_key_info, KeyLocation* location);
+
+ private:
+ typedef std::map<std::string, KeyLocation> KeyLocationMap;
+
+ // Obtain an instance of the KeyCache by using GetInstance()
+ Cache() { }
+ friend struct DefaultSingletonTraits<Cache>;
+
+ Lock lock_;
+
+ // The key cache. You must obtain |lock_| before using |cache_|
+ KeyLocationMap cache_;
+
+ DISALLOW_COPY_AND_ASSIGN(Cache);
+ };
+
// Creates a handler that will generate a key with the given key size
// and incorporate the |challenge| into the Netscape SPKAC structure.
inline KeygenHandler(int key_size_in_bits, const std::string& challenge);
« no previous file with comments | « net/base/cert_database_win.cc ('k') | net/base/keygen_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698