gnutls_ocsp_resp_get_extension(3)

πŸ’… gnutls_ocsp_resp_get_extension β€” the gnutls manual, bestie edition ✨

okay so real talk, this one lives in the gnutls manual and it's about digging extension info out of an OCSP response. it's giving "detective but make it TLS" πŸ”πŸ’–


🌸 NAME 🌸

gnutls_ocsp_resp_get_extension β€” bestie, this is an API function 🫢


✨ SYNOPSIS ✨

#include <gnutls/ocsp.h>

int gnutls_ocsp_resp_get_extension(gnutls_ocsp_resp_const_t resp,
unsigned indx, gnutls_datum_t * oid, unsigned int * critical,
gnutls_datum_t * data);

like yes, that's the whole vibe. copy it exactly, don't freestyle it πŸ’€


πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_ocsp_resp_const_t resp β€” this one should contain a gnutls_ocsp_resp_t type. it's the response you're snooping through, no cap.
  • unsigned indx β€” tells the function which extension OID you want. use (0) to get the very first one. literally zero-indexed, iykyk πŸ‘‘
  • gnutls_datum_t * oid β€” this will hold a newly allocated buffer with the OID of the extension. it may be NULL if you're not about that life.
  • unsigned int * critical β€” an output variable with the critical flag, and yes, it may be NULL too.
  • gnutls_datum_t * data β€” will hold a newly allocated buffer with the extension data. also may be NULL. so many NULLs, so little time 😭

πŸ¦‹ DESCRIPTION πŸ¦‹

this function will return all the information about the requested extension in the OCSP response. the information you get back is the OID, the critical flag, and the data itself. the extension OID gets stored as a string. periodt. πŸ’…

any of oid, critical, and data may be NULL, which basically means the caller is not interested in getting that info back. so if you only want one thing, just say that. main character energy: only take what you need ✨

the caller needs to deallocate memory by calling gnutls_free() on oid->data and data->data. do NOT forget this one bestie, that's a memory leak and it's not cute πŸ™ˆ

since 3.7.0, oid->size does not account for the terminating null byte. noted, moving on. 🌈

πŸ’– RETURNS πŸ’–

on success, GNUTLS_E_SUCCESS (0) is returned. otherwise a negative error code comes back, which is giving "something went wrong" 😭

and if you've reached the last extension available, GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned. that's your sign to stop looping, bestie. you ate the whole list. πŸ“


πŸ› REPORTING BUGS πŸ›

found a bug? spill the tea, respectfully:


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, go off, just keep the receipts. 🫢


🌈 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 whole page, bestie. this one came straight from the gnutls manual, version 3.8.13. slay responsibly. πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from