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

Unified Diff: chromeos/cert_loader.cc

Issue 421113002: Use correct slot id for client certs in network config. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments. Created 6 years, 5 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 | « chromeos/cert_loader.h ('k') | chromeos/cert_loader_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/cert_loader.cc
diff --git a/chromeos/cert_loader.cc b/chromeos/cert_loader.cc
index 8c22279523ab382dc673fb7d73c0db9175d3416f..337c70e16b063b1da8777f7e8903624d986fcb72 100644
--- a/chromeos/cert_loader.cc
+++ b/chromeos/cert_loader.cc
@@ -84,14 +84,6 @@ void CertLoader::RemoveObserver(CertLoader::Observer* observer) {
observers_.RemoveObserver(observer);
}
-int CertLoader::TPMTokenSlotID() const {
- if (!database_)
- return -1;
- crypto::ScopedPK11Slot slot(database_->GetPrivateSlot());
- DCHECK(slot);
- return static_cast<int>(PK11_GetSlotID(slot.get()));
-}
-
bool CertLoader::IsHardwareBacked() const {
if (force_hardware_backed_for_test_)
return true;
@@ -122,13 +114,19 @@ bool CertLoader::CertificatesLoading() const {
// is shared between a certificate and its associated private and public
// keys. I tried to implement this with PK11_GetLowLevelKeyIDForCert(),
// but that always returns NULL on Chrome OS for me.
-std::string CertLoader::GetPkcs11IdForCert(const net::X509Certificate& cert) {
+std::string CertLoader::GetPkcs11IdAndSlotForCert(
+ const net::X509Certificate& cert,
+ int* slot_id) {
+ DCHECK(slot_id);
+
CERTCertificateStr* cert_handle = cert.os_cert_handle();
SECKEYPrivateKey *priv_key =
PK11_FindKeyByAnyCert(cert_handle, NULL /* wincx */);
if (!priv_key)
return std::string();
+ *slot_id = static_cast<int>(PK11_GetSlotID(priv_key->pkcs11Slot));
+
// Get the CKA_ID attribute for a key.
SECItem* sec_item = PK11_GetLowLevelKeyIDForPrivateKey(priv_key);
std::string pkcs11_id;
« no previous file with comments | « chromeos/cert_loader.h ('k') | chromeos/cert_loader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698