gnutls_hpke_encap(3)
π gnutls_hpke_encap(3) π
okay so bestie, welcome to the gnutls manual, and today's main character is gnutls_hpke_encap β literally an API function, and it's giving "sender side of HPKE, step one." no cap. π«Ά
β¨ NAME β¨
gnutls_hpke_encap β an API function. that's it, that's the name, slay. π
β¨ SYNOPSIS β¨
#include <gnutls/hpke.h>
int gnutls_hpke_encap(gnutls_hpke_context_t ctx, const gnutls_datum_t *
info, gnutls_datum_t * enc, const gnutls_pubkey_t receiver_pubkey, const
gnutls_privkey_t sender_privkey, const gnutls_datum_t * psk, const
gnutls_datum_t * psk_id);
look at those seven little parameters, all lined up like a friendship group pic πΈ
πΈ ARGUMENTS πΈ
gnutls_hpke_context_t ctxβ the HPKE context you're using for the encapsulation. this is your whole vibe, bestie, everything runs through it.const gnutls_datum_t * infoβ the application-specific information that gets folded into the key schedule. it's optional, so no pressure π§gnutls_datum_t * encβ a pointer to agnutls_datum_tstructure where the encapsulated key is gonna live. that's the lil present you're wrapping up for the receiver πconst gnutls_pubkey_t receiver_pubkeyβ the receiver's public key, used for the encapsulation. their key, your problem (affectionate).const gnutls_privkey_t sender_privkeyβ the sender's private key, needed for the AuthEncap operation. optional! only the auth girlies need this one πconst gnutls_datum_t * pskβ the pre-shared key. optional.const gnutls_datum_t * psk_idβ the pre-shared key identifier. also optional. it's giving "tag your psk" π·οΈ
π¦ DESCRIPTION π¦
so this function does the encapsulation operation of HPKE. it generates an encapsulated key (enc) that you send over to the receiver, and then they use it to derive the shared secret. teamwork, periodt. π€
it checks that the context is properly initialized and that the parameters you passed are valid. it also checks that the context is in the correct role β GNUTLS_HPKE_ROLE_SENDER β for encapsulation. if you're not the sender, bestie, it's not your moment. π
use this once per HPKE context, and before any calls to gnutls_hpke_seal(). one time. once. do not loop it, do not collect $200.
the function will allocate memory for enc, and the caller is responsible for freeing that memory using gnutls_free() when it's no longer needed. that's your memory now, you clean it up, i don't make the rules π
receiver_pubkey must be a valid public key that is compatible with the KEM algorithm specified in the HPKE context. compatible. KEM. yes. π₯
for GNUTLS_HPKE_MODE_AUTH or GNUTLS_HPKE_MODE_AUTH_PSK, sender_privkey must be a valid private key that can be used for authentication. and for GNUTLS_HPKE_MODE_PSK or GNUTLS_HPKE_MODE_AUTH_PSK, a pre-shared key (psk) and its identifier (psk_id) must be supplied. no psk, no party. π
β RETURNS β
0 on success, or a negative error code on failure. so like, zero is the slay outcome, negative is the "we don't talk about it" outcome π
π SINCE π
3.8.13 β she's new here and already iconic.
π REPORTING BUGS π
found a bug? report it to <bugs@gnutls.org>. do not gatekeep the bugs, bestie, that's not the energy. π
home page: https://www.gnutls.org
π 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 go forth and redistribute, royalty-free, just keep the receipts π§Ύβ¨
π 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/
that's the whole page, bestie. go encapsulate responsibly. π
gnutls 3.8.13 Β· gnutls_hpke_encap(3) β mwah, ily, bye π«ΆπΈ
π¦ 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