CertificateList => ScopedCERTCertificateList

This commit is contained in:
Cheng Zhao 2018-03-12 15:28:55 +09:00 committed by Aleksei Kuzmin
parent 0f9f04e4ec
commit 76ef6e3ecc
3 changed files with 16 additions and 15 deletions

View file

@ -484,7 +484,7 @@ int ImportIntoCertStore(
const base::DictionaryValue& options) { const base::DictionaryValue& options) {
std::string file_data, cert_path; std::string file_data, cert_path;
base::string16 password; base::string16 password;
net::CertificateList imported_certs; net::ScopedCERTCertificateList imported_certs;
int rv = -1; int rv = -1;
options.GetString("certificate", &cert_path); options.GetString("certificate", &cert_path);
options.GetString("password", &password); options.GetString("password", &password);

View file

@ -91,11 +91,12 @@ CertificateManagerModel::CertificateManagerModel(
CertificateManagerModel::~CertificateManagerModel() { CertificateManagerModel::~CertificateManagerModel() {
} }
int CertificateManagerModel::ImportFromPKCS12(PK11SlotInfo* slot_info, int CertificateManagerModel::ImportFromPKCS12(
const std::string& data, PK11SlotInfo* slot_info,
const base::string16& password, const std::string& data,
bool is_extractable, const base::string16& password,
net::CertificateList* imported_certs) { bool is_extractable,
net::ScopedCERTCertificateList* imported_certs) {
return cert_db_->ImportFromPKCS12(slot_info, data, password, return cert_db_->ImportFromPKCS12(slot_info, data, password,
is_extractable, imported_certs); is_extractable, imported_certs);
} }
@ -105,14 +106,14 @@ int CertificateManagerModel::ImportUserCert(const std::string& data) {
} }
bool CertificateManagerModel::ImportCACerts( bool CertificateManagerModel::ImportCACerts(
const net::CertificateList& certificates, const net::ScopedCERTCertificateList& certificates,
net::NSSCertDatabase::TrustBits trust_bits, net::NSSCertDatabase::TrustBits trust_bits,
net::NSSCertDatabase::ImportCertFailureList* not_imported) { net::NSSCertDatabase::ImportCertFailureList* not_imported) {
return cert_db_->ImportCACerts(certificates, trust_bits, not_imported); return cert_db_->ImportCACerts(certificates, trust_bits, not_imported);
} }
bool CertificateManagerModel::ImportServerCert( bool CertificateManagerModel::ImportServerCert(
const net::CertificateList& certificates, const net::ScopedCERTCertificateList& certificates,
net::NSSCertDatabase::TrustBits trust_bits, net::NSSCertDatabase::TrustBits trust_bits,
net::NSSCertDatabase::ImportCertFailureList* not_imported) { net::NSSCertDatabase::ImportCertFailureList* not_imported) {
return cert_db_->ImportServerCert(certificates, trust_bits, return cert_db_->ImportServerCert(certificates, trust_bits,
@ -120,13 +121,13 @@ bool CertificateManagerModel::ImportServerCert(
} }
bool CertificateManagerModel::SetCertTrust( bool CertificateManagerModel::SetCertTrust(
const net::X509Certificate* cert, CERTCertificate* cert,
net::CertType type, net::CertType type,
net::NSSCertDatabase::TrustBits trust_bits) { net::NSSCertDatabase::TrustBits trust_bits) {
return cert_db_->SetCertTrust(cert, type, trust_bits); return cert_db_->SetCertTrust(cert, type, trust_bits);
} }
bool CertificateManagerModel::Delete(net::X509Certificate* cert) { bool CertificateManagerModel::Delete(CERTCertificate* cert) {
return cert_db_->DeleteCertAndKey(cert); return cert_db_->DeleteCertAndKey(cert);
} }

View file

@ -48,7 +48,7 @@ class CertificateManagerModel {
const std::string& data, const std::string& data,
const base::string16& password, const base::string16& password,
bool is_extractable, bool is_extractable,
net::CertificateList* imported_certs); net::ScopedCERTCertificateList* imported_certs);
// Import user certificate from DER encoded |data|. // Import user certificate from DER encoded |data|.
// Returns a net error code on failure. // Returns a net error code on failure.
@ -62,7 +62,7 @@ class CertificateManagerModel {
// Returns false if there is an internal error, otherwise true is returned and // Returns false if there is an internal error, otherwise true is returned and
// |not_imported| should be checked for any certificates that were not // |not_imported| should be checked for any certificates that were not
// imported. // imported.
bool ImportCACerts(const net::CertificateList& certificates, bool ImportCACerts(const net::ScopedCERTCertificateList& certificates,
net::NSSCertDatabase::TrustBits trust_bits, net::NSSCertDatabase::TrustBits trust_bits,
net::NSSCertDatabase::ImportCertFailureList* not_imported); net::NSSCertDatabase::ImportCertFailureList* not_imported);
@ -77,20 +77,20 @@ class CertificateManagerModel {
// |not_imported| should be checked for any certificates that were not // |not_imported| should be checked for any certificates that were not
// imported. // imported.
bool ImportServerCert( bool ImportServerCert(
const net::CertificateList& certificates, const net::ScopedCERTCertificateList& certificates,
net::NSSCertDatabase::TrustBits trust_bits, net::NSSCertDatabase::TrustBits trust_bits,
net::NSSCertDatabase::ImportCertFailureList* not_imported); net::NSSCertDatabase::ImportCertFailureList* not_imported);
// Set trust values for certificate. // Set trust values for certificate.
// |trust_bits| should be a bit field of TRUST* values from NSSCertDatabase. // |trust_bits| should be a bit field of TRUST* values from NSSCertDatabase.
// Returns true on success or false on failure. // Returns true on success or false on failure.
bool SetCertTrust(const net::X509Certificate* cert, bool SetCertTrust(CERTCertificate* cert,
net::CertType type, net::CertType type,
net::NSSCertDatabase::TrustBits trust_bits); net::NSSCertDatabase::TrustBits trust_bits);
// Delete the cert. Returns true on success. |cert| is still valid when this // Delete the cert. Returns true on success. |cert| is still valid when this
// function returns. // function returns.
bool Delete(net::X509Certificate* cert); bool Delete(CERTCertificate* cert);
private: private:
CertificateManagerModel(net::NSSCertDatabase* nss_cert_database, CertificateManagerModel(net::NSSCertDatabase* nss_cert_database,