shishi_decrypt_iv(3)
π shishi_decrypt_iv β the vibe
okay bestie, welcome to shishi_decrypt_iv(3), one of the lil gems from the shishi manual. this is the API function that takes your scrambled lil bytes and β¨un-scramblesβ¨ them, as long as you brought the right key and the right initialization vector. no cap.
πΈ NAME πΈ
shishi_decrypt_iv β API function. that's it. that's the name. she does one thing and she does it well π
β¨ SYNOPSIS β¨
#include <shishi.h>
int shishi_decrypt_iv(Shishi * handle, Shishi_key * key, int keyusage,
const char * iv, size_t ivlen, const char * in, size_t inlen, char **
out, size_t * outlen);
look at her. nine arguments. she's high maintenance but she's worth it π
π«Ά ARGUMENTS π«Ά
here's the full roster, every single one, no skipping (i would never):
Shishi * handleβ your shishi handle, the one you got fromshishi_init(). she's the main character of the whole operation tbh.Shishi_key * keyβ the key you're decrypting with. the actual key used gets derived later, so don't get too attached to this exact one πint keyusageβ an integer saying what this key is decrypting. it's the whole reason the key derivation knows what to do.const char * ivβ input array holding the initialization vector.size_t ivlenβ size of that input array with the initialization vector. yes you have to tell her. she's not a mind reader.const char * inβ input array with the data to decrypt. the locked box π¦size_t inlenβ size of the input array with the data to decrypt.char ** outβ output array with the newly allocated decrypted data. newly allocated, bestie, remember that.size_t * outlenβ output variable that gets the size of that newly allocated output array.
π DESCRIPTION π
so what does she actually do? she decrypts your data using the specified initialization vector and key. simple. iconic.
but here's the tea π΅ β the key that actually gets used is derived using the key usage. so if keyusage is 0, then no key derivation is used at all. zero. none. just vibes and the raw key.
π¨ the OUT buffer must be deallocated by the caller. that's on you, bestie. she allocated it, you free it. that's the deal.
π also: the next IV is lost. gone. if you need it, go check out shishi_decrypt_ivupdate_etype instead. iykyk.
and now the part that lowkey ruins everyone's day: note that DECRYPT(ENCRYPT(data)) does not necessarily yield data exactly. not a perfect round trip, fr fr. some encryption types add pad to make the data fit into the block size of the encryption algorithm. and worse β the pad is not guaranteed to look in any special way, even though existing implementations often pad with the zero byte. so yeah. this means you may have to "frame" your data, so it's possible to infer the original length after decryption. compare ASN.1 DER, which contains such information. (ASN.1 DER said "i'll just tell you the length" and honestly? queen behavior π)
β RETURN VALUE β
returns SHISHI_OK iff successful. that's the whole story. if you got SHISHI_OK, you ate. π₯
π 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.
(very generous, very slay, we love a permissive license π«Ά)
π 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, the command
info shishi
should give you access to the complete manual. go read it, it's giving β¨knowledgeβ¨
and that's the whole page, bestie!! this was shishi_decrypt_iv(3) from the shishi manual, version 1.0.3 π go forth and decrypt responsibly, and don't forget to free that out buffer or i will find out π¦πΈπ§
π¦ 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