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
3 // found in the LICENSE file.
5 #include "net/cert/nss_cert_database_chromeos.h"
10 #include "net/base/crypto_module.h"
11 #include "net/cert/x509_certificate.h"
15 NSSCertDatabaseChromeOS::NSSCertDatabaseChromeOS(
16 crypto::ScopedPK11Slot public_slot
,
17 crypto::ScopedPK11Slot private_slot
)
18 : public_slot_(public_slot
.Pass()),
19 private_slot_(private_slot
.Pass()) {
20 profile_filter_
.Init(GetPublicSlot(), GetPrivateSlot());
23 NSSCertDatabaseChromeOS::~NSSCertDatabaseChromeOS() {}
25 void NSSCertDatabaseChromeOS::ListCerts(CertificateList
* certs
) {
26 NSSCertDatabase::ListCerts(certs
);
28 size_t pre_size
= certs
->size();
29 certs
->erase(std::remove_if(
32 NSSProfileFilterChromeOS::CertNotAllowedForProfilePredicate(
35 DVLOG(1) << "filtered " << pre_size
- certs
->size() << " of " << pre_size
39 crypto::ScopedPK11Slot
NSSCertDatabaseChromeOS::GetPublicSlot() const {
40 return crypto::ScopedPK11Slot(
41 public_slot_
? PK11_ReferenceSlot(public_slot_
.get()) : NULL
);
44 crypto::ScopedPK11Slot
NSSCertDatabaseChromeOS::GetPrivateSlot() const {
45 return crypto::ScopedPK11Slot(
46 private_slot_
? PK11_ReferenceSlot(private_slot_
.get()) : NULL
);
49 void NSSCertDatabaseChromeOS::ListModules(CryptoModuleList
* modules
,
51 NSSCertDatabase::ListModules(modules
, need_rw
);
53 size_t pre_size
= modules
->size();
58 NSSProfileFilterChromeOS::ModuleNotAllowedForProfilePredicate(
61 DVLOG(1) << "filtered " << pre_size
- modules
->size() << " of " << pre_size