1 // Copyright 2024 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef NET_CERT_INTERNAL_PLATFORM_TRUST_STORE_H_ 6 #define NET_CERT_INTERNAL_PLATFORM_TRUST_STORE_H_ 7 8 #include <vector> 9 10 #include "net/base/net_export.h" 11 #include "third_party/boringssl/src/pki/parsed_certificate.h" 12 #include "third_party/boringssl/src/pki/trust_store.h" 13 14 namespace net { 15 16 // Extension of bssl::TrustStore that supports enumerating all 17 // user added certs. 18 class NET_EXPORT PlatformTrustStore : public bssl::TrustStore { 19 public: 20 PlatformTrustStore() = default; 21 22 PlatformTrustStore(const PlatformTrustStore&) = delete; 23 PlatformTrustStore& operator=(const PlatformTrustStore&) = delete; 24 25 struct NET_EXPORT CertWithTrust { 26 CertWithTrust(std::vector<uint8_t> cert_bytes, 27 bssl::CertificateTrust trust); 28 ~CertWithTrust(); 29 CertWithTrust(const CertWithTrust&); 30 CertWithTrust& operator=(const CertWithTrust& other); 31 CertWithTrust(CertWithTrust&&); 32 CertWithTrust& operator=(CertWithTrust&& other); 33 34 std::vector<uint8_t> cert_bytes; 35 bssl::CertificateTrust trust; 36 }; 37 38 virtual std::vector<CertWithTrust> GetAllUserAddedCerts() = 0; 39 }; 40 41 } // namespace net 42 43 #endif // NET_CERT_INTERNAL_PLATFORM_TRUST_STORE_H_ 44