gnutls_pubkey_export2(3)

✨ gnutls_pubkey_export2 ✨

okay bestie, gather round, because this one lives in the gnutls manual (yes, the whole big Texinfo situation, we'll get there) and it is genuinely one of the cutest little utility functions in the abstract.h family. it's giving "let me hand you your public key in a tidy format" energy and honestly? obsessed. πŸŽ€


πŸ’– NAME πŸ’–

gnutls_pubkey_export2 β€” an API function πŸ¦‹


🌸 SYNOPSIS 🌸

#include <gnutls/abstract.h>

int gnutls_pubkey_export2(gnutls_pubkey_t key, gnutls_x509_crt_fmt_t
format, gnutls_datum_t * out);

like yes, it's a mouthful, but look at her, she's doing her best and she's slaying πŸ’…


🫢 ARGUMENTS 🫢

  • gnutls_pubkey_t key β€” holds the certificate. that's the thing you're exporting from, your little key holder, your main character ✨
  • gnutls_x509_crt_fmt_t format β€” the format of the output params, and it's one of PEM or DER. no in-between, no third option, pick a lane bestie 🌈
  • gnutls_datum_t * out β€” this is where the goods land. it will contain a certificate, PEM or DER encoded πŸŽ€

πŸ’œ DESCRIPTION πŸ’œ

so here's the tea: this function will export the public key to DER or PEM format. periodt.

and what's actually inside that exported data? it's the SubjectPublicKeyInfo X.509 structure. that's the whole vibe. no cap.

the output buffer is allocated using gnutls_malloc(), so like, that memory is yours to deal with (iykyk) πŸ’€

and if the structure is PEM encoded, it will have a header of "BEGIN CERTIFICATE". iconic header, honestly. πŸ”₯


⭐ RETURNS ⭐

in case of failure, a negative error code gets returned. on success you get 0. simple as that, bestie, no plot twists πŸ™ˆ


πŸ¦‹ SINCE πŸ¦‹

3.1.3 β€” an elder, but a beloved one πŸ‘‘


πŸ’Œ REPORTING BUGS πŸ’Œ

found something cursed? don't suffer in silence, tell the devs:


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: go off, share it, 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 was gnutls_pubkey_export2(3) from the gnutls manual, version 3.8.13 β€” mwah, take care, go export something pretty πŸ’…βœ¨πŸ«Ά

πŸ“¦ where this page comes from