gnutls_x509_privkey_export2(3)
π gnutls_x509_privkey_export2(3) β the gnutls girlies' guide π
okay so bestie, this one lives in the gnutls manual, and it's literally the glow-up for getting your private key OUT of the library and into a cute little buffer. it's giving "export my whole vibe." let's go π«Ά
β¨ NAME β¨
gnutls_x509_privkey_export2 β an API function, no cap
πΈ SYNOPSIS πΈ
#include <gnutls/x509.h>
int gnutls_x509_privkey_export2(gnutls_x509_privkey_t key,
gnutls_x509_crt_fmt_t format, gnutls_datum_t * out);
π ARGUMENTS π
gnutls_x509_privkey_t keyβ holds the key. she's the main character here, the whole reason we're gathered πgnutls_x509_crt_fmt_t formatβ the format of the output params, bestie. one ofPEMorDER. pick one, that's the vibe check.gnutls_datum_t * outβ will contain a private key, eitherPEMorDERencoded. this is where she lands β¨
π¦ DESCRIPTION π¦
so this function will export the private key to a PKCS1 structure for RSA or RSA-PSS keys, and an integer sequence for DSA keys. other key types? they get exported in PKCS8 form instead. iykyk π₯
the output buffer is allocated using gnutls_malloc(). yes queen, she mallocs for you.
lowkey important: it is recommended to use gnutls_x509_privkey_export2_pkcs8() instead of this function, when a consistent output format is required. like, if you want everything to match, go talk to pkcs8 instead. not me being the chaotic one π
β RETURNS β
on success, GNUTLS_E_SUCCESS (0) is returned. otherwise you get a negative error value π so like, check it, always.
since 3.1.3 β she's been iconic for a minute π
π REPORTING BUGS π
found a bug? don't be shy, tell the devs, they want the tea:
- 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. periodt. that's the whole legal vibe and she's generous fr fr.
π« 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 page, bestie π§ go forth and export responsibly. this was gnutls 3.8.13, page gnutls_x509_privkey_export2(3), signing off β stay slay, stay secure, and always free your buffers πβ¨πΈ
π¦ 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