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 a gnutls_x509_crt_t type. 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 be NULL. the value is 1 if the certificate CA flag is set, 0 otherwise. simple as that, fr fr.
  • int * pathlen β€” pointer to an output integer for the path length, and yes it may be NULL too. non-negative error codes mean there's a present pathLenConstraint field and that's the actual value β€” -1 means 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 basicConstraints extension, GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will 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 Β© 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