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

Unified Diff: net/tools/domain_security_preload_generator/pinset.h

Issue 2551153003: Add static domain security state generator tool. (Closed)
Patch Set: Fix iOS? Created 4 years 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/tools/domain_security_preload_generator/pinset.h
diff --git a/net/tools/domain_security_preload_generator/pinset.h b/net/tools/domain_security_preload_generator/pinset.h
new file mode 100644
index 0000000000000000000000000000000000000000..f74ed3a8c26d8241a633a923763f06da1abebbae
--- /dev/null
+++ b/net/tools/domain_security_preload_generator/pinset.h
@@ -0,0 +1,58 @@
+// Copyright (c) 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_TOOLS_DOMAIN_SECURITY_PRELOAD_GENERATOR_PINSET_H_
+#define NET_TOOLS_DOMAIN_SECURITY_PRELOAD_GENERATOR_PINSET_H_
+
+#include <string>
+#include <vector>
+
+#include "base/macros.h"
+
+namespace net {
+
+namespace transport_security_state {
+
+// A Pinset represents the data a website would send in a HPKP header. A pinset
+// is given a name so that multiple entries in the preload list can reference
+// the same pinset.
+class Pinset {
+ public:
+ Pinset(std::string name, std::string report_uri);
+ ~Pinset();
+
+ const std::string& name() const { return name_; }
+ const std::string& report_uri() const { return report_uri_; }
+
+ const std::vector<std::string>& static_spki_hashes() const {
+ return static_spki_hashes_;
+ }
+ const std::vector<std::string>& bad_static_spki_hashes() const {
+ return bad_static_spki_hashes_;
+ }
+
+ // Register a good hash for this pinset. Hashes are referenced by a name, not
+ // by the actual hash.
+ void AddStaticSPKIHash(const std::string& hash_name);
+
+ // Register a bad hash for this pinset. Hashes are referenced by a name, not
+ // by the actual hash.
+ void AddBadStaticSPKIHash(const std::string& hash_name);
+
+ private:
+ std::string name_;
+ std::string report_uri_;
+
+ // These vectors contain names rather than actual hashes.
+ std::vector<std::string> static_spki_hashes_;
+ std::vector<std::string> bad_static_spki_hashes_;
+
+ DISALLOW_COPY_AND_ASSIGN(Pinset);
+};
+
+} // namespace transport_security_state
+
+} // namespace net
+
+#endif // NET_TOOLS_DOMAIN_SECURITY_PRELOAD_GENERATOR_PINSET_H_

Powered by Google App Engine
This is Rietveld 408576698