Chromium Code Reviews| Index: net/base/cert_database_nss.cc |
| diff --git a/net/base/cert_database_nss.cc b/net/base/cert_database_nss.cc |
| index a32a7a3923c80578759b1c2ee73d02179bfbc6cc..d6fc5c3b24a6af92fd6735ca9dd3e17fd9fccd3c 100644 |
| --- a/net/base/cert_database_nss.cc |
| +++ b/net/base/cert_database_nss.cc |
| @@ -14,6 +14,7 @@ |
| #include "base/nss_util.h" |
| #include "base/scoped_ptr.h" |
| #include "net/base/net_errors.h" |
| +#include "net/base/pk11_slot.h" |
| #include "net/base/x509_certificate.h" |
| #include "net/third_party/mozilla_security_manager/nsNSSCertificateDB.h" |
| #include "net/third_party/mozilla_security_manager/nsNSSCertTrust.h" |
| @@ -106,9 +107,30 @@ void CertDatabase::ListCerts(CertificateList* certs) { |
| CERT_DestroyCertList(cert_list); |
| } |
| +void CertDatabase::ListTokensForPKCS12(PK11SlotList* slots) const { |
| + slots->clear(); |
| + |
| + ::PK11SlotList* slot_list = NULL; |
| + slot_list = PK11_GetAllTokens(CKM_RSA_PKCS, |
|
wtc
2010/12/15 20:54:36
BUG: I think you should pass CKM_INVALID_MECHANISM
mattm
2011/01/12 01:22:07
Done.
|
| + PR_TRUE, // needRW |
| + PR_TRUE, // loadCerts (unused) |
| + NULL); // wincx |
| + |
| + ::PK11SlotListElement* slot_element = PK11_GetFirstSafe(slot_list); |
| + while (slot_element) { |
| + slots->push_back(PK11Slot::CreateFromHandle(slot_element->slot)); |
| + slot_element = PK11_GetNextSafe(slot_list, slot_element, |
| + PR_FALSE); // restart |
| + } |
| + |
| + PK11_FreeSlotList(slot_list); |
| +} |
| + |
| int CertDatabase::ImportFromPKCS12( |
| - const std::string& data, const string16& password) { |
| - return psm::nsPKCS12Blob_Import(data.data(), data.size(), password); |
| + net::PK11Slot* slot, const std::string& data, const string16& password) { |
|
wtc
2010/12/15 20:54:36
Nit: in this form, we probably should list one par
mattm
2011/01/12 01:22:07
Done.
|
| + return psm::nsPKCS12Blob_Import(slot->os_slot_handle(), |
| + data.data(), data.size(), |
| + password); |
| } |
| int CertDatabase::ExportToPKCS12( |