GNUTLS_CERTIFICATE_SET_X509_SIMPLE_PKCS12_FILE(3)

✨ NAME ✨

gnutls_certificate_set_x509_simple_pkcs12_file β€” bestie, it's an API function πŸ’– (from the gnutls manual, if you were wondering who invited her)


🌸 SYNOPSIS 🌸

#include <gnutls/gnutls.h>

int
gnutls_certificate_set_x509_simple_pkcs12_file(gnutls_certificate_credentials_t
res, const char * pkcs12file, gnutls_x509_crt_fmt_t type, const char *
password);

πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_certificate_credentials_t res β€” okay so this is a gnutls_certificate_credentials_t type. she's the main character, everything gets loaded into her πŸ’…
  • const char * pkcs12file β€” the filename of the file containing the PKCS12 blob. yes queen, that's the one 🫢
  • gnutls_x509_crt_fmt_t type β€” this is PEM or DER, specifying the format of the pkcs12file. pick one, she can't read your mind πŸ™ˆ
  • const char * password β€” optional password used to decrypt the PKCS12 file, the bags and the keys πŸ”‘

πŸ’– DESCRIPTION πŸ’–

So basically, this function sets a certificate/private key pair and/or a CRL inside the gnutls_certificate_credentials_t type. And the way that you can call this function more than once?? iconic β€” like if multiple keys/certificates exist for the server, she's fine with it, she can hold several, no cap πŸ‘‘

PKCS12 files with a MAC, encrypted bags and PKCS 8 private keys are supported. slay. However (and this is the important part, bestie, don't skip it 😭), only password based security is supported, and it's the same password for all operations β€” one password, no pick-and-choose, periodt.

PKCS12 files can contain many keys and/or certificates, and this function will try to auto-detect, based on the key ID, which certificate and key pair to use. And if the PKCS12 file contains the issuer of the selected certificate, it gets appended to the certificate to form a chain. cute little family reunion fr fr 🌈

If more than one private key is stored in the PKCS12 file, then only one key will be read β€” and honestly it is undefined which one. so like, don't count on it, that's giving chaos πŸ’€

It is believed that the limitations of this function are acceptable for most usage, and that any more flexibility would introduce complexity that would make it harder to use this functionality at all. so like, she's keeping it simple on purpose, it's a design choice not a bug, iykyk ✨

Note that this function by default returns zero on success and a negative value on error. Since 3.5.6, when the flag GNUTLS_CERTIFICATE_API_V2 is set using gnutls_certificate_set_flags() it returns an index (greater or equal to zero). That index can be used by other functions to refer to the added key-pair. like a little name tag for your key-pair 🏷️


⭐ RETURNS ⭐

On success this function returns zero, and otherwise a negative value on error (see above for how to modify that behavior πŸ‘€).


πŸ¦‹ REPORTING BUGS πŸ¦‹

Found something cursed? Report bugs to <bugs@gnutls.org>. πŸ›

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/


and that's the whole page, bestie β€” no notes, ate and left no crumbs πŸŽ€βœ¨

this was brought to you by the gnutls manual, version 3.8.13 β€” mwah, take care of your certs πŸ’…πŸ’–

πŸ“¦ where this page comes from