gnutls_x509_privkey_import(3)

πŸ’– NAME πŸ’–

gnutls_x509_privkey_import β€” okay bestie, this is the API function that takes your DER-or-PEM private key and makes it ✨native✨


🌸 SYNOPSIS 🌸

#include <gnutls/x509.h>

int gnutls_x509_privkey_import(gnutls_x509_privkey_t key, const
gnutls_datum_t * data, gnutls_x509_crt_fmt_t format);

πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_x509_privkey_t key β€” the place where the parsed key gets stored, like the little ✨slot✨ where your data is gonna live
  • const gnutls_datum_t * data β€” the DER or PEM encoded certificate (yes, fr fr, that's literally what the original says, we are not editing the lore)
  • gnutls_x509_crt_fmt_t format β€” pick your fighter: one of DER or PEM

πŸ¦‹ DESCRIPTION πŸ¦‹

So the way this works: you hand it a DER or PEM encoded key, and this function converts it into the native gnutls_x509_privkey_t format. The glow-up output gets stored in key. πŸ’…

If your key is PEM encoded, it should have a header containing "PRIVATE KEY". And listen β€” no cap β€” this function falls back to PKCS 8 decoding without password if the default format fails to import. Iconic behaviour honestly. πŸ™ˆ


⭐ RETURNS ⭐

On success you get GNUTLS_E_SUCCESS (0) back, and it's giving main character energy. Otherwise you get a negative error value, which is your cue to go fix something. 😭


πŸ’€ REPORTING BUGS πŸ’€

Found a bug? Not you being the detective πŸ” β€” report it to <bugs@gnutls.org>.

Home page is right here: 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 go forth and share, legally, periodt. 🫢


🌈 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/

That's the whole page, bestie β€” gnutls_x509_privkey_import, manual gnutls, version 3.8.13. Slay, go import some keys. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from