#include <iostream>
#include <string_view>
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/message_loop/message_pump_type.h"
#include "base/strings/string_split.h"
#include "base/synchronization/waitable_event.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/threading/thread.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "net/cert/cert_net_fetcher.h"
#include "net/cert/cert_verify_proc.h"
#include "net/cert/cert_verify_proc_builtin.h"
#include "net/cert/crl_set.h"
#include "net/cert/do_nothing_ct_verifier.h"
#include "net/cert/internal/platform_trust_store.h"
#include "net/cert/internal/system_trust_store.h"
#include "net/cert/x509_util.h"
#include "net/cert_net/cert_net_fetcher_url_request.h"
#include "net/tools/cert_verify_tool/cert_verify_tool_util.h"
#include "net/tools/cert_verify_tool/verify_using_cert_verify_proc.h"
#include "net/tools/cert_verify_tool/verify_using_path_builder.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_builder.h"
#include "net/url_request/url_request_context_getter.h"
#include "third_party/abseil-cpp/absl/cleanup/cleanup.h"
#include "third_party/boringssl/src/pki/trust_store.h"
#include "third_party/boringssl/src/pki/trust_store_collection.h"
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
#include "net/proxy_resolution/proxy_config.h"
#include "net/proxy_resolution/proxy_config_service_fixed.h"
#endif
#if BUILDFLAG(CHROME_ROOT_STORE_SUPPORTED)
#include "net/cert/internal/trust_store_chrome.h"
#endif
namespace {
enum class RootStoreType { … };
std::string GetUserAgent() { … }
void SetUpOnNetworkThread(
std::unique_ptr<net::URLRequestContext>* context,
scoped_refptr<net::CertNetFetcherURLRequest>* cert_net_fetcher,
base::WaitableEvent* initialization_complete_event) { … }
void ShutdownOnNetworkThread(
std::unique_ptr<net::URLRequestContext>* context,
scoped_refptr<net::CertNetFetcherURLRequest>* cert_net_fetcher) { … }
class CertVerifyImpl { … };
class CertVerifyImplUsingProc : public CertVerifyImpl { … };
class CertVerifyImplUsingPathBuilder : public CertVerifyImpl { … };
class DummySystemTrustStore : public net::SystemTrustStore { … };
std::unique_ptr<net::SystemTrustStore> CreateSystemTrustStore(
std::string_view impl_name,
RootStoreType root_store_type) { … }
std::unique_ptr<CertVerifyImpl> CreateCertVerifyImplFromName(
std::string_view impl_name,
scoped_refptr<net::CertNetFetcher> cert_net_fetcher,
scoped_refptr<net::CRLSet> crl_set,
RootStoreType root_store_type) { … }
void PrintCertHashAndSubject(CRYPTO_BUFFER* cert) { … }
void PrintInputChain(const CertInput& target,
const std::vector<CertInput>& intermediates) { … }
void PrintAdditionalRoots(const std::vector<CertInputWithTrustSetting>&
der_certs_with_trust_settings) { … }
const char kUsage[] = …;
void PrintUsage(const char* argv0) { … }
}
int main(int argc, char** argv) { … }