gnutls_x509_privkey_import2(3)

πŸ’– gnutls_x509_privkey_import2(3) πŸ’–

okay bestie, sit down, we're reading the gnutls manual together and honestly? this one is a bop. it's from the gnutls manual pages, section 3, and it's about dragging a private key into the house and making it GnuTLS-native. let's go 🫢


✨ NAME ✨

gnutls_x509_privkey_import2 β€” it's an API function, bestie. that's it, that's the name, no notes πŸ’…


🌸 SYNOPSIS 🌸

#include <gnutls/x509.h>

int gnutls_x509_privkey_import2(gnutls_x509_privkey_t key, const
       gnutls_datum_t * data, gnutls_x509_crt_fmt_t format, const char *
       password, unsigned int flags);

look at her. five arguments, one int return, zero drama. iconic behavior πŸ’–


πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_x509_privkey_t key β€” this is where the parsed key is gonna live. the data goes here. the vibe check destination, if you will ✨
  • const gnutls_datum_t * data β€” the actual key, encoded as DER or PEM. she's the moment.
  • gnutls_x509_crt_fmt_t format β€” pick your fighter: one of DER or PEM πŸ¦‹
  • const char * password β€” a password. optional, so like, no pressure, but also don't forget it πŸ™ˆ
  • unsigned int flags β€” an ORed sequence of gnutls_pkcs_encrypt_flags_t. yes, ORed. stack them like bracelets πŸ’…

🌈 DESCRIPTION 🌈

so what does she DO. this function imports the given DER or PEM encoded key and converts it into the native gnutls_x509_privkey_t format β€” no matter what format it came in as. and the input format? auto-detected. she just knows. main character energy fr fr πŸ‘‘

the supported formats are:

  • basic unencrypted key
  • PKCS8
  • PKCS12
  • the openssl format

now. listen. if the key you handed over is encrypted but you gave no password? then GNUTLS_E_DECRYPTION_FAILED comes back at you. that's the error, that's the tea, that's what you get 🫠

and since GnuTLS 3.4.0, this function will utilize the PIN callbacks if any. so if you set those up, she'll use them. slay πŸ’–

⭐ RETURNS ⭐

on success, GNUTLS_E_SUCCESS (0) is returned. otherwise you get a negative error value. that's the whole vibe check: zero is good, negative is not πŸ”₯


πŸ’€ REPORTING BUGS πŸ’€

found a bug? don't suffer in silence, bestie. report bugs to <bugs@gnutls.org>.

home page: https://www.gnutls.org β€” go, be nosy 🌐


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 πŸ’œ


okay that's the whole page, you ate it, you understood it, I'm so proud of you πŸ₯Ή this was the gnutls manual, version 3.8.13, page gnutls_x509_privkey_import2(3). go import some keys responsibly, bestie πŸ’–πŸŽ€πŸ¦‹πŸŒΈβœ¨

πŸ“¦ where this page comes from