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 <string_view> 9 10 #include "net/tools/transport_security_state_generator/transport_security_state_entry.h" 11 12 namespace base { 13 class Time; 14 } 15 16 namespace net::transport_security_state { 17 18 class Pinsets; 19 20 // Extracts SPKI information from the preloaded pins file. The SPKI's can be 21 // in the form of a PEM certificate, a PEM public key, or a BASE64 string. 22 // 23 // More info on the format can be found in 24 // net/http/transport_security_state_static.pins 25 bool ParseCertificatesFile(std::string_view certs_input, 26 Pinsets* pinsets, 27 base::Time* timestamp); 28 29 // Parses the |hsts_json| and |pins_json| strings; copies the items under the 30 // "entries" key to |entries| and the pinsets under the "pinsets" key to 31 // |pinsets|. 32 // 33 // More info on the format can be found in 34 // net/http/transport_security_state_static.json 35 bool ParseJSON(std::string_view hsts_json, 36 std::string_view pins_json, 37 TransportSecurityStateEntries* entries, 38 Pinsets* pinsets); 39 40 } // namespace net::transport_security_state 41 42 #endif // NET_TOOLS_TRANSPORT_SECURITY_STATE_GENERATOR_INPUT_FILE_PARSERS_H_ 43