gnutls_cipher_encrypt3(3)
π gnutls_cipher_encrypt3(3) π
okay bestie, so this is a page from the gnutls manual, and we're talking about gnutls_cipher_encrypt3 β she's an API function, she encrypts stuff, and she's lowkey iconic. let's get into it π«Ά
β¨ NAME β¨
gnutls_cipher_encrypt3 β API function. yes that's it. that's the whole name. slay.
π¦ SYNOPSIS π¦
#include <gnutls/crypto.h>
int gnutls_cipher_encrypt3(gnutls_cipher_hd_t handle, const void *
ptext, size_t ptext_len, void * ctext, size_t * ctext_len, unsigned
flags);
there she is. six arguments. main character energy fr fr π
πΈ ARGUMENTS πΈ
gnutls_cipher_hd_t handleβ bestie this is agnutls_cipher_hd_ttype. that's the vibe. that's the handle.const void * ptextβ the data you wanna encrypt. the tea. the lore. πsize_t ptext_lenβ how long that data is, in case you were wondering.void * ctextβ where the encrypted data goes. the glow-up destination β¨size_t * ctext_lenβ the length of the encrypted data. and listen, this one's a little diva: initially it must hold the maximum available size. she needs to know how much room she's got before she starts. πunsigned flagsβ flags for padding. padding is the stuffing, the filler, the extra bits when things don't line up perfectly. iconic honestly.
π DESCRIPTION π
so this function will encrypt the given data using the algorithm specified by the context. periodt.
for block ciphers, ptext_len is typically a multiple of the block size. and if it's not? no worries, the caller can instruct the function to pad that last block according to flags. currently, the only available padding scheme is GNUTLS_CIPHER_PADDING_PKCS7. that's the only one on the menu, bestie. no substitutions. π
now here's the important part, the way that this works:
if ctext is not NULL, it must hold enough space to store the resulting cipher text. and if you wanna check what size you actually need? you can call this function with ctext set to NULL. when you do that, ctext_len will be updated without performing actual encryption. it's like a vibe check before the real thing, iykyk. π₯
no cap: setctexttoNULLfirst if you don't know your sizes. do not skip this step, she will not be nice about it. π
π RETURNS π
zero, or a negative error code on error. that's it. zero = we ate. negative = we did not. π
β SINCE β
3.7.7 β she's been around since 3.7.7, a true veteran of the game. π
π REPORTING BUGS π
found a bug? spill it to <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 like, take her, share her, just don't be weird about it. π
π₯ 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 the gnutls manual, version 3.8.13, and the page is gnutls_cipher_encrypt3(3). go encrypt something responsibly, drink water, and remember: check your ctext_len before you commit. 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