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_ |