gnutls_x509_privkey_generate(3)
π gnutls_x509_privkey_generate(3) β the gnutls manual, bestie edition π
okay so you're in the gnutls manual, section 3, and today's main character is gnutls_x509_privkey_generate β¨
π¦ NAME π¦
gnutls_x509_privkey_generate β API function. that's it, that's the name, she's an API function and she's serving π«Ά
β¨ SYNOPSIS β¨
#include <gnutls/x509.h>
int gnutls_x509_privkey_generate(gnutls_x509_privkey_t key,
gnutls_pk_algorithm_t algo, unsigned int bits, unsigned int flags);
πΈ ARGUMENTS πΈ
gnutls_x509_privkey_t keyβ an initialized key. like, she has to be initialized first, no shortcuts bestie πgnutls_pk_algorithm_t algoβ this is one of the algorithms ingnutls_pk_algorithm_t. pick your fighter πunsigned int bitsβ the size of the parameters to generate. the size, the parameters, we're generating them πunsigned int flagsβ Must be zero, or flags fromgnutls_privkey_flags_t. zero is always an option, just saying β¨
π DESCRIPTION π
so this function will generate a random private key. no cap, that's literally the whole job. and note β this function must be called on an initialized private key. not optional, not vibes-based, initialized. periodt π₯
the flag GNUTLS_PRIVKEY_FLAG_PROVABLE instructs the key generation process to use algorithms like Shawe-Taylor (from FIPS PUB186-4) which generate provable parameters out of a seed for RSA and DSA keys. fancy fancy. if you want more info on that, go check gnutls_x509_privkey_generate2(). she knows things π
also, note that when generating an elliptic curve key, the curve can be substituted in the place of the bits parameter using the GNUTLS_CURVE_TO_BITS() macro. the input to that macro is any curve from gnutls_ecc_curve_t. curve in, bits out, iconic behavior π
for DSA keys, if the subgroup size needs to be specified, check the GNUTLS_SUBGROUP_TO_BITS() macro. she's got you covered π
it is recommended to do not set the number ofbitsdirectly β usegnutls_sec_param_to_pk_bits()instead. like, don't do it manually bestie, there's a whole function for that π
see also gnutls_privkey_generate(), gnutls_x509_privkey_generate2(). the whole friend group π«Ά
β RETURNS β
on success, GNUTLS_E_SUCCESS (0) is returned. otherwise a negative error value. so if you see a negative number, that's the universe telling you something π
π 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 π
π 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/
okay that's the whole page bestie, you ate, go generate some keys π this was gnutls version 3.8.13, page gnutls_x509_privkey_generate(3), and the copyright vibes run 2001-2023. 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