Repository navigation
CBasicConstraintsExtension
#include <certpp/x509/exts/bc.hpp> --- certpp::x509 --- implements IExtension
BasicConstraints (RFC 5280 4.2.1.9, OID 2.5.29.19): whether this certificate may act as a CA, and (only meaningful when it can) how many further intermediate CAs may follow it in a certification path.
-
static constexpr const char* OID = "2.5.29.19"--- id-ce-basicConstraints
Parses a BasicConstraints extension from its raw extnValue.
-
value--- The extension's raw extnValue bytes.
Whether this certificate may act as a CA. False (the DER default) if absent or malformed.
Returns: true if this certificate may act as a CA.
Whether pathLenConstraint() is present. Only meaningful when isCa() is true.
Returns: true if pathLenConstraint() is present.
The maximum number of non-self-issued intermediate CA certificates that may follow this one in a valid certification path. Only meaningful when hasPathLenConstraint() is true.
Returns: The path length constraint.
Decides whether a candidate issuer is allowed to sit where it does in a path. An absent pathLenConstraint means "any number of intermediates may follow", not zero -- so hasPathLenConstraint() must be consulted before pathLenConstraint() is believed.
// given: const CCert& caCert, size_t intermediatesBelow
auto bc = caCert.extension<CBasicConstraintsExtension>();
if (!bc || !bc->isCa()) {
return; // absent, or cA false: this certificate may not sign other certificates at all
}
if (!bc->hasPathLenConstraint()) {
return; // unconstrained depth; nothing further to check here
}
if (int64_t(intermediatesBelow) > bc->pathLenConstraint()) {
return; // too many non-self-issued intermediates follow this CA: the path is invalid
}
// caCert may certify the subordinate CA beneath itReference generated from certpp/x509/exts/bc.hpp at commit 0834b29 (v1.0.1). The header is authoritative --- if this page disagrees with it, the header is right and this page needs regenerating.