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 agnutls_certificate_credentials_ttype. 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 thepkcs12file.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 flagGNUTLS_CERTIFICATE_API_V2is set usinggnutls_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:
- Report bugs to <bugs@gnutls.org>.
- Home page: https://www.gnutls.org
π COPYRIGHT π
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
- alpine 3.22: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.23: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.24: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- arch rolling: gnutls 3.8.13-3 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-devel 3.8.13-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-devel 3.8.13-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: gnutls-devel 3.8.13-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: gnutls-devel 3.8.13-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- ubuntu stonking: gnutls-doc 3.8.13-1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms