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

Unified Diff: net/base/keygen_handler_nss.cc

Issue 3186021: DONOTLAND: Start of PK11 password dialog for Linux/NSS (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Start of hooking up the hang monitor, probably requires WebKit changes Created 10 years, 3 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.cc ('k') | net/net.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/keygen_handler_nss.cc
diff --git a/net/base/keygen_handler_nss.cc b/net/base/keygen_handler_nss.cc
index 215244c7e56af2d2bbe3ca4a1ea5923e1e74cb49..c92218a6056d8593f4adc925cf549b43abcf7da8 100644
--- a/net/base/keygen_handler_nss.cc
+++ b/net/base/keygen_handler_nss.cc
@@ -4,6 +4,10 @@
#include "net/base/keygen_handler.h"
+#include "base/crypto/scoped_nss_types.h"
+#include "base/logging.h"
+#include "base/nss_util.h"
+#include "base/nss_util_internal.h"
#include "net/third_party/mozilla_security_manager/nsKeygenHandler.h"
// PSM = Mozilla's Personal Security Manager.
@@ -12,8 +16,29 @@ namespace psm = mozilla_security_manager;
namespace net {
std::string KeygenHandler::GenKeyAndSignChallenge() {
+ // Ensure NSS is initialized.
+ base::EnsureNSSInit();
+
+ base::ScopedPK11Slot slot(base::GetDefaultNSSKeySlot());
+ if (!slot.get()) {
+ LOG(ERROR) << "Couldn't get Internal key slot!";
+ return std::string();
+ }
+
+ // Authenticate to the token.
+ if (SECSuccess != PK11_Authenticate(slot.get(), PR_TRUE,
+ pk11_password_delegate_.get())) {
+ LOG(ERROR) << "Couldn't authenticate to PK11 token!";
+ return std::string();
+ }
+
return psm::GenKeyAndSignChallenge(key_size_in_bits_, challenge_, url_,
- stores_key_);
+ slot.get(), stores_key_);
+}
+
+void KeygenHandler::set_pk11_password_delegate(
+ base::PK11BlockingPasswordDelegate* delegate) {
+ pk11_password_delegate_.reset(delegate);
}
} // namespace net
« no previous file with comments | « net/base/keygen_handler.cc ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698