#include "net/cert/ct_serialization.h"
#include <string_view>
#include "base/logging.h"
#include "base/numerics/checked_math.h"
#include "crypto/sha2.h"
#include "net/cert/merkle_tree_leaf.h"
#include "net/cert/signed_certificate_timestamp.h"
#include "net/cert/signed_tree_head.h"
#include "third_party/boringssl/src/include/openssl/bytestring.h"
namespace net::ct {
namespace {
const size_t kLogIdLength = …;
enum SignatureType { … };
bool ReadSCTList(CBS* in, std::vector<std::string_view>* out) { … }
bool ConvertHashAlgorithm(unsigned in, DigitallySigned::HashAlgorithm* out) { … }
bool ConvertSignatureAlgorithm(
unsigned in,
DigitallySigned::SignatureAlgorithm* out) { … }
bool EncodeAsn1CertSignedEntry(const SignedEntryData& input, CBB* output) { … }
bool EncodePrecertSignedEntry(const SignedEntryData& input, CBB* output) { … }
}
bool EncodeDigitallySigned(const DigitallySigned& input, CBB* output_cbb) { … }
bool EncodeDigitallySigned(const DigitallySigned& input,
std::string* output) { … }
bool DecodeDigitallySigned(CBS* input, DigitallySigned* output) { … }
bool DecodeDigitallySigned(std::string_view* input, DigitallySigned* output) { … }
static bool EncodeSignedEntry(const SignedEntryData& input, CBB* output) { … }
bool EncodeSignedEntry(const SignedEntryData& input, std::string* output) { … }
static bool ReadTimeSinceEpoch(CBS* input, base::Time* output) { … }
static bool WriteTimeSinceEpoch(const base::Time& timestamp, CBB* output) { … }
bool EncodeTreeLeaf(const MerkleTreeLeaf& leaf, std::string* output) { … }
bool EncodeV1SCTSignedData(const base::Time& timestamp,
const std::string& serialized_log_entry,
const std::string& extensions,
std::string* output) { … }
bool EncodeTreeHeadSignature(const SignedTreeHead& signed_tree_head,
std::string* output) { … }
bool DecodeSCTList(std::string_view input,
std::vector<std::string_view>* output) { … }
bool DecodeSignedCertificateTimestamp(
std::string_view* input,
scoped_refptr<SignedCertificateTimestamp>* output) { … }
bool EncodeSignedCertificateTimestamp(
const scoped_refptr<ct::SignedCertificateTimestamp>& input,
std::string* output) { … }
bool EncodeSCTListForTesting(const std::vector<std::string>& scts,
std::string* output) { … }
}