#include "quiche/quic/core/crypto/certificate_view.h"
#include <algorithm>
#include <cstdint>
#include <istream>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "absl/strings/escaping.h"
#include "absl/strings/match.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_join.h"
#include "absl/strings/string_view.h"
#include "openssl/base.h"
#include "openssl/bytestring.h"
#include "openssl/digest.h"
#include "openssl/ec.h"
#include "openssl/ec_key.h"
#include "openssl/evp.h"
#include "openssl/nid.h"
#include "openssl/rsa.h"
#include "openssl/ssl.h"
#include "quiche/quic/core/crypto/boring_utils.h"
#include "quiche/quic/core/quic_time.h"
#include "quiche/quic/core/quic_types.h"
#include "quiche/quic/platform/api/quic_bug_tracker.h"
#include "quiche/quic/platform/api/quic_ip_address.h"
#include "quiche/quic/platform/api/quic_logging.h"
#include "quiche/common/platform/api/quiche_time_utils.h"
#include "quiche/common/quiche_data_reader.h"
#include "quiche/common/quiche_text_utils.h"
namespace quic {
namespace {
QuicheTextUtils;
constexpr uint8_t kX509Version[] = …;
constexpr uint8_t kSubjectAltNameOid[] = …;
PublicKeyType PublicKeyTypeFromKey(EVP_PKEY* public_key) { … }
}
PublicKeyType PublicKeyTypeFromSignatureAlgorithm(
uint16_t signature_algorithm) { … }
QUICHE_EXPORT QuicSignatureAlgorithmVector
SupportedSignatureAlgorithmsForQuic() { … }
namespace {
std::string AttributeNameToString(const CBS& oid_cbs) { … }
}
std::optional<std::string> X509NameAttributeToString(CBS input) { … }
namespace {
template <unsigned inner_tag, char separator,
std::optional<std::string> (*parser)(CBS)>
std::optional<std::string> ParseAndJoin(CBS input) { … }
std::optional<std::string> RelativeDistinguishedNameToString(CBS input) { … }
std::optional<std::string> DistinguishedNameToString(CBS input) { … }
}
std::string PublicKeyTypeToString(PublicKeyType type) { … }
std::optional<quic::QuicWallTime> ParseDerTime(unsigned tag,
absl::string_view payload) { … }
PemReadResult ReadNextPemMessage(std::istream* input) { … }
std::unique_ptr<CertificateView> CertificateView::ParseSingleCertificate(
absl::string_view certificate) { … }
bool CertificateView::ParseExtensions(CBS extensions) { … }
std::vector<std::string> CertificateView::LoadPemFromStream(
std::istream* input) { … }
PublicKeyType CertificateView::public_key_type() const { … }
bool CertificateView::ValidatePublicKeyParameters() { … }
bool CertificateView::VerifySignature(absl::string_view data,
absl::string_view signature,
uint16_t signature_algorithm) const { … }
std::optional<std::string> CertificateView::GetHumanReadableSubject() const { … }
std::unique_ptr<CertificatePrivateKey> CertificatePrivateKey::LoadFromDer(
absl::string_view private_key) { … }
std::unique_ptr<CertificatePrivateKey> CertificatePrivateKey::LoadPemFromStream(
std::istream* input) { … }
std::string CertificatePrivateKey::Sign(absl::string_view input,
uint16_t signature_algorithm) const { … }
bool CertificatePrivateKey::MatchesPublicKey(
const CertificateView& view) const { … }
bool CertificatePrivateKey::ValidForSignatureAlgorithm(
uint16_t signature_algorithm) const { … }
}