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

Unified Diff: net/third_party/mozilla_security_manager/nsKeygenHandler.cpp

Issue 5686002: NSS: PKCS 11 password prompt. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressing review comments Created 9 years, 11 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
Index: net/third_party/mozilla_security_manager/nsKeygenHandler.cpp
diff --git a/net/third_party/mozilla_security_manager/nsKeygenHandler.cpp b/net/third_party/mozilla_security_manager/nsKeygenHandler.cpp
index e1aa2e6c34e7e3d662efe12016c39c85173bf9f4..c00e58a9fc31db84b8a8dccae698553d5ae4287e 100644
--- a/net/third_party/mozilla_security_manager/nsKeygenHandler.cpp
+++ b/net/third_party/mozilla_security_manager/nsKeygenHandler.cpp
@@ -49,9 +49,7 @@
#include "base/base64.h"
#include "base/logging.h"
-#include "base/nss_util_internal.h"
#include "base/nss_util.h"
-#include "base/string_util.h"
#include "googleurl/src/gurl.h"
namespace {
@@ -97,13 +95,13 @@ namespace mozilla_security_manager {
std::string GenKeyAndSignChallenge(int key_size_in_bits,
const std::string& challenge,
const GURL& url,
+ PK11SlotInfo* slot,
bool stores_key) {
// Key pair generation mechanism - only RSA is supported at present.
PRUint32 keyGenMechanism = CKM_RSA_PKCS_KEY_PAIR_GEN; // from nss/pkcs11t.h
// Temporary structures used for generating the result
// in the right format.
- PK11SlotInfo *slot = NULL;
PK11RSAGenParams rsaKeyGenParams; // Keygen parameters.
SECOidTag algTag; // used by SEC_DerSignData().
SECKEYPrivateKey *privateKey = NULL;
@@ -120,16 +118,6 @@ std::string GenKeyAndSignChallenge(int key_size_in_bits,
std::string result_blob; // the result.
- // Ensure NSS is initialized.
- base::EnsureNSSInit();
-
- slot = base::GetDefaultNSSKeySlot();
- if (!slot) {
- LOG(ERROR) << "Couldn't get Internal key slot!";
- isSuccess = false;
- goto failure;
- }
-
switch (keyGenMechanism) {
case CKM_RSA_PKCS_KEY_PAIR_GEN:
rsaKeyGenParams.keySizeInBits = key_size_in_bits;
@@ -146,15 +134,6 @@ std::string GenKeyAndSignChallenge(int key_size_in_bits,
goto failure;
}
- // Need to make sure that the token was initialized.
- // Assume a null password.
- sec_rv = PK11_Authenticate(slot, PR_TRUE, NULL);
- if (SECSuccess != sec_rv) {
- LOG(ERROR) << "Couldn't initialze PK11 token!";
- isSuccess = false;
- goto failure;
- }
-
VLOG(1) << "Creating key pair...";
{
base::AutoNSSWriteLock lock;
@@ -275,9 +254,6 @@ std::string GenKeyAndSignChallenge(int key_size_in_bits,
if (arena) {
PORT_FreeArena(arena, PR_TRUE);
}
- if (slot != NULL) {
- PK11_FreeSlot(slot);
- }
return (isSuccess ? result_blob : std::string());
}
« no previous file with comments | « net/third_party/mozilla_security_manager/nsKeygenHandler.h ('k') | net/third_party/mozilla_security_manager/nsPKCS12Blob.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698