gnutls_x509_privkey_export_pkcs8(3)
β¨ gnutls_x509_privkey_export_pkcs8 β¨
okay bestie so this is a page from the gnutls manual, and it's about gnutls_x509_privkey_export_pkcs8 β literally an API function, and yes it's giving "let me yeet your private key into a PKCS8 structure" energy π
π NAME π
gnutls_x509_privkey_export_pkcs8 β API function, no cap π
π¦ SYNOPSIS π¦
#include <gnutls/x509.h>
int gnutls_x509_privkey_export_pkcs8(gnutls_x509_privkey_t key,
gnutls_x509_crt_fmt_t format, const char * password, unsigned int flags,
void * output_data, size_t * output_data_size);
πΈ ARGUMENTS πΈ
gnutls_x509_privkey_t keyβ this is the key, babe. it holds it. the whole main character πgnutls_x509_crt_fmt_t formatβ the format of the output params. it's gonna be one ofPEMorDER, pick your fighter β¨const char * passwordβ the password that gets used to encrypt the key. protect it like it's your notes app πunsigned int flagsβ an ORed sequence ofgnutls_pkcs_encrypt_flags_t(so like, mash them together with ORs, iykyk) π§void * output_dataβ this is where the private key lands, PEM or DER encoded πsize_t * output_data_sizeβ holds the size ofoutput_data, and then gets replaced by the actual size of the parameters. glow up, honestly β¨
π DESCRIPTION π
so what this function does is export the private key to a PKCS8 structure. both RSA and DSA keys can be exported, no gatekeeping. for DSA keys we use PKCS 11 definitions, that's just the vibe. and if the flags do NOT specify the encryption cipher, then the default 3DES (PBES2) gets used. default behavior, periodt.
the password can be either ASCII or UTF-8 in the default PBES2 encryption schemas, or ASCII for the PKCS12 schemas. so like, know which one you're in bestie π
if the buffer you provided isn't long enough to hold the output, then *output_data_size gets updated and GNUTLS_E_SHORT_MEMORY_BUFFER will be returned. classic "not me underestimating the buffer size" moment π
if the structure is PEM encoded, it's gonna have a header of "BEGIN ENCRYPTED PRIVATE KEY" or "BEGIN PRIVATE KEY" if encryption isn't used. iconic headers, honestly π
β RETURNS β
in case of failure a negative error code gets returned, and 0 on success. that's it. that's the whole thing π«Ά
π REPORTING BUGS π
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. (slay, very generous of them 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 whole page, bestie π¦ this was gnutls_x509_privkey_export_pkcs8(3) from the gnutls manual, version 3.8.13 β go forth and export those keys responsibly, 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