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

Side by Side Diff: chromeos/network/onc/onc_certificate_importer_impl.cc

Issue 144423007: Make NSSCertDatabase::ListCerts work async on a worker thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chromeos/network/network_connection_handler_unittest.cc ('k') | net/cert/nss_cert_database.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromeos/network/onc/onc_certificate_importer_impl.h" 5 #include "chromeos/network/onc/onc_certificate_importer_impl.h"
6 6
7 #include <cert.h> 7 #include <cert.h>
8 #include <keyhi.h> 8 #include <keyhi.h>
9 #include <pk11pub.h> 9 #include <pk11pub.h>
10 10
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 VLOG(2) << "Successfully imported certificate at index " << i; 71 VLOG(2) << "Successfully imported certificate at index " << i;
72 } 72 }
73 } 73 }
74 return success; 74 return success;
75 } 75 }
76 76
77 // static 77 // static
78 void CertificateImporterImpl::ListCertsWithNickname(const std::string& label, 78 void CertificateImporterImpl::ListCertsWithNickname(const std::string& label,
79 net::CertificateList* result) { 79 net::CertificateList* result) {
80 net::CertificateList all_certs; 80 net::CertificateList all_certs;
81 net::NSSCertDatabase::GetInstance()->ListCerts(&all_certs); 81 // TODO(tbarzic): Use async |ListCerts|.
82 net::NSSCertDatabase::GetInstance()->ListCertsSync(&all_certs);
82 result->clear(); 83 result->clear();
83 for (net::CertificateList::iterator iter = all_certs.begin(); 84 for (net::CertificateList::iterator iter = all_certs.begin();
84 iter != all_certs.end(); ++iter) { 85 iter != all_certs.end(); ++iter) {
85 if (iter->get()->os_cert_handle()->nickname) { 86 if (iter->get()->os_cert_handle()->nickname) {
86 // Separate the nickname stored in the certificate at the colon, since 87 // Separate the nickname stored in the certificate at the colon, since
87 // NSS likes to store it as token:nickname. 88 // NSS likes to store it as token:nickname.
88 const char* delimiter = 89 const char* delimiter =
89 ::strchr(iter->get()->os_cert_handle()->nickname, ':'); 90 ::strchr(iter->get()->os_cert_handle()->nickname, ':');
90 if (delimiter) { 91 if (delimiter) {
91 ++delimiter; // move past the colon. 92 ++delimiter; // move past the colon.
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 PK11_SetPrivateKeyNickname(private_key, const_cast<char*>(guid.c_str())); 346 PK11_SetPrivateKeyNickname(private_key, const_cast<char*>(guid.c_str()));
346 SECKEY_DestroyPrivateKey(private_key); 347 SECKEY_DestroyPrivateKey(private_key);
347 } else { 348 } else {
348 ONC_LOG_WARNING("Unable to find private key for certificate."); 349 ONC_LOG_WARNING("Unable to find private key for certificate.");
349 } 350 }
350 return true; 351 return true;
351 } 352 }
352 353
353 } // namespace onc 354 } // namespace onc
354 } // namespace chromeos 355 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/network_connection_handler_unittest.cc ('k') | net/cert/nss_cert_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698