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

Unified Diff: nss_util.cc

Issue 6820024: [login_manager] Fix race condition that caused ownership to never work (Closed) Base URL: http://git.chromium.org/git/login_manager.git@master
Patch Set: comment update Created 9 years, 8 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 | « nss_util.h ('k') | session_manager_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: nss_util.cc
diff --git a/nss_util.cc b/nss_util.cc
index d87e9b2b21b1da30579718bd45a178271c8fe239..a55e6d2581f1e3f4ebb88c80fbfc0214d12677e9 100644
--- a/nss_util.cc
+++ b/nss_util.cc
@@ -9,6 +9,7 @@
#include <base/crypto/signature_creator.h>
#include <base/crypto/signature_verifier.h>
#include <base/file_path.h>
+#include <base/file_util.h>
#include <base/logging.h>
#include <base/nss_util.h>
#include <base/scoped_ptr.h>
@@ -33,6 +34,8 @@ class NssUtilImpl : public NssUtil {
NssUtilImpl();
virtual ~NssUtilImpl();
+ bool MightHaveKeys();
+
bool OpenUserDB();
base::RSAPrivateKey* GetPrivateKey(const std::vector<uint8>& public_key_der);
@@ -51,6 +54,10 @@ class NssUtilImpl : public NssUtil {
base::RSAPrivateKey* key);
private:
static const uint16 kKeySizeInBits;
+ // Hardcoded path of the user's NSS key database.
+ // TODO(cmasone): get rid of this once http://crosbug.com/14007 is fixed.
+ static const char kUserDbPath[];
+
DISALLOW_COPY_AND_ASSIGN(NssUtilImpl);
};
@@ -76,11 +83,17 @@ void NssUtil::BlobFromBuffer(const std::string& buf, std::vector<uint8>* out) {
// We're generating and using 2048-bit RSA keys.
// static
const uint16 NssUtilImpl::kKeySizeInBits = 2048;
+// static
+const char NssUtilImpl::kUserDbPath[] = "/home/chronos/user/.pki/nssdb/key4.db";
NssUtilImpl::NssUtilImpl() {}
NssUtilImpl::~NssUtilImpl() {}
+bool NssUtilImpl::MightHaveKeys() {
+ return file_util::PathExists(FilePath(NssUtilImpl::kUserDbPath));
+}
+
bool NssUtilImpl::OpenUserDB() {
// TODO(cmasone): If we ever try to keep the session_manager alive across
// user sessions, we'll need to deal with the fact that we have no way to
« no previous file with comments | « nss_util.h ('k') | session_manager_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698