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

Unified Diff: net/tools/transport_security_state_generator/input_file_parsers.h

Issue 2660793002: Add transport security state generator tests. (Closed)
Patch Set: export method for tests Created 3 years, 10 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/tools/transport_security_state_generator/input_file_parsers.h
diff --git a/net/tools/transport_security_state_generator/input_file_parsers.h b/net/tools/transport_security_state_generator/input_file_parsers.h
new file mode 100644
index 0000000000000000000000000000000000000000..ad2b32cf75e924e7c5fcba9203aabef976be6e84
--- /dev/null
+++ b/net/tools/transport_security_state_generator/input_file_parsers.h
@@ -0,0 +1,46 @@
+// Copyright 2017 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_TRANSPORT_SECURITY_STATE_INPUT_FILE_PARSERS_H_
+#define NET_TOOLS_TRANSPORT_SECURITY_STATE_INPUT_FILE_PARSERS_H_
+
+#include <string>
+
+#include "net/tools/transport_security_state_generator/transport_security_state_entry.h"
+
+namespace net {
+
+namespace transport_security_state {
+
+class Pinsets;
+
+// Extracts all entries, pinsets, and domain IDs from the JSON structure in
+// |json|. Returns true on success and populates |*entries|, |*pinsets|, and
+// |*domain_ids| with the corresponding values. Returns false on failure and
+// appends all errors to |*errors|.
+//
+// More info on the format can be found in
+// net/http/transport_security_state_static.json
+bool ParseJSON(const std::string& json,
+ TransportSecurityStateEntries* entries,
+ Pinsets* pinsets,
+ DomainIDList* domain_ids,
+ std::vector<std::string>* errors);
+
+// Extracts SPKI information from the preloaded pins file. The SPKI's can be
+// in the form of a PEM certificate, a PEM public key, or a BASE64 string.
+// Returns true on success and adds all pinsets to |*pinsets|. Returns false on
+// failure and appends all errors to |*errors|.
+//
+// More info on the format can be found in
+// net/http/transport_security_state_static.pins
+bool ParseCertificatesFile(const std::string& certs_input,
+ Pinsets* pinsets,
+ std::vector<std::string>* errors);
+
+} // namespace transport_security_state
+
+} // namespace net
+
+#endif // NET_TOOLS_TRANSPORT_SECURITY_STATE_INPUT_FILE_PARSERS_H_

Powered by Google App Engine
This is Rietveld 408576698