#include "net/cert/nss_cert_database.h"
#include <cert.h>
#include <certdb.h>
#include <pk11pub.h>
#include <seccomon.h>
#include <algorithm>
#include <memory>
#include <string>
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/lazy_instance.h"
#include "base/run_loop.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/test_future.h"
#include "crypto/scoped_nss_types.h"
#include "crypto/scoped_test_nss_db.h"
#include "net/base/features.h"
#include "net/base/hash_value.h"
#include "net/base/net_errors.h"
#include "net/cert/cert_database.h"
#include "net/cert/cert_net_fetcher.h"
#include "net/cert/cert_status_flags.h"
#include "net/cert/cert_verify_proc.h"
#include "net/cert/cert_verify_result.h"
#include "net/cert/crl_set.h"
#include "net/cert/ct_verifier.h"
#include "net/cert/do_nothing_ct_verifier.h"
#include "net/cert/mock_cert_verifier.h"
#include "net/cert/x509_certificate.h"
#include "net/cert/x509_util_nss.h"
#include "net/log/net_log_with_source.h"
#include "net/test/cert_builder.h"
#include "net/test/cert_test_util.h"
#include "net/test/gtest_util.h"
#include "net/test/test_data_directory.h"
#include "net/test/test_with_task_environment.h"
#include "net/third_party/mozilla_security_manager/nsNSSCertificateDB.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
ASCIIToUTF16;
IsError;
IsOk;
namespace net {
namespace {
std::string GetSubjectCN(CERTCertificate* cert) { … }
bool GetCertIsPerm(const CERTCertificate* cert) { … }
const NSSCertDatabase::CertInfo* FindCertInfoForCert(
const NSSCertDatabase::CertInfoList& cert_info_list,
CERTCertificate* target_cert) { … }
class MockCertDatabaseObserver : public CertDatabase::Observer { … };
class MockNSSCertDatabaseObserver : public NSSCertDatabase::Observer { … };
}
class CertDatabaseNSSTest : public TestWithTaskEnvironment { … };
TEST_F(CertDatabaseNSSTest, ListCerts) { … }
TEST_F(CertDatabaseNSSTest, ListCertsInfo) { … }
TEST_F(CertDatabaseNSSTest, ImportFromPKCS12WrongPassword) { … }
TEST_F(CertDatabaseNSSTest, ImportFromPKCS12AsExtractableAndExportAgain) { … }
TEST_F(CertDatabaseNSSTest, ImportFromPKCS12Twice) { … }
TEST_F(CertDatabaseNSSTest, ImportFromPKCS12AsUnextractableAndExportAgain) { … }
TEST_F(CertDatabaseNSSTest, ImportFromPKCS12OnlyMarkIncludedKey) { … }
TEST_F(CertDatabaseNSSTest, ImportFromPKCS12InvalidFile) { … }
TEST_F(CertDatabaseNSSTest, ImportFromPKCS12EmptyPassword) { … }
TEST_F(CertDatabaseNSSTest, ImportFromPKCS12NullPassword) { … }
TEST_F(CertDatabaseNSSTest, ImportCACert_SSLTrust) { … }
TEST_F(CertDatabaseNSSTest, ImportCACert_EmailTrust) { … }
TEST_F(CertDatabaseNSSTest, ImportCACert_ObjSignTrust) { … }
TEST_F(CertDatabaseNSSTest, ImportCA_NotCACert) { … }
TEST_F(CertDatabaseNSSTest, ImportCACertHierarchy) { … }
TEST_F(CertDatabaseNSSTest, ImportCACertHierarchyDupeRoot) { … }
TEST_F(CertDatabaseNSSTest, ImportCACertHierarchyUntrusted) { … }
TEST_F(CertDatabaseNSSTest, ImportCACertHierarchyTree) { … }
TEST_F(CertDatabaseNSSTest, ImportCACertNotHierarchy) { … }
TEST_F(CertDatabaseNSSTest, ImportServerCert) { … }
TEST_F(CertDatabaseNSSTest, ImportServerCert_SelfSigned) { … }
TEST_F(CertDatabaseNSSTest, ImportServerCert_SelfSigned_Trusted) { … }
TEST_F(CertDatabaseNSSTest, ImportCaAndServerCert) { … }
TEST_F(CertDatabaseNSSTest, ImportCaAndServerCert_DistrustServer) { … }
TEST_F(CertDatabaseNSSTest, TrustIntermediateCa) { … }
TEST_F(CertDatabaseNSSTest, TrustIntermediateCa2) { … }
TEST_F(CertDatabaseNSSTest, TrustIntermediateCa3) { … }
TEST_F(CertDatabaseNSSTest, TrustIntermediateCa4) { … }
TEST_F(CertDatabaseNSSTest, ImportDuplicateCommonName) { … }
}