Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1141)

Unified Diff: net/cert/internal/trust_store_collection.h

Issue 2272493002: Add TrustStoreNSS and TrustStoreCollection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cert-trust-store-interface3-nss
Patch Set: rebaes Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/cert/internal/trust_store_collection.h
diff --git a/net/cert/internal/trust_store_collection.h b/net/cert/internal/trust_store_collection.h
new file mode 100644
index 0000000000000000000000000000000000000000..cc3e233d71f913b72863ab1b182dbd46f06ac7e7
--- /dev/null
+++ b/net/cert/internal/trust_store_collection.h
@@ -0,0 +1,62 @@
+// Copyright 2016 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_COLLECTION_H_
+#define NET_CERT_INTERNAL_TRUST_STORE_COLLECTION_H_
+
+#include "base/memory/ref_counted.h"
+#include "net/base/net_export.h"
+#include "net/cert/internal/trust_store.h"
+
+namespace base {
+class TaskRunner;
+}
+
+namespace net {
+
+// TrustStoreCollection is an implementation of TrustStore which combines the
+// results from multiple other TrustStores.
eroman 2016/08/27 01:53:38 nit: multiple other --> "multiple"
mattm 2016/08/29 20:38:16 Done.
+//
+// The synchronous matches will be in order from the primary store, and then
+// from the secondary stores in the order they were added to the
+// TrustStoreCollection.
+//
+// Currently only one "primary" store can be added that supports async queries,
+// any number of additional, synchronous-only stores can be used. (The
+// assumption is that async one would be useful for OS integration, while the
eroman 2016/08/27 01:53:38 "that async one" --> "that the async one"
mattm 2016/08/29 20:38:16 Done.
+// sync only stores can be used for supplying additional anchors. If multiple
+// async stores are desired, it might be worth changing the
+// FindTrustAnchorsForCert interface so that it can return async results in
+// multiple batches.)
+class NET_EXPORT TrustStoreCollection : public TrustStore {
+ public:
+ TrustStoreCollection();
+ ~TrustStoreCollection() override;
+
+ // Includes results from |store| in the combined output. Both sync and async
+ // queries to |store| will be allowed. |store| must outlive the
+ // TrustStoreCollection.
+ void SetPrimaryTrustStore(TrustStore* store);
+
+ // Includes results from |store| in the combined output. |store| will only be
+ // queried synchronously. |store| must outlive the TrustStoreCollection.
+ void AddTrustStoreSynchronousOnly(TrustStore* store);
+
+ // TrustStore implementation:
+ void FindTrustAnchorsForCert(
+ scoped_refptr<ParsedCertificate> cert,
+ const TrustAnchorsCallback& callback,
+ TrustAnchors* synchronous_matches,
+ std::unique_ptr<Request>* out_req) const override;
+
+ private:
+ TrustStore* primary_store_ = nullptr;
+ std::vector<TrustStore*> sync_only_stores_;
+
+ DISALLOW_COPY_AND_ASSIGN(TrustStoreCollection);
+};
+
+} // namespace net
+
+#endif // NET_CERT_INTERNAL_TRUST_STORE_COLLECTION_H_

Powered by Google App Engine
This is Rietveld 408576698