gnutls_dh_params_generate2(3)

✨ gnutls_dh_params_generate2(3) ✨

okay bestie, welcome to the gnutls manual πŸ’– this one's from the gnutls manual, and we're diving into gnutls_dh_params_generate2 β€” yes it's an API function, yes it's important, let's get into it 🫢


🌸 NAME 🌸

gnutls_dh_params_generate2 β€” it's an API function, girlie. that's the whole vibe πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <gnutls/gnutls.h>

int gnutls_dh_params_generate2(gnutls_dh_params_t dparams, unsigned int
bits);

πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_dh_params_t dparams β€” the parameters, babes. that's the thing you're filling in ✨
  • unsigned int bits β€” literally the prime's number of bits πŸ”’

πŸ’œ DESCRIPTION πŸ’œ

so what does this actually do? it generates a brand new pair of prime and generator for use in the Diffie-Hellman key exchange. and like… heads up: this may take a long time. not a little while, not "go grab a snack" β€” a long time, fr fr 😭

lowkey important: it is recommended not to set the number of bits directly, but to use gnutls_sec_param_to_pk_bits() instead. do that. please. πŸ₯Ί

also, and this is the part people miss: the DH parameters are only useful to servers. since clients use the parameters sent by the server, it's literally of no use to call this on the client side. client-side girlies, this is not your moment πŸ™ˆ

the parameters generated are of the DSA form. it's also possible to generate provable parameters (following the Shawe-Taylor algorithm) by using gnutls_x509_privkey_generate2() with the DSA option and the GNUTLS_PRIVKEY_FLAG_PROVABLE flag set. those can then be imported with gnutls_dh_params_import_dsa(). iconic little workflow, no cap ✨

and the big one:

it is no longer recommended for applications to generate parameters. see the "Parameter generation" section in the manual. πŸ‘‘

🌈 RETURNS 🌈

on success, GNUTLS_E_SUCCESS (0) is returned πŸŽ‰ otherwise a negative error code is returned πŸ’€ (cry about it, then read the error code).


πŸ› REPORTING BUGS πŸ›

found a bug? report it to <bugs@gnutls.org> πŸ“§

home page: https://www.gnutls.org 🌐


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, honestly πŸ’…


πŸ”₯ 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 that 🫢 this was gnutls version 3.8.13, page gnutls_dh_params_generate2(3) β€” go forth and generate responsibly (or, like, don't, because it's no longer recommended 😌). mwah πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from