chromium/components/media_router/common/providers/cast/certificate/net_parsed_certificate.cc

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

#include "components/media_router/common/providers/cast/certificate/net_parsed_certificate.h"

#include "base/containers/contains.h"
#include "net/cert/time_conversions.h"
#include "net/cert/x509_util.h"
#include "third_party/boringssl/src/include/openssl/bytestring.h"
#include "third_party/boringssl/src/include/openssl/digest.h"
#include "third_party/boringssl/src/include/openssl/evp.h"
#include "third_party/boringssl/src/pki/input.h"
#include "third_party/boringssl/src/pki/parse_name.h"
#include "third_party/boringssl/src/pki/parse_values.h"

namespace openscreen::cast {

// static
ErrorOr<std::unique_ptr<ParsedCertificate>> ParsedCertificate::ParseFromDER(
    const std::vector<uint8_t>& der_cert) {}

}  // namespace openscreen::cast

namespace cast_certificate {

ErrorOr;
DateTime;
DigestAlgorithm;

namespace {

// Helper that extracts the Common Name from a certificate's subject field. On
// success |common_name| contains the text for the attribute (UTF-8, but for
// Cast device certs it should be ASCII).
bool GetCommonNameFromSubject(const bssl::der::Input& subject_tlv,
                              std::string* common_name) {}

}  // namespace

bssl::ParseCertificateOptions GetCertParsingOptions() {}

NetParsedCertificate::NetParsedCertificate(
    std::shared_ptr<const bssl::ParsedCertificate> cert)
    :{}

NetParsedCertificate::~NetParsedCertificate() = default;

ErrorOr<std::vector<uint8_t>> NetParsedCertificate::SerializeToDER(
    int front_spacing) const {}

ErrorOr<DateTime> NetParsedCertificate::GetNotBeforeTime() const {}

ErrorOr<DateTime> NetParsedCertificate::GetNotAfterTime() const {}

std::string NetParsedCertificate::GetCommonName() const {}

std::string NetParsedCertificate::GetSpkiTlv() const {}

ErrorOr<uint64_t> NetParsedCertificate::GetSerialNumber() const {}

bool NetParsedCertificate::VerifySignedData(
    DigestAlgorithm algorithm,
    const openscreen::ByteView& data,
    const openscreen::ByteView& signature) const {}

bool NetParsedCertificate::HasPolicyOid(const openscreen::ByteView& oid) const {}

void NetParsedCertificate::SetNotBeforeTimeForTesting(time_t not_before) {}

void NetParsedCertificate::SetNotAfterTimeForTesting(time_t not_after) {}

}  // namespace cast_certificate