1 // Copyright 2017 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef NET_TOOLS_TRANSPORT_SECURITY_STATE_GENERATOR_INPUT_FILE_PARSERS_H_ 6 #define NET_TOOLS_TRANSPORT_SECURITY_STATE_GENERATOR_INPUT_FILE_PARSERS_H_ 7 8 #include "base/strings/string_piece.h" 9 #include "net/tools/transport_security_state_generator/transport_security_state_entry.h" 10 11 namespace base { 12 class Time; 13 } 14 15 namespace net::transport_security_state { 16 17 class Pinsets; 18 19 // Extracts SPKI information from the preloaded pins file. The SPKI's can be 20 // in the form of a PEM certificate, a PEM public key, or a BASE64 string. 21 // 22 // More info on the format can be found in 23 // net/http/transport_security_state_static.pins 24 bool ParseCertificatesFile(base::StringPiece certs_input, 25 Pinsets* pinsets, 26 base::Time* timestamp); 27 28 // Parses the |hsts_json| and |pins_json| strings; copies the items under the 29 // "entries" key to |entries| and the pinsets under the "pinsets" key to 30 // |pinsets|. 31 // 32 // More info on the format can be found in 33 // net/http/transport_security_state_static.json 34 bool ParseJSON(base::StringPiece hsts_json, 35 base::StringPiece pins_json, 36 TransportSecurityStateEntries* entries, 37 Pinsets* pinsets); 38 39 } // namespace net::transport_security_state 40 41 #endif // NET_TOOLS_TRANSPORT_SECURITY_STATE_GENERATOR_INPUT_FILE_PARSERS_H_ 42