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

Unified Diff: net/tools/domain_security_preload_generator/preloaded_state_generator.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/preloaded_state_generator.h
diff --git a/net/tools/domain_security_preload_generator/preloaded_state_generator.h b/net/tools/domain_security_preload_generator/preloaded_state_generator.h
new file mode 100644
index 0000000000000000000000000000000000000000..037a5959f8742e6778351c4d0ddb54aa2765c788
--- /dev/null
+++ b/net/tools/domain_security_preload_generator/preloaded_state_generator.h
@@ -0,0 +1,59 @@
+// 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_PRELOADED_STATE_GENERATOR_H_
+#define NET_TOOLS_DOMAIN_SECURITY_PRELOAD_GENERATOR_PRELOADED_STATE_GENERATOR_H_
+
+#include <stdint.h>
+
+#include <memory>
+#include <string>
+
+#include "net/tools/domain_security_preload_generator/domain_security_entry.h"
+#include "net/tools/domain_security_preload_generator/pinset.h"
+#include "net/tools/domain_security_preload_generator/pinsets.h"
+#include "net/tools/domain_security_preload_generator/trie/trie_writer.h"
+
+namespace net {
+
+namespace transport_security_state {
+
+// PreloadedStateGenerator generates C++ code that contains the preloaded
+// entries in a way the Chromium code understands. The code that reads the
+// output can be found in net/http/transport_security_state.cc. The output gets
+// compiled into the binary.
+class PreloadedStateGenerator {
+ public:
+ PreloadedStateGenerator();
+ ~PreloadedStateGenerator();
+
+ std::string Generate(const std::string& preload_template,
+ const DomainSecurityEntries& entries,
+ const DomainIDList& domain_ids,
+ const Pinsets& pinsets,
+ bool verbose);
+
+ private:
+ // TODO(Martijnc): Remove the domain IDs from the preload format.
+ // https://crbug.com/661206.
+ void ProcessDomainIds(const DomainIDList& domain_ids,
+ NameIDMap* map,
+ std::string* tpl);
+ void ProcessSPKIHashes(const Pinsets& pinset, std::string* tpl);
+ void ProcessExpectCTURIs(const DomainSecurityEntries& entries,
+ NameIDMap* expect_ct_report_uri_map,
+ std::string* tpl);
+ void ProcessExpectStapleURIs(const DomainSecurityEntries& entries,
+ NameIDMap* expect_staple_report_uri_map,
+ std::string* tpl);
+ void ProcessPinsets(const Pinsets& pinset,
+ NameIDMap* pinset_map,
+ std::string* tpl);
+};
+
+} // namespace transport_security_state
+
+} // namespace net
+
+#endif // NET_TOOLS_DOMAIN_SECURITY_PRELOAD_GENERATOR_PRELOADED_STATE_GENERATOR_H_

Powered by Google App Engine
This is Rietveld 408576698