gnutls_hpke_seal(3)
π gnutls_hpke_seal π
okay bestie, welcome to the gnutls manual, this one's a whole function and she's serving. it's called gnutls_hpke_seal, and yeah it's an API function, no cap. let's get into it π«Ά
β¨ SYNOPSIS β¨
like, the vibe check first:
#include <gnutls/hpke.h>
int gnutls_hpke_seal(gnutls_hpke_context_t ctx, const gnutls_datum_t *
aad, const gnutls_datum_t * plaintext, gnutls_datum_t * ciphertext);
π ARGUMENTS π
four little besties walk into a function:
gnutls_hpke_context_t ctxβ the HPKE context you're gonna seal with. she's the main character here, everything happens inside her.const gnutls_datum_t * aadβ the associated data (AAD). she gets authenticated but NOT encrypted, so she's basically the friend who shows up to be a witness π she's visible, but she's verified.const gnutls_datum_t * plaintextβ the plaintext data, aka the actual tea β this is what gets encrypted and authenticated. the real one.gnutls_datum_t * ciphertextβ a pointer to agnutls_datum_tstructure where the resulting ciphertext will be stored. she's the empty seat waiting for the glow-up to arrive β¨
πΈ DESCRIPTION πΈ
so this function does the sealing operation of HPKE, periodt. it encrypts the plaintext and computes an authentication tag using the AEAD algorithm specified in the HPKE context. and the resulting ciphertext? it includes both the encrypted plaintext and the authentication tag. two-for-one, iconic π
you can call this function multiple times with the same HPKE context, she's reusable like that π¦ β BUT (and this is the important part, don't skip it) the encapsulation function gnutls_hpke_encap() must be called once before the first call to this function, to set up the necessary keys and nonces in the context. no encap, no seal, fr fr.
and every single call to this function will increment the sequence number in the context, which is what's used to derive unique nonces for each encryption operation. so like, each call gets her own lil nonce, no repeating, no reusing, we love a fresh nonce in this house π
β οΈ heads up bestie: the function will allocate memory for theciphertext, and you are responsible for freeing this memory usinggnutls_free()when it is no longer needed. don't leave her hanging, that's a leak and leaks are NOT the vibe π
π RETURNS π
0 on success, or a negative error code on failure. that's it. zero is the slay, negative is the "we don't talk about it" π
β SINCE β
3.8.13 β she's been here since 3.8.13, respect her journey π
π REPORTING BUGS π
found a bug? spill it to <bugs@gnutls.org> and they'll handle it.
home page is right here: 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 like, go off, 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, go visit:
https://www.gnutls.org/manual/
and that's the whole page, bestie!! this one came straight from gnutls 3.8.13, and yeah the manual page is literally called gnutls_hpke_seal(3). go seal some stuff, stay hydrated, free your memory with gnutls_free(), 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