#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "net/tools/transport_security_state_generator/preloaded_state_generator.h"
#include <string>
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "net/tools/huffman_trie/huffman/huffman_builder.h"
#include "net/tools/transport_security_state_generator/cert_util.h"
#include "net/tools/transport_security_state_generator/spki_hash.h"
namespace net::transport_security_state {
namespace {
static const char kNewLine[] = …;
static const char kIndent[] = …;
std::string FormatSPKIName(const std::string& name) { … }
std::string FormatAcceptedKeyName(const std::string& name) { … }
std::string FormatRejectedKeyName(const std::string& name) { … }
std::string FormatReportURIName(const std::string& name) { … }
bool ReplaceTag(const std::string& name,
const std::string& value,
std::string* tpl) { … }
std::string FormatVectorAsArray(const std::vector<uint8_t>& bytes) { … }
std::string WritePinsetList(const std::string& name,
const std::vector<std::string>& pins) { … }
huffman_trie::HuffmanRepresentationTable ApproximateHuffman(
const TransportSecurityStateEntries& entries) { … }
}
PreloadedStateGenerator::PreloadedStateGenerator() = default;
PreloadedStateGenerator::~PreloadedStateGenerator() = default;
std::string PreloadedStateGenerator::Generate(
const std::string& preload_template,
const TransportSecurityStateEntries& entries,
const Pinsets& pinsets,
const base::Time& timestamp) { … }
void PreloadedStateGenerator::ProcessSPKIHashes(const Pinsets& pinset,
std::string* tpl) { … }
void PreloadedStateGenerator::ProcessPinsets(const Pinsets& pinset,
NameIDMap* pinset_map,
std::string* tpl) { … }
}