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

Unified Diff: net/base/keygen_handler_nss.cc

Issue 1591006: Adds support for the <keygen> element to Windows, matching... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fix keygen_handler_nss.cc compilation errors. Fix more nits. 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/keygen_handler_mac.cc ('k') | net/base/keygen_handler_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/keygen_handler_nss.cc
===================================================================
--- net/base/keygen_handler_nss.cc (revision 43288)
+++ net/base/keygen_handler_nss.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -51,6 +51,21 @@
{ 0, }
};
+void StoreKeyLocationInCache(const SECItem& public_key_info,
+ PK11SlotInfo *slot) {
+ KeygenHandler::Cache* cache = KeygenHandler::Cache::GetInstance();
+ KeygenHandler::KeyLocation key_location;
+ const char* slot_name = PK11_GetSlotName(slot);
+ key_location.slot_name.assign(slot_name);
+ cache->Insert(std::string(reinterpret_cast<char*>(public_key_info.data),
+ public_key_info.len), key_location);
+}
+
+bool KeygenHandler::KeyLocation::Equals(
+ const net::KeygenHandler::KeyLocation& location) const {
+ return slot_name == location.slot_name;
+}
+
// This function is largely copied from the Firefox's
// <keygen> implementation in security/manager/ssl/src/nsKeygenHandler.cpp
// FIXME(gauravsh): Do we need a copy of the Mozilla license here?
@@ -194,21 +209,23 @@
goto failure;
}
+ StoreKeyLocationInCache(spkiItem, slot);
+
failure:
if (!isSuccess) {
LOG(ERROR) << "SSL Keygen failed!";
} else {
- LOG(INFO) << "SSl Keygen succeeded!";
+ LOG(INFO) << "SSL Keygen succeeded!";
}
// Do cleanups
if (privateKey) {
+ // On successful keygen we need to keep the private key, of course,
+ // or we won't be able to use the client certificate.
if (!isSuccess || !stores_key_) {
- PK11_DestroyTokenObject(privateKey->pkcs11Slot,privateKey->pkcs11ID);
- SECKEY_DestroyPrivateKey(privateKey);
+ PK11_DestroyTokenObject(privateKey->pkcs11Slot, privateKey->pkcs11ID);
}
- // On successful keygen we need to keep the private key, of course,
- // or we won't be able to use the client certificate.
+ SECKEY_DestroyPrivateKey(privateKey);
}
if (publicKey) {
« no previous file with comments | « net/base/keygen_handler_mac.cc ('k') | net/base/keygen_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698