gnutls_x509_crt_export(3)

πŸ’– gnutls_x509_crt_export(3) πŸ’–

okay so bestie, welcome to the gnutls manual, and today's main character is gnutls_x509_crt_export β€” she's an API function and she's literally here to hand you your certificate in a cute little package. sit down, hydrate, let's go 🫢


✨ SYNOPSIS ✨

#include <gnutls/x509.h>

int gnutls_x509_crt_export(gnutls_x509_crt_t cert, gnutls_x509_crt_fmt_t
format, void * output_data, size_t * output_data_size);

that's the whole vibe. one function, four args, no drama πŸ’…


🌸 ARGUMENTS 🌸

  • gnutls_x509_crt_t cert β€” this one holds the certificate, she's the source of truth, the queen, the one we're exporting from πŸ‘‘
  • gnutls_x509_crt_fmt_t format β€” the format of output params. One of PEM or DER. pick your fighter, bestie, those are the only two ✨
  • void * output_data β€” will contain a certificate PEM or DER encoded. this is the lil bucket where your output goes πŸͺ£
  • size_t * output_data_size β€” holds the size of output_data (and will be replaced by the actual size of parameters). so she comes in holding a number and leaves holding a different number. glow-up fr fr πŸ’–

πŸ¦‹ DESCRIPTION πŸ¦‹

This function will export the certificate to DER or PEM format. that's it, that's the job, and she does it flawlessly no cap.

now, the important bit β€” the vibe check on your buffer: if the buffer provided is not long enough to hold the output, then *output_data_size is updated and GNUTLS_E_SHORT_MEMORY_BUFFER will be returned. so like… she's not gonna crash out, she's just gonna tell you "too small bestie, here's how much room I actually need" and hand the number back to you through that pointer. iconic behaviour honestly 😭

and if the structure is PEM encoded, it will have a header of "BEGIN CERTIFICATE" β€” you know the one, the classic. periodt. πŸŽ€


⭐ RETURNS ⭐

In case of failure a negative error code will be returned, and 0 on success. so if you see 0, we ate. if you see a negative number, something went sideways and we're investigating πŸ”πŸ’€


πŸ™ˆ REPORTING BUGS πŸ™ˆ

found a bug? not me gatekeeping the contact info:


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.

(translation: share her, remix her, 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 β€” no notes, she's perfect 🫢

mwah πŸ’‹ this was gnutls 3.8.13, page gnutls_x509_crt_export(3), brought to you by the gnutls manual. go forth and export responsibly πŸ’…βœ¨

πŸ“¦ where this page comes from