gnutls_hpke_open(3)

πŸ’– gnutls_hpke_open(3) πŸ’–

okay bestie, welcome to the gnutls girlies' corner of the manual, where today's main character is gnutls_hpke_open(3) β€” the function that opens your HPKE ciphertext like it's a lil gift 🎁 no cap.


✨ NAME ✨

gnutls_hpke_open β€” API function. that's it, that's the name, slay πŸ’…


🌸 SYNOPSIS 🌸

#include <gnutls/hpke.h>

int gnutls_hpke_open(gnutls_hpke_context_t ctx, const gnutls_datum_t *
aad, const gnutls_datum_t * ciphertext, gnutls_datum_t * plaintext);

πŸ¦‹ ARGUMENTS πŸ¦‹

  • gnutls_hpke_context_t ctx β€” the HPKE context you're using to open stuff. it's the vibe, the whole setup, the moment.
  • const gnutls_datum_t * aad β€” the associated data (AAD) that got authenticated back when the sender was sealing. it's the receipts of the operation, fr fr.
  • const gnutls_datum_t * ciphertext β€” the ciphertext the sender sent you. the locked-up lil secret 🫢
  • gnutls_datum_t * plaintext β€” a pointer to a gnutls_datum_t struct where the resulting plaintext is gonna live. this is where the tea gets poured β˜•

πŸ’œ DESCRIPTION πŸ’œ

so basically this function does the opening operation of HPKE. it takes the ciphertext from the sender and uses the keys and nonces that were set up in the HPKE context (after decapsulation, bestie, after) to decrypt that ciphertext and verify the authentication tag. if the decryption and the authentication both go off without a hitch, the resulting plaintext gets stored in plaintext. πŸŽ€

and if the decryption or authentication fails?? the function securely erases any allocated plaintext and returns an error code. it's giving clean-up-on-the-way-out, iconic behavior honestly, no leftover mess πŸ’€

you can totally use this function multiple times with the same HPKE context, but heads up β€” the decapsulation function gnutls_hpke_decap() must be called once before the first call to this function. that's the entry fee, bestie, pay it once πŸ’…

aad should be the exact same AAD that was provided to gnutls_hpke_seal() on the sender's side. same AAD, same energy.

ciphertext should be the same ciphertext that gnutls_hpke_seal() generated on the sender's side. like, the literal same one. don't switch it up on me πŸ™ˆ

and yes, the function will allocate memory for the plaintext, so the caller (that's you, babe) is responsible for freeing that memory using gnutls_free() when it's no longer needed. don't leave it hanging, that's a memory leak and memory leaks are NOT the vibe 😭


⭐ RETURNS ⭐

0 on success, or a negative error code on failure. simple as that, periodt.


🌈 SINCE 🌈

3.8.13 β€” she's been here since then and she's been eating ever since πŸ‘‘


πŸ™ˆ REPORTING BUGS πŸ™ˆ

found a bug? don't be shy, report it to <bugs@gnutls.org>.

home page: https://www.gnutls.org


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. free as in freedom, and also free as in free ✨


πŸ”₯ 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_open(3) from the gnutls manual, version 3.8.13, dated 3.8.13. go forth and decrypt responsibly πŸ«ΆπŸ’–

πŸ“¦ where this page comes from