gnutls_aead_cipher_decrypt(3)

πŸ’– gnutls_aead_cipher_decrypt(3) πŸ’–

okay bestie, welcome to the gnutls manual, section 3 πŸŽ€ β€” yes, the library one, not the command-line one, don't @ me. this is where we decrypt AEAD stuff, and honestly? it's giving cryptography main character energy πŸ”₯


✨ NAME ✨

gnutls_aead_cipher_decrypt β€” API function πŸ‘‘

fr fr that's it, that's the name, she's an API function and she knows it πŸ’…


🌸 SYNOPSIS 🌸

#include <gnutls/crypto.h>

int gnutls_aead_cipher_decrypt(gnutls_aead_cipher_hd_t handle, const
void * nonce, size_t nonce_len, const void * auth, size_t auth_len,
size_t tag_size, const void * ctext, size_t ctext_len, void * ptext,
size_t * ptext_len);

like look at all those args. ten of them. she's high maintenance but she's worth it 😭


πŸ¦‹ ARGUMENTS πŸ¦‹

  • gnutls_aead_cipher_hd_t handle β€” it's a gnutls_aead_cipher_hd_t type. that's the vibe, that's the type, no notes πŸ’œ
  • const void * nonce β€” the nonce you wanna set ✨
  • size_t nonce_len β€” the length of the nonce, obviously, we're not guessing here πŸŽ€
  • const void * auth β€” additional data to be authenticated πŸ”
  • size_t auth_len β€” the length of the data (the auth data, iykyk)
  • size_t tag_size β€” the size of the tag to use β€” and listen, use zero for the default, she'll handle it πŸ’…
  • const void * ctext β€” the data to decrypt, and YES it includes the authentication tag, don't forget the tag bestie 😭
  • size_t ctext_len β€” the length of data to decrypt β€” this one includes the tag size too, matching the ctext vibe 🫢
  • void * ptext β€” the decrypted data goes here, this is the payoff 🌈
  • size_t * ptext_len β€” the length of decrypted data, and ngl this one's a lil extra: it initially must hold the maximum available size. so you set it on the way in, she updates it on the way out. it's giving input-output parameter, we love a dual-purpose queen πŸ‘‘

⭐ DESCRIPTION ⭐

so this function will decrypt the given data using the algorithm specified by the context. that's the whole thing. that's her job πŸ’–

This function must be provided the complete data to be decrypted, including the authentication tag. like, all of it. no half-sending. πŸ™ˆ

On several AEAD ciphers, the authentication tag is appended to the ciphertext β€” though this is not a general rule</>, so don't go assuming that's universal, bestie, some ciphers do their own thing 😭

And here's the part where she gets serious: this function will fail if the tag verification fails. periodt. no negotiation, no "well maybe it's fine", no vibe check passed β€” if the tag doesn't verify, we're done here πŸ’€


πŸ”₯ RETURNS πŸ”₯

Zero, or a negative error code on verification failure or other error.

so: 0 = slay, we ate ✨ negative = something went wrong, possibly the tag verification, possibly something else. check it. always check it. fr fr 🫢


🌈 SINCE 🌈

3.4.0 β€” she's been around a minute, an elder icon at this point πŸ‘‘


πŸ’Œ REPORTING BUGS πŸ’Œ

found a bug? not her fault, probably, but like, tell someone:

Report bugs 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.

(the legal girlies said share freely, just keep the receipts, and honestly? iconic 🫢)


🧚 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/

like, go read the whole thing, there's so much more where this came from πŸ’œ


and that's the page bestie!! 🌸 written from the gnutls manual, version 3.8.13, and this specific page is gnutls_aead_cipher_decrypt(3) β€” go decrypt something responsibly, verify your tags, and stay slay πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from