shishi_encrypt_iv_etype(3)
β¨ shishi_encrypt_iv_etype β¨
okay bestie, so this is a page from the shishi manual β section 3, the library functions zone π
β and it's all about one very specific little function: shishi_encrypt_iv_etype. it's an API function, no cap. let's get into it π«Ά
πΈ SYNOPSIS πΈ
#include <shishi.h>
int shishi_encrypt_iv_etype(Shishi * handle, Shishi_key * key, int
keyusage, int32_t etype, const char * iv, size_t ivlen, const char * in,
size_t inlen, char ** out, size_t * outlen);
that's a LOT of parameters, i know. breathe. we're going through every single one π
π ARGUMENTS π
Shishi * handleβ the shishi handle, and you get it fromshishi_init(). it's like, your whole session's main character πShishi_key * keyβ the key you're encrypting with. the vibe. the secret. πint keyusageβ an integer saying what this key is being used to encrypt. yes, context matters β¨int32_t etypeβ an integer saying which cipher to use. pick your fighter πconst char * ivβ the input array holding the initialization vector.size_t ivlenβ how big that initialization vector input array is.const char * inβ the input array with the data you wanna encrypt πsize_t inlenβ how big that data input array is.char ** outβ the output array, and it's newly allocated encrypted data. so like, it's yours now, you have to deal with it.size_t * outlenβ the output variable holding the size of that newly allocated output array.
π DESCRIPTION π
so what does it DO. it encrypts data according to the encryption method you specified, using the initialization vector and the key you handed it. easy.
the key actually used is derived using the key usage. important!! and listen β if key usage is 0, then no key derivation is used. periodt.
the OUT buffer must be deallocated by the caller. yes, that's on you, bestie π
and the next IV is lost β so if you need it, go look at shishi_encrypt_ivupdate_etype instead. iykyk.
π¨ okay this next bit is the real tea, so pay attention: note thatDECRYPT(ENCRYPT(data))does not necessarily give you backdataexactly. some encryption types add pad to make the data fit into the block size of the encryption algorithm. and the pad isn't guaranteed to look any special way either β although existing implementations often pad with the zero byte. which means: you may have to "frame" your data, so it's actually possible to infer the original length after decryption. compare ASN.1 DER, which contains that kind of information. so yeah, no round-trip illusions here π
β RETURN VALUE β
returns SHISHI_OK iff successful. that's it. that's the whole condition. iconic.
π REPORTING BUGS π
found a bug? 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.
π 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 β¨π
and that's the whole page, bestie π this was shishi version 1.0.3, page shishi_encrypt_iv_etype(3) β slay, go encrypt something responsibly, and remember to free() your output ππ¦
π¦ 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