gnutls_certifi..._x509_key_file2(3)
β¨ gnutls_certifi..._x509_key_file2(3) β¨
okay bestie, gather round π this one lives in the gnutls manual, and it's literally the glow-up version of loading your cert + key combo. let's get into it π«Ά
πΈ NAME πΈ
gnutls_certificate_set_x509_key_file2 β it's an API function, bestie, and it's giving "load my certificate and my private key, pls and thank u" π
π SYNOPSIS π
#include <gnutls/gnutls.h>
int
gnutls_certificate_set_x509_key_file2(gnutls_certificate_credentials_t
res, const char * certfile, const char * keyfile, gnutls_x509_crt_fmt_t
type, const char * pass, unsigned int flags);
π¦ ARGUMENTS π¦
gnutls_certificate_credentials_t resβ it's agnutls_certificate_credentials_ttype, that's the whole vibe β¨const char * certfileβ a file holding the certificate list (path) for the private key you're pairing it with, either in PKCS7 format or just a list of certificates πconst char * keyfileβ a file with the private key inside π€«gnutls_x509_crt_fmt_t typeβ it'sPEMorDER, pick your fighter πconst char * passβ the password of the key πunsigned int flagsβ an ORed sequence ofgnutls_pkcs_encrypt_flags_tπ©
π DESCRIPTION π
So this function sets a certificate/private key pair inside the gnutls_certificate_credentials_t type. Iconic. And no cap, you can call it more than once β that's for when a server has multiple keys/certificates and it's serving looks π
For clients that need to send more than just their own end entity certificate β like, say, also an intermediate CA cert β then the certfile must contain the ordered certificate chain. ordered, bestie, don't be chaotic π
Also, heads up: the names in the certificate you provide will be considered when it's picking the right certificate to use, in case you've got multiple certificate/key pairs. it's a whole selection situation π
This function can also accept URLs at keyfile and certfile. In that case it'll use the private key and certificate that the URLs point to. The supported URLs are the ones indicated by gnutls_url_is_supported(), iykyk. And here's the tea: before GnuTLS 3.4.0, when a URL was specified, the pass part was ignored and a PIN callback had to be registered β but that is no longer the case in current releases. glow-up confirmed π
In case the certfile is provided as a PKCS 11 URL, then the certificate and its present issuers in the token get imported, which means it's forming the required trust chain π
β οΈ okay this part is important: if that function fails to load, the res structure is at an undefined state, and it must not be reused to load other keys or certificates. dead it. do not recycle. π
And another thing β by default this function 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. main character index behavior fr fr π
β 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 a bug? Report it 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. (respect the notice bestie, it's the rules π«Ά)
π 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 came out of gnutls version 3.8.13, and the page name is that iconic gnutls_certifi..._x509_key_file2(3) title you saw at the top. mwah, go forth and load your keypairs responsibly πβ¨
π¦ 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