GNUTLS_SRP_SET_SERVER_FAKE_SALT_SEED(3)

πŸ’– gnutls_srp_set_server_fake_salt_seed(3) πŸ’–

okay bestie, so this one lives in the gnutls manual, and it's genuinely one of those lowkey-genius little functions that's just quietly out here protecting your users from being doxxed by username. no cap. let's get into it 🫢


✨ NAME ✨

gnutls_srp_set_server_fake_salt_seed β€” it's an API function, and it's the one that makes fake salts for fake users look exactly as real as the real ones. the way that it does that?? iconic. πŸ‘‘


🌸 SYNOPSIS 🌸

#include <gnutls/gnutls.h>

void
gnutls_srp_set_server_fake_salt_seed(gnutls_srp_server_credentials_t
cred, const gnutls_datum_t * seed, unsigned int salt_length);

πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_srp_server_credentials_t cred β€” bestie, this is a gnutls_srp_server_credentials_t type. that's it, that's the whole vibe. πŸ’…
  • const gnutls_datum_t * seed β€” this is the seed data. here's the tea: it only needs to be valid until the function returns, so don't stress about keeping it alive forever. and the size of the seed must be greater than zero. zero bytes? absolutely not, we don't do that here. 🚫
  • unsigned int salt_length β€” the length of the generated fake salts. so like, how long do you want your fake little salts to be. πŸ§‚

πŸ¦‹ DESCRIPTION πŸ¦‹

so this function sets the seed that's used to generate salts for invalid (non-existent) usernames. yep, fake users. we're generating fake credentials for people who literally don't exist and it's for security. obsessed. ✨

here's why, because this part is actually so smart: in order to prevent attackers from guessing valid usernames, when a user does not exist gnutls generates a salt and a verifier and proceeds with the protocol as usual. the authentication will ultimately fail, but the client cannot tell whether the username is valid (exists) or invalid. it's giving equal treatment, it's giving no information leaked, it's giving main character energy for your privacy. 🌈

now the caveat, and listen up because this matters: if an attacker learns the seed, given a salt (which is part of the handshake) which was generated when the seed was in use, it can tell whether or not the authentication failed because of an unknown username. so like... guard the seed. πŸ™ˆ

but chill, okay? this seed cannot be used to reveal application data or passwords. so it's a username-privacy thing, not a password-leak thing. important distinction, bestie. πŸ’œ

also, salt_length should represent the salt length your application uses. and heads up: generating fake salts longer than 20 bytes is not supported. 20 bytes is the ceiling. do not go past it. periodt. πŸ’€

by default the seed is a random value, different each time a gnutls_srp_server_credentials_t is allocated, and fake salts are 16 bytes long. so the defaults are already slaying, you only need to touch this if you have a specific reason. πŸŽ€


⭐ SINCE ⭐

3.3.0 β€” so it's been here a while, it's a seasoned queen. πŸ‘‘


πŸ’œ REPORTING BUGS πŸ’œ

found a bug? do not suffer in silence, bestie, 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. so like, go off, share it, just keep the notice. 🫢


🌈 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, you ate that πŸ’…

gnutls version 3.8.13, manual page gnutls_srp_set_..._fake_salt_seed(3) β€” mwah, go forth and generate your fake salts responsibly πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from