gnutls_privkey_derive_secret(3)
β¨ gnutls_privkey_derive_secret β¨
okay bestie, welcome to the gnutls manual, page for gnutls_privkey_derive_secret π this is the one where you take your private key and someone's public key and they do a little cryptographic handshake moment and a shared secret falls out. it's giving β¨collaborationβ¨. anyway sit down, hydrate, let's go π«Ά
πΈ NAME πΈ
gnutls_privkey_derive_secret β it's an API function, no cap π
π SYNOPSIS π
#include <gnutls/abstract.h>
int gnutls_privkey_derive_secret(gnutls_privkey_t privkey,
gnutls_pubkey_t pubkey, const gnutls_datum_t * nonce, gnutls_datum_t *
secret, unsigned int flags);
literally copy that exactly, don't get creative with it π
π¦ ARGUMENTS π¦
gnutls_privkey_t privkeyβ your private key, the one of typegnutls_privkey_t. this is yours, guard it with your life fr fr πgnutls_pubkey_t pubkeyβ the peer's public key, of typegnutls_pubkey_t. that's the other person in this little duet π«Άconst gnutls_datum_t * nonceβ an optional nonce value. optional!! so you can pass one, you don't have to. it's giving "bring a plus-one if you want" πgnutls_datum_t * secretβ this is where the shared secret gets stored. it's an out-param, so it's coming back to you filled in β¨unsigned int flagsβ must be zero. that's it. zero. nothing else. do not pass go, do not pass anything else π«
π DESCRIPTION π
so the whole point of this function: it calculates a shared secret from our privkey and the peer's pubkey π and the result gets stored in secret.
now listen, important part, don't skip this β the data member of secret should be freed after use using gnutls_free(). yes, you have to clean up after yourself. it's giving "wash your own dishes" energy π
also, both privkey and pubkey must be backed by the X.509 keys. not optional, that's the rule, the vibe check has been performed π
β RETURNS β
- On success,
GNUTLS_E_SUCCESS(0) is returned π - Otherwise you get a negative error value π
that's the whole story. zero = slay, negative = not slay.
π SINCE π
3.8.2 β been around since then, an icon, an OG π§
π REPORTING BUGS π
found a bug? don't suffer in silence bestie, tell the devs:
- Report bugs to <bugs@gnutls.org>.
- Home page: https://www.gnutls.org
they want to hear from you fr fr π
π 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 yes, you may absolutely redistribute this, they're being generous and we love that for 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/
iykyk, the real lore lives over there π
and that's the page!! this was gnutls version 3.8.13, and we are so done here π
β¨ stay encrypted, stay iconic, bye bestie ππ¦
π¦ 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