shishi_encrypt(3)
π shishi_encrypt β the "lock it up bestie" page π
okay so this is a page from the shishi manual, section 3 (that's the library-functions girlies π«Ά), and it's all about shishi_encrypt, which is literally just an API function. that's the whole NAME vibe. β¨
πΈ SYNOPSIS πΈ
#include <shishi.h>
int shishi_encrypt(Shishi * handle, Shishi_key * key, int keyusage, char
* in, size_t inlen, char ** out, size_t * outlen);
there she is. no cap, that's the whole signature. π
π ARGUMENTS π
Shishi * handleβ the shishi handle, and you get one of these fromshishi_init(). it's the main character of every shishi call, periodt.Shishi_key * keyβ the key you're encrypting with. the one doing the work. the MVP.int keyusageβ an integer that says what this key is being used to encrypt. context matters bestie.char * inβ the input array, aka the data you wanna encrypt. your little secret. πsize_t inlenβ how big that input array is. size matters (for buffers).char ** outβ the output array, freshly allocated, holding your new encrypted data. β¨size_t * outlenβ an output variable telling you how big that newly allocated output array is.
π¦ DESCRIPTION π¦
so. you've got data, you've got a key, and you want it encrypted. that's the whole plot. π
this encrypts data using the specified key. the key that actually gets used is derived using the key usage β but plot twist, if key usage is 0, then no key derivation happens at all. none. zero. skipped. π
the OUT buffer must be deallocated by the caller. that's on you, bestie. shishi is not cleaning up after you. π
the default IV is used here. if you need to change it up, go see shishi_encrypt_iv. and heads up: the next IV is lost β so if you need that, you want shishi_encrypt_ivupdate instead. choose wisely. π
now the part that lowkey trips everybody up: DECRYPT(ENCRYPT(data)) does not necessarily give you back data exactly. i know. i know. π some encryption types add pad to make the data fit into the block size of the encryption algorithm. and that pad is not guaranteed to look any particular way β although existing implementations often pad with the zero byte. so you might have to "frame" your data so that it's actually possible to figure out the original length after decryption. compare ASN.1 DER, which contains exactly that kind of information. iykyk. π§
β RETURN VALUE β
returns SHISHI_OK iff successful. that's the good ending. anything else? not the good ending. π
π REPORTING BUGS π
found a bug? don't be shy, report it to <bug-shishi@gnu.org>. π
- GNU Shishi home page:
http://www.gnu.org/software/shishi/ - General help using GNU software:
http://www.gnu.org/gethelp/
π COPYRIGHT π
Copyright Β© 2002-2022 Simon Josefsson.
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. iconic of them honestly. π«Ά
π SEE ALSO π
the full documentation for shishi is maintained as a Texinfo manual. if the info and shishi programs are properly installed at your site, this command
info shishi
should give you access to the complete manual. go read it, it's giving β¨ well-documented β¨.
and that's the page, bestie!! this was shishi_encrypt(3) from the shishi manual, version 1.0.3 β mwah, love that for us. πππ¦πΈπ
π¦ where this page comes from
- debian bookworm: shishi-doc 1.0.3-1 Β· GPL-3.0-or-later
- debian trixie: shishi-doc 1.0.3-5 Β· GPL-3.0-or-later
- nixos 26.05: shishi 1.0.3
- nixpkgs unstable: shishi 1.0.3
- ubuntu noble: shishi-doc 1.0.3-2.1build2 Β· GPL-3.0-or-later
- ubuntu questing: shishi-doc 1.0.3-5
- ubuntu resolute: shishi-doc 1.0.3-5build1 Β· GPL-3.0-or-later
- ubuntu stonking: shishi-doc 1.0.3-7 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms