chromium/net/test/ct_test_util.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "net/test/ct_test_util.h"

#include <stdint.h>
#include <string.h>

#include <string_view>
#include <vector>

#include "base/base64.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "net/base/hex_utils.h"
#include "net/cert/ct_serialization.h"
#include "net/cert/merkle_tree_leaf.h"
#include "net/cert/signed_tree_head.h"
#include "net/cert/x509_certificate.h"

namespace net::ct {

namespace {

// The following test vectors are from
// http://code.google.com/p/certificate-transparency

const char kDefaultDerCert[] =;

const char kDefaultIssuerKeyHash[] =;

const char kDefaultDerTbsCert[] =;

const char kDefaultExtensions[] =; // "foobar"

const char kTestDigitallySigned[] =;

const char kTestSignedCertificateTimestamp[] =;

const char kEcP256PublicKey[] =;

const char kTestKeyId[] =;

const int64_t kTestTimestamp =1396877277237);

const char kTestSCTSignatureData[] =;

const char kTestSCTPrecertSignatureData[] =;

// A well-formed OCSP response with fake SCT contents. Does not come from
// http://code.google.com/p/certificate-transparency, does not pertain to any
// of the test certs here, and is only used to test extracting the extension
// contents from the response.
const char kFakeOCSPResponse[] =
    ;

const char kFakeOCSPResponseCert[] =;

const char kFakeOCSPResponseIssuerCert[] =;

const char kFakeOCSPExtensionValue[] =;  // "test"

// For the sample STH
const char kSampleSTHSHA256RootHash[] =;
const char kSampleSTHTreeHeadSignature[] =;
size_t kSampleSTHTreeSize =;

}  // namespace

void GetX509CertSignedEntry(SignedEntryData* entry) {}

void GetX509CertTreeLeaf(MerkleTreeLeaf* tree_leaf) {}

std::string GetDerEncodedX509Cert() {}

void GetPrecertSignedEntry(SignedEntryData* entry) {}

void GetPrecertTreeLeaf(MerkleTreeLeaf* tree_leaf) {}

std::string GetTestDigitallySigned() {}

std::string GetTestSignedCertificateTimestamp() {}

std::string GetTestPublicKey() {}

std::string GetTestPublicKeyId() {}

void GetX509CertSCT(scoped_refptr<SignedCertificateTimestamp>* sct_ref) {}

void GetPrecertSCT(scoped_refptr<SignedCertificateTimestamp>* sct_ref) {}

std::string GetDefaultIssuerKeyHash() {}

std::string GetDerEncodedFakeOCSPResponse() {}

std::string GetFakeOCSPExtensionValue() {}

std::string GetDerEncodedFakeOCSPResponseCert() {}

std::string GetDerEncodedFakeOCSPResponseIssuerCert() {}

// A sample, valid STH
bool GetSampleSignedTreeHead(SignedTreeHead* sth) {}

bool GetSampleEmptySignedTreeHead(SignedTreeHead* sth) {}

bool GetBadEmptySignedTreeHead(SignedTreeHead* sth) {}

std::string GetSampleSTHSHA256RootHash() {}

std::string GetSampleSTHTreeHeadSignature() {}

bool GetSampleSTHTreeHeadDecodedSignature(DigitallySigned* signature) {}

std::string GetSampleSTHAsJson() {}

std::string CreateSignedTreeHeadJsonString(size_t tree_size,
                                           int64_t timestamp,
                                           std::string sha256_root_hash,
                                           std::string tree_head_signature) {}

std::string CreateConsistencyProofJsonString(
    const std::vector<std::string>& raw_nodes) {}

std::string GetSCTListForTesting() {}

std::string GetSCTListWithInvalidSCT() {}

bool CheckForSingleVerifiedSCTInResult(
    const SignedCertificateTimestampAndStatusList& scts,
    const std::string& log_description) {}

bool CheckForSCTOrigin(const SignedCertificateTimestampAndStatusList& scts,
                       ct::SignedCertificateTimestamp::Origin origin) {}

}  // namespace net::ct