gnutls_ocsp_resp_get_certs(3)

✨ gnutls_ocsp_resp_get_certs ✨

okay bestie, so this one lives in the gnutls manual, section 3 (that's the library-functions section, iykyk πŸ’…), and it's about pulling certificates out of an OCSP response. yes it's as niche as it sounds and yes it's iconic. let's go πŸ¦‹


🌸 NAME 🌸

gnutls_ocsp_resp_get_certs β€” it's an API function babes, that's the whole vibe πŸ’–


✨ SYNOPSIS ✨

#include <gnutls/ocsp.h>

int gnutls_ocsp_resp_get_certs(gnutls_ocsp_resp_const_t resp,
gnutls_x509_crt_t ** certs, size_t * ncerts);

πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_ocsp_resp_const_t resp β€” this one should contain a gnutls_ocsp_resp_t type. like, that's its whole job. hand it the response, bestie 🫢
  • gnutls_x509_crt_t ** certs β€” this is where a newly allocated array of gnutls_x509_crt_t certificates lands. fresh out the box, no cap ✨
  • size_t * ncerts β€” an output variable holding the number of allocated certs. the receipts, basically 🧾

πŸ’– DESCRIPTION πŸ’–

so what does this function actually do. it will extract the X.509 certificates found in the Basic OCSP Response. that's the tea. the certs output variable is gonna hold a newly allocated zero-terminated array stuffed with X.509 certificates πŸŽ€

now listen, this part matters. every single certificate in the array needs to be de-allocated with gnutls_x509_crt_deinit(), and the array itself must be freed using gnutls_free(). both. you don't get to skip one. that's the rules, periodt πŸ’…

okay and here's the cute flexible bit: both the certs and ncerts variables may be NULL. when that happens the function still works as normal, it just won't return the NULL-d information. so you can use it to get only the number of certificates, or to just get the certificate array without its size. choose your own adventure, bestie 🌈

ngl, if you pass NULL you're literally saying "no thank you, I don't want that info" and the function respects it. it's very unbothered of it 😌

⭐ RETURNS ⭐

On success, GNUTLS_E_SUCCESS (0) is returned. otherwise you get a negative error value and you're gonna have to deal with that. sorry bestie 😭


πŸ› REPORTING BUGS πŸ›

found a bug? report bugs to <bugs@gnutls.org>. πŸ’Œ

home page is right here: https://www.gnutls.org β€” go look, it's giving official πŸ›οΈ


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. so like, take it, remix it, just don't erase the credits 🫢✨


πŸ”₯ SEE ALSO πŸ”₯

the full documentation for gnutls is maintained as a Texinfo manual. and if the /usr/share/doc/gnutls/ directory does not contain the HTML form, then bestie you go visit:

https://www.gnutls.org/manual/

and that's the whole page, mwah πŸ’‹ this was gnutls_ocsp_resp_get_certs(3) from the gnutls manual, version 3.8.13, brought to you by the gnutls crew. go forth and de-allocate your certificates, bestie, I believe in you πŸ¦‹πŸ’–πŸŽ€

πŸ“¦ where this page comes from