Botan 3.13.0
Crypto and TLS for C&
Botan::Cert_Extension::NoRevocationAvailable Class Referencefinal

#include <x509_ext.h>

Inheritance diagram for Botan::Cert_Extension::NoRevocationAvailable:
Botan::Certificate_Extension

Public Member Functions

std::unique_ptr< Certificate_Extensioncopy () const override
 NoRevocationAvailable ()=default
OID oid_of () const override
void validate (const X509_Certificate &subject, const std::optional< X509_Certificate > &issuer, const std::vector< X509_Certificate > &cert_path, std::vector< std::set< Certificate_Status_Code > > &cert_status, size_t pos) const override

Static Public Member Functions

static OID static_oid ()

Detailed Description

No Revocation Available Extension

RFC 9608 Section 2

The noRevAvail extension, defined in [X.509-2019-TC2], allows a CA to indicate that no revocation information will be made available for this certificate.

This extension MUST NOT be present in CA public key certificates.

Conforming CAs MUST include this extension in certificates for which no revocation information will be published. When present, conforming CAs MUST mark this extension as non-critical.

Definition at line 828 of file x509_ext.h.

Constructor & Destructor Documentation

◆ NoRevocationAvailable()

Botan::Cert_Extension::NoRevocationAvailable::NoRevocationAvailable ( )
default

Member Function Documentation

◆ copy()

std::unique_ptr< Certificate_Extension > Botan::Cert_Extension::NoRevocationAvailable::copy ( ) const
inlineoverridevirtual

Make a copy of this extension

Returns
copy of this

Implements Botan::Certificate_Extension.

Definition at line 832 of file x509_ext.h.

832{ return std::make_unique<NoRevocationAvailable>(); }

◆ oid_of()

OID Botan::Cert_Extension::NoRevocationAvailable::oid_of ( ) const
inlineoverridevirtual

Return object identifier for this extension

Returns
OID representing this extension

Implements Botan::Certificate_Extension.

Definition at line 836 of file x509_ext.h.

836{ return static_oid(); }

References static_oid().

◆ static_oid()

OID Botan::Cert_Extension::NoRevocationAvailable::static_oid ( )
inlinestatic

Definition at line 834 of file x509_ext.h.

834{ return OID({2, 5, 29, 56}); }

Referenced by oid_of().

◆ validate()

void Botan::Cert_Extension::NoRevocationAvailable::validate ( const X509_Certificate & subject,
const std::optional< X509_Certificate > & issuer,
const std::vector< X509_Certificate > & cert_path,
std::vector< std::set< Certificate_Status_Code > > & cert_status,
size_t pos ) const
overridevirtual

Callback visited during path validation.

An extension can implement this callback to inspect the path during path validation.

If an error occurs during validation of this extension, an appropriate status code shall be added to cert_status.

Parameters
subjectSubject certificate that contains this extension
issuerIssuer certificate. nullopt for certificates with no available issuer (e.g. non self-signed trust anchors).
cert_pathCertificate path which is currently validated
cert_statusCertificate validation status codes for subject certificate
posPosition of subject certificate in cert_path

Reimplemented from Botan::Certificate_Extension.

Definition at line 2549 of file x509_ext.cpp.

2553 {
2554 // RFC 9608 Section 2:
2555 // This extension MUST NOT be present in CA public key certificates.
2556 //
2557 // RFC 9608 Section 3:
2558 // Certificates that include the noRevAvail extension MUST NOT include
2559 // certificate extensions that point to CRL repositories or provide
2560 // locations of OCSP responders.
2561 //
2562 // Additionally (and unusually) the requirements of RFC 9608 Section 3
2563 // are not just on issuing parties but also on verifiers:
2564 //
2565 // If any of the above are violated in a certificate, then the relying
2566 // party MUST consider the certificate invalid.
2567
2568 const Extensions& exts = subject.v3_extensions();
2569
2570 if(const auto* bc = exts.get_extension_object_as<Basic_Constraints>(); bc != nullptr && bc->is_ca()) {
2571 // RFC 9608 Section 3:
2572 // The certificate MUST NOT also include the basic constraints
2573 // certificate extension with the cA BOOLEAN set to TRUE
2574 cert_status.at(pos).insert(Certificate_Status_Code::NO_REV_AVAIL_INVALID_USE);
2575 }
2576
2577 // RFC 9608 Section 3:
2578 // The certificate MUST NOT also include the CRL Distribution Points
2579 // certificate extension
2580 if(exts.extension_set(CRL_Distribution_Points::static_oid())) {
2581 cert_status.at(pos).insert(Certificate_Status_Code::NO_REV_AVAIL_INVALID_USE);
2582 }
2583
2584 // RFC 9608 Section 3:
2585 // The certificate MUST NOT also include the Freshest CRL certificate
2586 // extension
2587 if(exts.extension_set(OID({2, 5, 29, 46}))) {
2588 cert_status.at(pos).insert(Certificate_Status_Code::NO_REV_AVAIL_INVALID_USE);
2589 }
2590
2591 // RFC 9608 Section 3:
2592 // The Authority Information Access certificate extension, if
2593 // present, MUST NOT include an id-ad-ocsp accessMethod
2594 //
2595 // Walk the raw AccessDescription list rather than the URI-only typed
2596 // accessor so a non-URI OCSP accessLocation also triggers the rejection.
2597 if(const auto* aia = exts.get_extension_object_as<Authority_Information_Access>(); aia != nullptr) {
2598 const OID id_ad_ocsp = OID::from_string("PKIX.OCSP");
2599 const bool has_ocsp = !aia->ocsp_responder_uris().empty() ||
2600 std::ranges::any_of(aia->access_descriptions(),
2601 [&](const auto& ad) { return ad.access_method() == id_ad_ocsp; });
2602 if(has_ocsp) {
2603 cert_status.at(pos).insert(Certificate_Status_Code::NO_REV_AVAIL_INVALID_USE);
2604 }
2605 }
2606}
static OID from_string(std::string_view str)
Definition asn1_oid.cpp:80

References Botan::Extensions::extension_set(), Botan::Certificate_Extension::Extensions, Botan::OID::from_string(), Botan::Extensions::get_extension_object_as(), Botan::Cert_Extension::Basic_Constraints::is_ca(), Botan::NO_REV_AVAIL_INVALID_USE, Botan::Cert_Extension::CRL_Distribution_Points::static_oid(), and Botan::X509_Certificate::v3_extensions().


The documentation for this class was generated from the following files: