OLD | NEW |
---|---|
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 Loading... | |
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 net::NSSCertDatabase::GetInstance()->ListCertsSync(&all_certs); |
stevenjb
2014/02/04 22:28:42
TODO(): make this async
tbarzic
2014/02/04 23:12:38
Done.
| |
82 result->clear(); | 82 result->clear(); |
83 for (net::CertificateList::iterator iter = all_certs.begin(); | 83 for (net::CertificateList::iterator iter = all_certs.begin(); |
84 iter != all_certs.end(); ++iter) { | 84 iter != all_certs.end(); ++iter) { |
85 if (iter->get()->os_cert_handle()->nickname) { | 85 if (iter->get()->os_cert_handle()->nickname) { |
86 // Separate the nickname stored in the certificate at the colon, since | 86 // Separate the nickname stored in the certificate at the colon, since |
87 // NSS likes to store it as token:nickname. | 87 // NSS likes to store it as token:nickname. |
88 const char* delimiter = | 88 const char* delimiter = |
89 ::strchr(iter->get()->os_cert_handle()->nickname, ':'); | 89 ::strchr(iter->get()->os_cert_handle()->nickname, ':'); |
90 if (delimiter) { | 90 if (delimiter) { |
91 ++delimiter; // move past the colon. | 91 ++delimiter; // move past the colon. |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
345 PK11_SetPrivateKeyNickname(private_key, const_cast<char*>(guid.c_str())); | 345 PK11_SetPrivateKeyNickname(private_key, const_cast<char*>(guid.c_str())); |
346 SECKEY_DestroyPrivateKey(private_key); | 346 SECKEY_DestroyPrivateKey(private_key); |
347 } else { | 347 } else { |
348 ONC_LOG_WARNING("Unable to find private key for certificate."); | 348 ONC_LOG_WARNING("Unable to find private key for certificate."); |
349 } | 349 } |
350 return true; | 350 return true; |
351 } | 351 } |
352 | 352 |
353 } // namespace onc | 353 } // namespace onc |
354 } // namespace chromeos | 354 } // namespace chromeos |
OLD | NEW |