#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "components/media_router/common/providers/cast/certificate/net_trust_store.h"
#include <string_view>
#include "base/check.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/notreached.h"
#include "components/media_router/common/providers/cast/certificate/net_parsed_certificate.h"
#include "net/cert/x509_util.h"
#include "third_party/boringssl/src/pki/cert_issuer_source_static.h"
#include "third_party/boringssl/src/pki/common_cert_errors.h"
#include "third_party/boringssl/src/pki/parsed_certificate.h"
#include "third_party/boringssl/src/pki/path_builder.h"
#include "third_party/boringssl/src/pki/pem.h"
#include "third_party/boringssl/src/pki/simple_path_builder_delegate.h"
#include "third_party/openscreen/src/cast/common/public/trust_store.h"
namespace {
#include "components/media_router/common/providers/cast/certificate/cast_root_ca_cert_der-inc.h"
#include "components/media_router/common/providers/cast/certificate/eureka_root_ca_der-inc.h"
#include "components/media_router/common/providers/cast/certificate/cast_crl_root_ca_cert_der-inc.h"
}
namespace openscreen::cast {
std::unique_ptr<openscreen::cast::TrustStore> TrustStore::CreateInstanceForTest(
const std::vector<uint8_t>& trust_anchor_der) { … }
std::unique_ptr<openscreen::cast::TrustStore>
TrustStore::CreateInstanceFromPemFile(std::string_view file_path) { … }
std::unique_ptr<openscreen::cast::TrustStore> CastTrustStore::Create() { … }
std::unique_ptr<openscreen::cast::TrustStore> CastCRLTrustStore::Create() { … }
}
namespace cast_certificate {
namespace {
class CastPathBuilderDelegate : public bssl::SimplePathBuilderDelegate { … };
openscreen::Error::Code MapToCastError(
const bssl::CertPathBuilder::Result& result) { … }
}
NetTrustStore::NetTrustStore() = default;
NetTrustStore::~NetTrustStore() = default;
void NetTrustStore::AddAnchor(base::span<const uint8_t> data) { … }
openscreen::ErrorOr<NetTrustStore::CertificatePathResult>
NetTrustStore::FindCertificatePath(const std::vector<std::string>& der_certs,
const openscreen::cast::DateTime& time) { … }
}