gnutls_pem_base64_decode2(3)

πŸ’– gnutls_pem_base64_decode2 β€” bestie's guide to un-base64-ing your PEM ✨

okay so this page is from the gnutls manual (yes, the actual TLS library, she's iconic) and we're talking about gnutls_pem_base64_decode2(3). it's giving "I just want the raw bytes out of this PEM blob, please and thank you" πŸŽ€


🌸 NAME 🌸

gnutls_pem_base64_decode2 β€” literally just an API function, no cap πŸ’…


✨ SYNOPSIS ✨

#include <gnutls/gnutls.h>

int gnutls_pem_base64_decode2(const char * header, const gnutls_datum_t
* b64_data, gnutls_datum_t * result);

🫢 ARGUMENTS 🫢

  • const char * header β€” the PEM header you're hunting for, like CERTIFICATE for example. this is your vibe check label πŸ‘‘
  • const gnutls_datum_t * b64_data β€” this is where the encoded data lives, she's holding all the secrets πŸ’œ
  • gnutls_datum_t * result β€” the spot where the decoded data gets dropped off. main character energy goes here πŸ¦‹

πŸ’€ DESCRIPTION πŸ’€

so basically this function decodes the encoded data you handed it. the decoded data gets allocated, and then stored into result. it's giving "here's your stuff, freshly unpacked" 🎁

if the header you passed is non null, this function goes searching for "-----BEGIN header" and decodes only that part. if you don't give it a header, it just decodes the first PEM packet it finds. lowkey convenient 🌈

you should use gnutls_free() to free the returned data. do not ghost your memory management, bestie, she will come back for you 😭

also, fun history moment: prior to GnuTLS 3.4.0 this function was available under the name gnutls_pem_base64_decode_alloc(). there's a compatibility macro pointing to this function, so the old name still works. periodt ✨


⭐ RETURNS ⭐

on success, GNUTLS_E_SUCCESS (0) is returned. otherwise you get an error code back. slay when it's zero, sad when it's not πŸ™ˆ


πŸŽ€ SINCE πŸŽ€

3.4.0 β€” she's been around a minute, respect her πŸ‘‘


πŸ”₯ REPORTING BUGS πŸ”₯

found a bug? report it to <bugs@gnutls.org>. they want to hear from you fr fr πŸ’Œ

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


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/

okay that's the whole page, you ate that πŸ’– this was gnutls_pem_base64_decode2(3) from the gnutls manual, version 3.8.13. go decode something cute, and remember: free your data, love yourself 🫢✨

πŸ“¦ where this page comes from