#include "path_builder.h"
#include <cassert>
#include <memory>
#include <set>
#include <unordered_set>
#include <openssl/base.h>
#include <openssl/pki/verify_error.h>
#include <openssl/sha.h>
#include "cert_issuer_source.h"
#include "certificate_policies.h"
#include "common_cert_errors.h"
#include "parse_certificate.h"
#include "parse_name.h"
#include "parser.h"
#include "string_util.h"
#include "trust_store.h"
#include "verify_certificate_chain.h"
#include "verify_name_match.h"
BSSL_NAMESPACE_BEGIN
namespace {
CertIssuerSources;
std::string FingerPrintParsedCertificate(const bssl::ParsedCertificate *cert) { … }
std::string CertDebugString(const ParsedCertificate *cert) { … }
std::string PathDebugString(const ParsedCertificateList &certs) { … }
struct IssuerEntry { … };
enum KeyIdentifierMatch { … };
KeyIdentifierMatch CalculateKeyIdentifierMatch(
const ParsedCertificate *target, const ParsedCertificate *issuer) { … }
int TrustAndKeyIdentifierMatchToOrder(const ParsedCertificate *target,
const ParsedCertificate *issuer,
const CertificateTrust &issuer_trust) { … }
class CertIssuersIter { … };
CertIssuersIter::CertIssuersIter(
std::shared_ptr<const ParsedCertificate> in_cert,
CertIssuerSources *cert_issuer_sources, TrustStore *trust_store)
: … { … }
void CertIssuersIter::GetNextIssuer(IssuerEntry *out) { … }
void CertIssuersIter::AddIssuers(ParsedCertificateList new_issuers) { … }
void CertIssuersIter::DoAsyncIssuerQuery() { … }
void CertIssuersIter::SortRemainingIssuers() { … }
class CertIssuerIterPath { … };
}
const ParsedCertificate *CertPathBuilderResultPath::GetTrustedCert() const { … }
class CertPathIter { … };
CertPathIter::CertPathIter(std::shared_ptr<const ParsedCertificate> cert,
TrustStore *trust_store)
: … { … }
void CertPathIter::AddCertIssuerSource(CertIssuerSource *cert_issuer_source) { … }
bool CertPathIter::GetNextPath(ParsedCertificateList *out_certs,
CertificateTrust *out_last_cert_trust,
CertPathErrors *out_errors,
CertPathBuilderDelegate *delegate,
uint32_t *iteration_count,
const uint32_t max_iteration_count,
const uint32_t max_path_building_depth) { … }
CertPathBuilderResultPath::CertPathBuilderResultPath() = default;
CertPathBuilderResultPath::~CertPathBuilderResultPath() = default;
bool CertPathBuilderResultPath::IsValid() const { … }
VerifyError CertPathBuilderResultPath::GetVerifyError() const { … }
CertPathBuilder::Result::Result() = default;
CertPathBuilder::Result::Result(Result &&) = default;
CertPathBuilder::Result::~Result() = default;
CertPathBuilder::Result &CertPathBuilder::Result::operator=(Result &&) =
default;
bool CertPathBuilder::Result::HasValidPath() const { … }
bool CertPathBuilder::Result::AnyPathContainsError(CertErrorId error_id) const { … }
const VerifyError CertPathBuilder::Result::GetBestPathVerifyError() const { … }
const CertPathBuilderResultPath *CertPathBuilder::Result::GetBestValidPath()
const { … }
const CertPathBuilderResultPath *
CertPathBuilder::Result::GetBestPathPossiblyInvalid() const { … }
CertPathBuilder::CertPathBuilder(
std::shared_ptr<const ParsedCertificate> cert, TrustStore *trust_store,
CertPathBuilderDelegate *delegate, const der::GeneralizedTime &time,
KeyPurpose key_purpose, InitialExplicitPolicy initial_explicit_policy,
const std::set<der::Input> &user_initial_policy_set,
InitialPolicyMappingInhibit initial_policy_mapping_inhibit,
InitialAnyPolicyInhibit initial_any_policy_inhibit)
: … { … }
CertPathBuilder::~CertPathBuilder() = default;
void CertPathBuilder::AddCertIssuerSource(
CertIssuerSource *cert_issuer_source) { … }
void CertPathBuilder::SetIterationLimit(uint32_t limit) { … }
void CertPathBuilder::SetDepthLimit(uint32_t limit) { … }
void CertPathBuilder::SetValidPathLimit(size_t limit) { … }
void CertPathBuilder::SetExploreAllPaths(bool explore_all_paths) { … }
CertPathBuilder::Result CertPathBuilder::Run() { … }
void CertPathBuilder::AddResultPath(
std::unique_ptr<CertPathBuilderResultPath> result_path) { … }
BSSL_NAMESPACE_END