| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "net/base/cert_database.h" | 5 #include "net/base/cert_database.h" |
| 6 | 6 |
| 7 #include <cert.h> | 7 #include <cert.h> |
| 8 #include <certdb.h> | 8 #include <certdb.h> |
| 9 #include <keyhi.h> | 9 #include <keyhi.h> |
| 10 #include <pk11pub.h> | 10 #include <pk11pub.h> |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 void CertDatabase::ListCerts(CertificateList* certs) { | 96 void CertDatabase::ListCerts(CertificateList* certs) { |
| 97 certs->clear(); | 97 certs->clear(); |
| 98 | 98 |
| 99 CERTCertList* cert_list = PK11_ListCerts(PK11CertListUnique, NULL); | 99 CERTCertList* cert_list = PK11_ListCerts(PK11CertListUnique, NULL); |
| 100 CERTCertListNode* node; | 100 CERTCertListNode* node; |
| 101 for (node = CERT_LIST_HEAD(cert_list); | 101 for (node = CERT_LIST_HEAD(cert_list); |
| 102 !CERT_LIST_END(node, cert_list); | 102 !CERT_LIST_END(node, cert_list); |
| 103 node = CERT_LIST_NEXT(node)) { | 103 node = CERT_LIST_NEXT(node)) { |
| 104 certs->push_back(X509Certificate::CreateFromHandle( | 104 certs->push_back(X509Certificate::CreateFromHandle( |
| 105 node->cert, | 105 node->cert, X509Certificate::OSCertHandles())); |
| 106 X509Certificate::SOURCE_LONE_CERT_IMPORT, | |
| 107 X509Certificate::OSCertHandles())); | |
| 108 } | 106 } |
| 109 CERT_DestroyCertList(cert_list); | 107 CERT_DestroyCertList(cert_list); |
| 110 } | 108 } |
| 111 | 109 |
| 112 CryptoModule* CertDatabase::GetPublicModule() const { | 110 CryptoModule* CertDatabase::GetPublicModule() const { |
| 113 CryptoModule* module = | 111 CryptoModule* module = |
| 114 CryptoModule::CreateFromHandle(crypto::GetPublicNSSKeySlot()); | 112 CryptoModule::CreateFromHandle(crypto::GetPublicNSSKeySlot()); |
| 115 // The module is already referenced when returned from | 113 // The module is already referenced when returned from |
| 116 // GetPublicNSSKeySlot, so we need to deref it once. | 114 // GetPublicNSSKeySlot, so we need to deref it once. |
| 117 PK11_FreeSlot(module->os_module_handle()); | 115 PK11_FreeSlot(module->os_module_handle()); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 } | 268 } |
| 271 return true; | 269 return true; |
| 272 } | 270 } |
| 273 | 271 |
| 274 bool CertDatabase::IsReadOnly(const X509Certificate* cert) const { | 272 bool CertDatabase::IsReadOnly(const X509Certificate* cert) const { |
| 275 PK11SlotInfo* slot = cert->os_cert_handle()->slot; | 273 PK11SlotInfo* slot = cert->os_cert_handle()->slot; |
| 276 return slot && PK11_IsReadOnly(slot); | 274 return slot && PK11_IsReadOnly(slot); |
| 277 } | 275 } |
| 278 | 276 |
| 279 } // namespace net | 277 } // namespace net |
| OLD | NEW |