Index: net/cert/nss_cert_database.cc |
diff --git a/net/cert/nss_cert_database.cc b/net/cert/nss_cert_database.cc |
index ed861b200bfeb207ee1fa6ff2fe75a9a72bb429c..fdd6ce60a464e533d4a1d2258776b46b06cf0893 100644 |
--- a/net/cert/nss_cert_database.cc |
+++ b/net/cert/nss_cert_database.cc |
@@ -82,7 +82,7 @@ void NSSCertDatabase::ListCerts( |
const base::Callback<void(scoped_ptr<CertificateList> certs)>& callback) { |
scoped_ptr<CertificateList> certs(new CertificateList()); |
- // base::Pased will NULL out |certs|, so cache the underlying pointer here. |
+ // base::Passed will NULL out |certs|, so cache the underlying pointer here. |
CertificateList* raw_certs = certs.get(); |
GetSlowTaskRunner()->PostTaskAndReply( |
FROM_HERE, |
@@ -91,6 +91,21 @@ void NSSCertDatabase::ListCerts( |
base::Bind(callback, base::Passed(&certs))); |
} |
+void NSSCertDatabase::ListCertsInSlot(const ListCertsCallback& callback, |
+ PK11SlotInfo* slot) { |
+ DCHECK(slot); |
+ scoped_ptr<CertificateList> certs(new CertificateList()); |
+ |
+ // base::Passed will NULL out |certs|, so cache the underlying pointer here. |
+ CertificateList* raw_certs = certs.get(); |
+ GetSlowTaskRunner()->PostTaskAndReply( |
+ FROM_HERE, |
+ base::Bind(&NSSCertDatabase::ListCertsInSlotImpl, |
+ base::Passed(crypto::ScopedPK11Slot(PK11_ReferenceSlot(slot))), |
+ base::Unretained(raw_certs)), |
+ base::Bind(callback, base::Passed(&certs))); |
+} |
+ |
crypto::ScopedPK11Slot NSSCertDatabase::GetPublicSlot() const { |
return crypto::ScopedPK11Slot(crypto::GetPublicNSSKeySlot()); |
} |
@@ -362,6 +377,20 @@ void NSSCertDatabase::SetSlowTaskRunnerForTest( |
} |
// static |
+void NSSCertDatabase::ListCertsInSlotImpl(crypto::ScopedPK11Slot slot, |
+ CertificateList* certs) { |
mattm
2014/05/16 20:27:12
certs->clear();
pneubeck (no reviews)
2014/05/19 19:17:19
Merged with other ListCertsImpl.
Done.
|
+ DCHECK(slot); |
+ CERTCertList* cert_list = PK11_ListCertsInSlot(slot.get()); |
+ CERTCertListNode* node; |
+ for (node = CERT_LIST_HEAD(cert_list); !CERT_LIST_END(node, cert_list); |
+ node = CERT_LIST_NEXT(node)) { |
+ certs->push_back(X509Certificate::CreateFromHandle( |
+ node->cert, X509Certificate::OSCertHandles())); |
+ } |
+ CERT_DestroyCertList(cert_list); |
+} |
+ |
+// static |
void NSSCertDatabase::ListCertsImpl(CertificateList* certs) { |
certs->clear(); |