xref: /aosp_15_r20/external/cronet/third_party/boringssl/src/pki/trust_store_collection.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
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 <openssl/base.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) override;
36 
37  private:
38   std::vector<TrustStore *> stores_;
39 };
40 
41 }  // namespace bssl
42 
43 #endif  // BSSL_PKI_TRUST_STORE_COLLECTION_H_
44