GNUTLS_X509_PRIVKEY_IMPORT_OPENSSL(3)

πŸ’– NAME πŸ’–

gnutls_x509_privkey_import_openssl β€” it's an API function, bestie, and it lives in the gnutls manual (section 3, the library-calls one, iykyk).


✨ SYNOPSIS ✨

#include <gnutls/x509.h>

int gnutls_x509_privkey_import_openssl(gnutls_x509_privkey_t key, const
       gnutls_datum_t * data, const char * password);

πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_x509_privkey_t key β€” okay so this is where the parsed key goes. The data lives here after we're done with it, it's giving ✨output slot✨.
  • const gnutls_datum_t * data β€” the actual key, and it can be DER or PEM encoded. Either one, we're not picky 🫢
  • const char * password β€” the password that decrypts the key, but only if it's encrypted. No encryption, no password needed, no stress πŸ’…

🌸 DESCRIPTION 🌸

Okay so here's the vibe: this function takes your PEM encrypted key and converts it into the native gnutls_x509_privkey_t format. The result gets stored in key, like a lil gift 🎁

The password has to be in ASCII. And listen β€” if you don't hand over a password, or the one you give is straight-up wrong, you're getting GNUTLS_E_DECRYPTION_FAILED back. Not me, that's just the rules 😭

If the Certificate is PEM encoded (yes, the manpage says "Certificate", we're quoting it fr fr), it needs a header of "PRIVATE KEY" and it also needs the "DEK-Info" header. Both. No skipping 🚨


⭐ RETURNS ⭐

Slay moment: on success you get GNUTLS_E_SUCCESS (0). Anything else? That's a negative error value, so basically the function is giving you the ick in integer form πŸ’€


πŸ™ˆ REPORTING BUGS πŸ™ˆ

Found a bug? Don't be shy, 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. (Read it, respect it, it's iconic 🌈)


πŸ¦‹ 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/


k that's the whole page bestie, go import your keys and be the main character πŸ’œ

signing off from the gnutls manual β€” source/version gnutls 3.8.13, dated right there with the rest of the gnutls_x509_pri..._import_openssl(3) page πŸŽ€βœ¨ bye!!

πŸ“¦ where this page comes from