gnutls_x509_cr...sic_constraints(3)
π gnutls_x509_crt_get_basic_constraints π
okay bestie, so this one is a lil function from the gnutls manual (that's the whole manual, and yes we're in it) and it's genuinely one of the useful ones, no cap. it's an API function, it lives in the X.509 corner of the gnutls world, and it tells you whether a certificate is out here with main character energy (a CA) or just vibing as a regular cert. π
β¨ SYNOPSIS β¨
#include <gnutls/x509.h>
int gnutls_x509_crt_get_basic_constraints(gnutls_x509_crt_t cert,
unsigned int * critical, unsigned int * ca, int * pathlen);
π«Ά ARGUMENTS π«Ά
gnutls_x509_crt_t certβ this one should contain agnutls_x509_crt_ttype. like, that's the whole vibe of it. πunsigned int * criticalβ will be non-zero if the extension is marked as critical. so if it comes back non-zero, the cert is being loud about this extension, periodt.unsigned int * caβ pointer to an output integer that tells you the CA status. it may beNULL. the value is1if the certificate CA flag is set,0otherwise. simple as that, fr fr.int * pathlenβ pointer to an output integer for the path length, and yes it may beNULLtoo. non-negative error codes mean there's a presentpathLenConstraintfield and that's the actual value β-1means the field is justβ¦ not there. absent. ghosted. π
πΈ DESCRIPTION πΈ
This function will read the certificate's basic constraints, and return the certificate's CA status. π¦
It reads the basicConstraints X.509 extension (2.5.29.19). that's the one. iconic little extension number, iykyk.
β RETURNS β
So here's the tea:
- If the certificate is a CA, a positive value will be returned π
- Or
(0)if the certificate does not have the CA flag set - A negative error code may be returned in case of errors π
- And if the certificate does not contain the
basicConstraintsextension,GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEwill be returned β like, bestie, the data is simply not available, we checked, it's not there π
π₯ REPORTING BUGS π₯
Report bugs to <bugs@gnutls.org>.
Home page: https://www.gnutls.org
not me asking you to actually report the bugs instead of just complaining in the group chat π do it, they wanna know.
π COPYRIGHT π
Copyright Β© 2001-2023 Free Software Foundation, Inc., and others.
Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. β¨ (yes you can share it, just keep the receipts, that's the whole rule.)
π SEE ALSO π
The full documentation for gnutls is maintained as a Texinfo manual. If the /usr/share/doc/gnutls/ directory does not contain the HTML form, visit
https://www.gnutls.org/manual/
and that's the page, bestie π this was gnutls version 3.8.13, from the gnutls_x509_cr...sic_constraints(3) page (the title got truncated and honestly it's giving mystery, we love that for it). go read your certs, stay critical (the extension kind, not the attitude kind), and slay π
π
π¦ where this page comes from
- alpine 3.22: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.23: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.24: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- arch rolling: gnutls 3.8.13-3 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-devel 3.8.13-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-devel 3.8.13-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: gnutls-devel 3.8.13-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: gnutls-devel 3.8.13-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- ubuntu stonking: gnutls-doc 3.8.13-1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms