gnutls_certificate_get_x509_key(3)
π gnutls_certificate_get_x509_key(3) π
okay bestie, so this is a page out of the gnutls manual β yes, that gnutls β and it's all about yoinking an X.509 private key back out of your credentials. grab a strawberry milk, we're doing this π
β¨ NAME β¨
gnutls_certificate_get_x509_key β it's an API function, and it's giving "give me back my key" energy π
πΈ SYNOPSIS πΈ
#include <gnutls/gnutls.h>
int gnutls_certificate_get_x509_key(gnutls_certificate_credentials_t
res, unsigned index, gnutls_x509_privkey_t * key);
π ARGUMENTS π
gnutls_certificate_credentials_t resβ this is agnutls_certificate_credentials_ttype, bestie. it's the credentials holder, the lil container everything lives in π«Άunsigned indexβ the index of the key you wanna obtain. like which one. the number. the vibe check position π’gnutls_x509_privkey_t * keyβ location to store the key. you're handing it a place to put the key, and it will put the key there β¨
π DESCRIPTION π
So what does it do. It obtains an X.509 private key that has been stored in res β and no cap, that key had to get in there somehow, via one of these:
gnutls_certificate_set_x509_key()gnutls_certificate_set_key()gnutls_certificate_set_x509_key_file()gnutls_certificate_set_x509_key_file2()gnutls_certificate_set_x509_key_mem()gnutls_certificate_set_x509_key_mem2()
The returned key must be deallocated with gnutls_x509_privkey_deinit() when no longer needed. not optional, not "eh I'll get to it", fr fr β clean up after yourself π§
The index matches the return value of gnutls_certificate_set_x509_key() and friends functions, when the GNUTLS_CERTIFICATE_API_V2 flag is set. so like, the number you got back from the setter is the number you feed in here. iykyk π
π¨ and now the sad part: If there is no key with the given index,GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLEis returned. If the key with the given index is not a X.509 key,GNUTLS_E_INVALID_REQUESTis returned. π
β RETURNS β
GNUTLS_E_SUCCESS (0) on success β slay β or a negative error code. so if it's negative, that's a no from her π
π¦ SINCE π¦
3.4.0 β a classic, been iconic since way back π
π REPORTING BUGS π
Found a bug? Tell the gnutls 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. (yes that's the whole thing, verbatim, no edits, periodt β¨)
π₯ 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 gnutls manual, version 3.8.13, from the gnutls gnutls_certificate_get_x509_key(3) page β go forth, get your keys, deinit them after. 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