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

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

Issue 2793823002: Add unittests for certificate and file parsing. (Closed)
Patch Set: comments davidben Created 3 years, 8 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..4cacf38cacbf6abb20bc0915b2c38b6dda848f6c
--- /dev/null
+++ b/net/tools/transport_security_state_generator/input_file_parsers.h
@@ -0,0 +1,41 @@
+// 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 "base/strings/string_piece.h"
+#include "net/tools/transport_security_state_generator/transport_security_state_entry.h"
+
+namespace net {
+
+namespace transport_security_state {
+
+class Pinsets;
+
+// 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.
+//
+// More info on the format can be found in
+// net/http/transport_security_state_static.pins
+bool ParseCertificatesFile(base::StringPiece certs_input, Pinsets* pinsets);
+
+// Parses the |json| string and copies the items under the "entries" key to
+// |entries|, the pinsets under the "pinsets" key to |pinsets|, and the domain
+// IDs under the "domain_ids" key to |domain_ids|.
+//
+// More info on the format can be found in
+// net/http/transport_security_state_static.json
+bool ParseJSON(base::StringPiece json,
+ TransportSecurityStateEntries* entries,
+ Pinsets* pinsets,
+ DomainIDList* domain_ids);
+
+} // 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