Index: net/base/keygen_handler_nss.cc |
=================================================================== |
--- net/base/keygen_handler_nss.cc (revision 43235) |
+++ net/base/keygen_handler_nss.cc (working copy) |
@@ -51,6 +51,11 @@ |
{ 0, } |
}; |
+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? |
@@ -198,17 +203,25 @@ |
if (!isSuccess) { |
LOG(ERROR) << "SSL Keygen failed!"; |
} else { |
- LOG(INFO) << "SSl Keygen succeeded!"; |
+ LOG(INFO) << "SSL Keygen succeeded!"; |
+ |
+ Cache* cache = KeyCache::GetInstance(); |
+ Location location; |
+ const char* slot_name = PK11_GetSlotName(slot); |
+ location.slot_name.assign(slot_name); |
+ |
+ cache->Insert(std::string(reinterpret_cast<char*>(spkiItem.data), |
+ spkiItem.len), location); |
+ |
} |
// Do cleanups |
if (privateKey) { |
- if (!isSuccess || !stores_key_) { |
- PK11_DestroyTokenObject(privateKey->pkcs11Slot,privateKey->pkcs11ID); |
- SECKEY_DestroyPrivateKey(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); |
} |
if (publicKey) { |