gnutls_privkey_generate(3)
π gnutls_privkey_generate(3) π
okay bestie, welcome to the gnutls corner of the man pages, this one lives in the gnutls manual and it's literally all about making brand new private keys out of β¨nothingβ¨
πΈ NAME πΈ
gnutls_privkey_generate β API function. that's it, that's the name, she's an API function and she's iconic π
π SYNOPSIS π
#include <gnutls/abstract.h>
int gnutls_privkey_generate(gnutls_privkey_t pkey, gnutls_pk_algorithm_t
algo, unsigned int bits, unsigned int flags);
look at her. four little arguments. so demure, so mindful π¦
π«Ά ARGUMENTS π«Ά
gnutls_privkey_t pkeyβ an initialized private key. yes babes, initialized first, she can't work with a blank slate, we talked about this πgnutls_pk_algorithm_t algoβ is one of the algorithms ingnutls_pk_algorithm_t. pick your fighter πunsigned int bitsβ the size of the parameters to generate. how much key do you want, bestie, because you're getting exactly that many bitsunsigned int flagsβ Must be zero or flags fromgnutls_privkey_flags_t. zero. or flags. no in-between π
π DESCRIPTION π
so this function will generate a random private key. random. fresh out the oven, no cap π₯ and note that this function must be called on an initialized private key β do not come to her with an uninitialized key, she will simply not π
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. very demure, very FIPS, very "my parameters have receipts" β¨ see gnutls_privkey_generate2() for more information.
π note that when generating an elliptic curve key, the curve can be substituted in the place of thebitsparameter using theGNUTLS_CURVE_TO_BITS()macro. the input to the macro is any curve fromgnutls_ecc_curve_t. so like, you don't have to count bits by hand, the macro does it for you, she's so helpful π§
for DSA keys, if the subgroup size needs to be specified check the GNUTLS_SUBGROUP_TO_BITS() macro. another macro, another slay π
it is recommended to do not set the number of bits directly, use gnutls_sec_param_to_pk_bits() instead . fr fr, let the security-parameter function pick your bits, she knows what she's doing π
see also gnutls_privkey_generate2(). yes she has a sequel, and yes the sequel ate π
β RETURNS β
on success, GNUTLS_E_SUCCESS (0) is returned, otherwise a negative error value. so 0 = we ate, negative = we did not eat π
π SINCE π
3.3.0 β she's been around since 3.3.0, a true veteran of the group chat, main character energy since day one π
πΈ REPORTING BUGS πΈ
report bugs to <bugs@gnutls.org>. home page: https://www.gnutls.org
(if you found a bug, tell them, they want to know, don't be shy bestie π«Ά)
π 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.
(so like, copy it, share it, remix it, just keep the copyright notice and this notice, 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/
go read the full thing, iykyk, it's giving β¨comprehensiveβ¨
and that's the whole page, bestie!! this was gnutls 3.8.13, signed, sealed, delivered by your favorite manpage girly π
mwah, go generate some keys 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