gnutls_pubkey_export(3)

πŸ’… gnutls_pubkey_export(3) β€” the gnutls girlies' guide

okay bestie, sit down, hydrate, because we're exporting public keys today and honestly? it's giving iconic. this one lives in the gnutls manual, section 3, and it's about getting your public key out of a gnutls_pubkey_t and into the world. no cap.


✨ NAME ✨

gnutls_pubkey_export β€” literally just an API function, that's the whole name, she's lowkey humble πŸŽ€


🌸 SYNOPSIS 🌸

#include <gnutls/abstract.h>

int gnutls_pubkey_export(gnutls_pubkey_t key, gnutls_x509_crt_fmt_t
format, void * output_data, size_t * output_data_size);

there she is. four arguments, one int return, zero drama (mostly). πŸ¦‹


🫢 ARGUMENTS 🫢

  • gnutls_pubkey_t key β€” holds the certificate. yes, the doc says "certificate" even though we're exporting a public key, that's just how the original rolls, i don't make the rules πŸ’€
  • gnutls_x509_crt_fmt_t format β€” the format of output params. one of PEM or DER. pick your fighter. ✨
  • void * output_data β€” will contain a certificate PEM or DER encoded. this is where the goods land. 🧚
  • size_t * output_data_size β€” holds the size of output_data (and will be replaced by the actual size of parameters). she comes in as your buffer size and leaves as the real size. main character energy, honestly. πŸ‘‘

πŸ’– DESCRIPTION πŸ’–

this function will export the public key to DER or PEM format. the contents of the exported data is the SubjectPublicKeyInfo X.509 structure. periodt. that's the whole shape of it.

now, the important part, listen up bestie: 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 tells you how much room she needs and then bounces. 😭

and if the structure is PEM encoded, it will have a header of "BEGIN CERTIFICATE". yes. even for a public key. i know. we don't question the ancestors. πŸ™ˆ


⭐ RETURNS ⭐

in case of failure a negative error code will be returned, and 0 on success. zero is the happy number. anything negative is a vibe check that you did not pass. πŸ’…


πŸŽ€ SINCE πŸŽ€

2.12.0 β€” she's been around, she's got history, she's a legacy icon fr fr. πŸ›οΈ


🌈 REPORTING BUGS 🌈

report bugs to <bugs@gnutls.org>.

home page: https://www.gnutls.org

not me asking you to file a good bug report, but like… please file a good bug report. the maintainers deserve it. 🫢

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, share it, remix 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/

iykyk. go read the Texinfo. it's the source of truth and she's thorough. πŸ“šβœ¨


and that's the whole page, bestie!! every flag, every argument, every error code, every copyright line β€” all present and accounted for. we ate and left zero crumbs. πŸ’…

sign-off time: this was the gnutls manual, page gnutls_pubkey_export(3), version 3.8.13 β€” stay exported, stay iconic, and remember: 0 means success and you are that girl. πŸŽ€πŸ’–πŸŒŸ

πŸ“¦ where this page comes from