gnutls_pkcs12_bag_set_privkey(3)

✨ gnutls_pkcs12_bag_set_privkey ✨

okay bestie, this one lives in the gnutls manual (section 3, the library-calls girlies πŸ’…), and it's genuinely one of the cuter little functions. no cap.


🌸 NAME 🌸

gnutls_pkcs12_bag_set_privkey β€” API function πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

#include <gnutls/pkcs12.h>

int gnutls_pkcs12_bag_set_privkey(gnutls_pkcs12_bag_t bag,
gnutls_x509_privkey_t privkey, const char * password, unsigned flags);

like. she takes a bag, a key, a password and some flags. iconic behavior honestly 🫢


πŸ¦‹ ARGUMENTS πŸ¦‹

  • gnutls_pkcs12_bag_t bag β€” the bag. yes literally. it's the bag. that's the whole description, she said what she said πŸ’€
  • gnutls_x509_privkey_t privkey β€” the private key that's getting copied in. not moved, copied. important!! πŸ”₯
  • const char * password β€” the password you're protecting the key with. and listen β€” it may be NULL, so don't panic if you don't have one, that's a whole valid mood ✨
  • unsigned flags β€” should be one of the gnutls_pkcs_encrypt_flags_t elements, bitwise or'd together. so like, you can stack them with | if you're feeling fancy πŸ‘‘

πŸ’– DESCRIPTION πŸ’–

this function will insert the given private key into the bag. that's it, that's the job πŸŽ€

but here's the tea β€” it's just a wrapper over gnutls_pkcs12_bag_set_data(). so if you already know that one, you already know her. she's not doing anything extra, she's just being convenient and cute about it πŸ’…


🌈 RETURNS 🌈

  • on success β†’ the index of the added bag. yay!! ⭐
  • on failure β†’ a negative value. and no, we don't love that, but at least you'll know 😭

πŸ™ˆ REPORTING BUGS πŸ™ˆ

found a bug? not her fault (probably) but tell the devs anyway, they wanna know:


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, share the love, 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, the Texinfo manual is lowkey the main character of documentation formats 🌸


and that's the whole page bestie!! this is from gnutls 3.8.13, the gnutls_pkcs12_bag_set_privkey(3) manual page πŸ’– go forth and bag those keys βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from