Index: net/base/keygen_handler_nss.cc |
diff --git a/net/base/keygen_handler_nss.cc b/net/base/keygen_handler_nss.cc |
index 5e97807866ab3bbfd70e2d32779ad0eb91c8a227..854d62de694ff5b34c4aeecf99572730ede32d48 100644 |
--- a/net/base/keygen_handler_nss.cc |
+++ b/net/base/keygen_handler_nss.cc |
@@ -17,29 +17,26 @@ namespace psm = mozilla_security_manager; |
namespace net { |
std::string KeygenHandler::GenKeyAndSignChallenge() { |
- // Ensure NSS is initialized. |
- crypto::EnsureNSSInit(); |
- |
- // TODO(mattm): allow choosing which slot to generate and store the key. |
- crypto::ScopedPK11Slot slot(crypto::GetPrivateNSSKeySlot()); |
- if (!slot.get()) { |
+ if (!slot_.get()) { |
LOG(ERROR) << "Couldn't get private key slot from NSS!"; |
return std::string(); |
} |
// Authenticate to the token. |
- if (SECSuccess != PK11_Authenticate(slot.get(), PR_TRUE, |
+ if (SECSuccess != PK11_Authenticate(slot_.get(), PR_TRUE, |
crypto_module_password_delegate_.get())) { |
LOG(ERROR) << "Couldn't authenticate to private key slot!"; |
return std::string(); |
} |
return psm::GenKeyAndSignChallenge(key_size_in_bits_, challenge_, url_, |
- slot.get(), stores_key_); |
+ slot_.get(), stores_key_); |
} |
-void KeygenHandler::set_crypto_module_password_delegate( |
+void KeygenHandler::set_key_slot( |
+ crypto::ScopedPK11Slot slot, |
crypto::CryptoModuleBlockingPasswordDelegate* delegate) { |
+ slot_ = slot.Pass(); |
crypto_module_password_delegate_.reset(delegate); |
} |