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

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

Issue 2252933002: Make TrustStore into an interface, move impl to TrustStoreInMemory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update cast_cert_validator_unittest.cc 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
« no previous file with comments | « net/cert/internal/trust_store.cc ('k') | net/cert/internal/trust_store_in_memory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/internal/trust_store_in_memory.h
diff --git a/net/cert/internal/trust_store_in_memory.h b/net/cert/internal/trust_store_in_memory.h
new file mode 100644
index 0000000000000000000000000000000000000000..0691ff7a1ee5d71c21565adf6469cfd68b485f5b
--- /dev/null
+++ b/net/cert/internal/trust_store_in_memory.h
@@ -0,0 +1,49 @@
+// 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_IN_MEMORY_H_
+#define NET_CERT_INTERNAL_TRUST_STORE_IN_MEMORY_H_
+
+#include <unordered_map>
+
+#include "base/memory/ref_counted.h"
+#include "base/strings/string_piece.h"
+#include "net/base/net_export.h"
+#include "net/cert/internal/trust_store.h"
+
+namespace net {
+
+namespace der {
+class Input;
+}
+
+// A very simple implementation of a TrustStore, which contains a set of
+// trust anchors.
+class NET_EXPORT TrustStoreInMemory : public TrustStore {
+ public:
+ TrustStoreInMemory();
+ ~TrustStoreInMemory() override;
+
+ // Empties the trust store, resetting it to original state.
+ void Clear();
+
+ void AddTrustAnchor(scoped_refptr<TrustAnchor> anchor);
+
+ // Returns the trust anchors that match |name| in |*matches|, if any.
+ void FindTrustAnchorsByNormalizedName(const der::Input& normalized_name,
+ TrustAnchors* matches) const override;
+
+ private:
+ // Multimap from normalized subject -> TrustAnchor.
+ std::unordered_multimap<base::StringPiece,
+ scoped_refptr<TrustAnchor>,
+ base::StringPieceHash>
+ anchors_;
+
+ DISALLOW_COPY_AND_ASSIGN(TrustStoreInMemory);
+};
+
+} // namespace net
+
+#endif // NET_CERT_INTERNAL_TRUST_STORE_IN_MEMORY_H_
« no previous file with comments | « net/cert/internal/trust_store.cc ('k') | net/cert/internal/trust_store_in_memory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698