gnutls_sec_param_to_pk_bits(3)

✨ gnutls_sec_param_to_pk_bits ✨

okay bestie, welcome to the gnutls manual, this one's a little API function called gnutls_sec_param_to_pk_bits and it's genuinely so useful, come sit with me πŸ’–


🌸 NAME 🌸

gnutls_sec_param_to_pk_bits β€” it's an API function, that's the vibe πŸ‘‘


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <gnutls/gnutls.h>

unsigned int gnutls_sec_param_to_pk_bits(gnutls_pk_algorithm_t algo,
gnutls_sec_param_t param);

πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_pk_algorithm_t algo β€” this is a public key algorithm, like the actual crypto system you're working with πŸ”
  • gnutls_sec_param_t param β€” and this one is a security parameter, i.e. the human-readable "how safe do I wanna be" number ✨

πŸ’… DESCRIPTION πŸ’…

so here's the situation bestie. when you're generating private and public key pairs, there's this genuinely difficult question lurking: which size of "bits" is the modulus gonna be in RSA, and what's the group size in DSA? 😭

and the "easy answer" everyone reaches for is 1024… which is also, and I cannot stress this enough, wrong. not me trusting the wrong number πŸ’€

that's literally what this function is for though: it takes a human understandable security parameter and converts it into an appropriate size for the specific algorithm you picked. no cap, it just does the math for you so you don't have to guess 🫢


⭐ RETURNS ⭐

The number of bits, or (0).


🌈 SINCE 🌈

2.12.0 β€” she's been iconic for a while now πŸ’œ


πŸ™ˆ REPORTING BUGS πŸ™ˆ

found a bug? don't be shy, tell the devs:


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.


πŸ”₯ 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 fr fr πŸ’– this was gnutls version 3.8.13, and yes the header and footer are literally the same function name twice β€” main character energy tbh. go forth and never hardcode 1024 again, mwah πŸŽ€βœ¨

πŸ“¦ where this page comes from