gnutls_certifi...mple_pkcs12_mem(3)

πŸ’– gnutls_certifi...mple_pkcs12_mem(3) πŸ’–

okay bestie, this is a page from the gnutls manual, and we're talking about a whole API function today. buckle up πŸŽ€


✨ NAME ✨

gnutls_certificate_set_x509_simple_pkcs12_mem β€” it's an API function, bestie. that's the whole name. slay.


🌸 SYNOPSIS 🌸

#include <gnutls/gnutls.h>

int
gnutls_certificate_set_x509_simple_pkcs12_mem(gnutls_certificate_credentials_t
res, const gnutls_datum_t * p12blob, gnutls_x509_crt_fmt_t type, const
char * password);

πŸ¦‹ ARGUMENTS πŸ¦‹

  • gnutls_certificate_credentials_t res β€” this one is a gnutls_certificate_credentials_t type. it's the vibe container, the credentials holder, the main character ✨
  • const gnutls_datum_t * p12blob β€” the PKCS12 blob itself. the whole point. the moment πŸ’…
  • gnutls_x509_crt_fmt_t type β€” it's PEM or DER, and it describes the pkcs12file.
  • const char * password β€” optional password, used to decrypt the PKCS12 file, plus the bags and the keys. optional but like… probably needed, iykyk πŸ™ˆ

πŸ’œ DESCRIPTION πŸ’œ

so what does this function actually do, bestie? it sets a certificate/private key pair and/or a CRL inside the gnutls_certificate_credentials_t type. and get this β€” you can call it more than once, for when multiple keys/certificates exist for the server. it's giving "the more the merrier" 😌

Encrypted PKCS12 bags and PKCS8 private keys are supported, periodt. However β€” only password based security, and the same password for all operations, are supported. no mixing, no matching, one password to rule them all.

a PKCS12 file may 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 🫢

if more than one private key is stored in the PKCS12 file, then only one key will be read β€” and ngl, it is undefined which one. no cap. so like… don't rely on that, bestie πŸ’€

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 the devs said "this is fine" and honestly? valid.

heads up, bestie: this function by default returns zero on success and a negative value on error. but 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. glow up fr fr ✨

πŸ”₯ RETURNS πŸ”₯

on success, this function returns zero. otherwise it returns a negative value on error (see above for how that behavior can be modified πŸ‘€).


⭐ SINCE ⭐

2.8.0 β€” it's been here a minute, an icon, a legend πŸ‘‘


🌈 REPORTING BUGS 🌈

found a bug? don't suffer in silence, tell the girlies:


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.


πŸ’… 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!! this was from the gnutls manual, version 3.8.13 β€” gnutls_certifi...mple_pkcs12_mem(3), no date on this one so we're just shouting out the source and version. mwah πŸ’‹ πŸ¦‹πŸ’–βœ¨

πŸ“¦ where this page comes from