Bob Beck | bc97b7a | 2023-04-18 08:35:15 -0600 | [diff] [blame] | 1 | // Copyright 2016 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 BSSL_PKI_TRUST_STORE_COLLECTION_H_ |
| 6 | #define BSSL_PKI_TRUST_STORE_COLLECTION_H_ |
| 7 | |
| 8 | #include "fillins/openssl_util.h" |
| 9 | |
| 10 | #include "trust_store.h" |
| 11 | |
| 12 | namespace bssl { |
| 13 | |
| 14 | // TrustStoreCollection is an implementation of TrustStore which combines the |
| 15 | // results from multiple TrustStores. |
| 16 | // |
| 17 | // The order of the matches will correspond to a concatenation of matches in |
| 18 | // the order the stores were added. |
| 19 | class OPENSSL_EXPORT TrustStoreCollection : public TrustStore { |
| 20 | public: |
| 21 | TrustStoreCollection(); |
| 22 | |
| 23 | TrustStoreCollection(const TrustStoreCollection&) = delete; |
| 24 | TrustStoreCollection& operator=(const TrustStoreCollection&) = delete; |
| 25 | |
| 26 | ~TrustStoreCollection() override; |
| 27 | |
| 28 | // Includes results from |store| in the combined output. |store| must |
| 29 | // outlive the TrustStoreCollection. |
| 30 | void AddTrustStore(TrustStore* store); |
| 31 | |
| 32 | // TrustStore implementation: |
| 33 | void SyncGetIssuersOf(const ParsedCertificate* cert, |
| 34 | ParsedCertificateList* issuers) override; |
| 35 | CertificateTrust GetTrust(const ParsedCertificate* cert, |
| 36 | void* debug_data) override; |
| 37 | |
| 38 | private: |
| 39 | std::vector<TrustStore*> stores_; |
| 40 | }; |
| 41 | |
| 42 | } // namespace net |
| 43 | |
| 44 | #endif // BSSL_PKI_TRUST_STORE_COLLECTION_H_ |