gnutls_hpke_decap(3)
π gnutls_hpke_decap π
okay bestie, this page is from the gnutls manual (section 3, the library-call girlies) and it's all about gnutls_hpke_decap β the API function that does HPKE decapsulation. grab a strawberry π and let's get into it.
β¨ NAME β¨
gnutls_hpke_decap β an API function, no cap
πΈ SYNOPSIS πΈ
#include <gnutls/hpke.h>
int gnutls_hpke_decap(gnutls_hpke_context_t ctx, const gnutls_datum_t *
info, const gnutls_datum_t * enc, const gnutls_privkey_t
receiver_privkey, const gnutls_pubkey_t sender_pubkey, const
gnutls_datum_t * psk, const gnutls_datum_t * psk_id);
π ARGUMENTS π
gnutls_hpke_context_t ctxβ the HPKE context you're decapsulating with, your main character β¨const gnutls_datum_t * infoβ the application-specific info that got baked into the key schedule. optional, so you can leave it outconst gnutls_datum_t * encβ a pointer to agnutls_datum_tholding the encapsulated key that the sender sent you π¬const gnutls_privkey_t receiver_privkeyβ the receiver's private key, aka your key, the one doing the decapsulation πconst gnutls_pubkey_t sender_pubkeyβ the sender's public key, only needed for the AuthDecap operation. also optionalconst gnutls_datum_t * pskβ the pre-shared key. optionalconst gnutls_datum_t * psk_idβ the pre-shared key identifier. optional too, she's flexible
π¦ DESCRIPTION π¦
so this function runs the decapsulation operation of HPKE. she takes the encapsulated key (enc) that came from the sender, pairs it with the receiver's private key, and derives the shared secret from them. then she takes that shared secret plus any application-specific info you handed her (info) and sets up all the necessary keys and nonces inside the HPKE context, so that all your later sealing and opening operations just work. iconic behavior fr fr π₯
β οΈ you get to call this function once per HPKE context, and it has to happen before any calls to gnutls_hpke_open(). no skipping the line, bestie.
enc should be the exact same encapsulated key that gnutls_hpke_encap() generated on the sender's side β like, literally the same one, don't freestyle it.
receiver_privkey has to be a valid private key that's compatible with the KEM algorithm specified in the HPKE context, and it has to correspond to the receiver's public key that was used during encapsulation. vibe check your key before you pass it in, ngl.
for GNUTLS_HPKE_MODE_AUTH or GNUTLS_HPKE_MODE_AUTH_PSK, sender_pubkey must be a valid public key that can be used for authentication. and for GNUTLS_HPKE_MODE_PSK or GNUTLS_HPKE_MODE_AUTH_PSK, you gotta supply a pre-shared key (psk) plus its identifier (psk_id). no psk, no service π
β RETURNS β
0 on success, or a negative error code on failure. slay when it's zero, cry when it's negative π
π SINCE π
3.8.13 β she's been here since then, periodt
π REPORTING BUGS π
found a bug? tell the girlies at <bugs@gnutls.org>.
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 yes, you may share her π
π§ 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!! this was gnutls_hpke_decap(3) from the gnutls manual, version 3.8.13 β ty for reading, mwah π«Άβ¨π
π¦ 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