| // Copyright 2021 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef NET_CERT_INTERNAL_TRUST_STORE_CHROME_H_ |
| #define NET_CERT_INTERNAL_TRUST_STORE_CHROME_H_ |
| |
| #include "base/containers/span.h" |
| #include "net/base/net_export.h" |
| #include "net/cert/internal/trust_store.h" |
| #include "net/cert/internal/trust_store_in_memory.h" |
| |
| namespace net { |
| |
| struct ChromeRootCertInfo; |
| |
| // TrustStoreChrome contains the Chrome Root Store, as described at |
| // https://g.co/chrome/root-policy |
| class NET_EXPORT TrustStoreChrome : public TrustStore { |
| public: |
| // Creates a ChromeTrustStore that uses a copy of `certs`, instead of the |
| // default Chrome Root Store. |
| static std::unique_ptr<TrustStoreChrome> CreateTrustStoreForTesting( |
| base::span<const ChromeRootCertInfo> certs); |
| |
| TrustStoreChrome(); |
| ~TrustStoreChrome() override; |
| |
| TrustStoreChrome(const TrustStoreChrome& other) = delete; |
| TrustStoreChrome& operator=(const TrustStoreChrome& other) = delete; |
| |
| // TrustStore implementation: |
| void SyncGetIssuersOf(const ParsedCertificate* cert, |
| ParsedCertificateList* issuers) override; |
| CertificateTrust GetTrust(const ParsedCertificate* cert, |
| base::SupportsUserData* debug_data) const override; |
| |
| // Returns true if the trust store contains the given ParsedCertificate |
| // (matches by DER). |
| bool Contains(const ParsedCertificate* cert) const; |
| |
| private: |
| explicit TrustStoreChrome(base::span<const ChromeRootCertInfo> certs); |
| TrustStoreInMemory trust_store_; |
| }; |
| |
| } // namespace net |
| |
| #endif // NET_CERT_INTERNAL_TRUST_STORE_CHROME_H_ |