shishi_encrypt_etype(3)
β¨ shishi_encrypt_etype β the glow-up encryption function β¨
okay bestie, gather round, because we're looking at a page from shishi, section 3 of the manual (that's the library-functions girlies, not the shell-command ones π
). This one's called shishi_encrypt_etype, and it's literally just "encrypt my data please, but let me pick the cipher" energy. No cap.
πΈ SYNOPSIS πΈ
#include <shishi.h>
int shishi_encrypt_etype(Shishi * handle, Shishi_key * key, int
keyusage, int32_t etype, const char * in, size_t inlen, char ** out,
size_t * outlen);
like, one function, eight arguments, zero chill π
π¦ ARGUMENTS π¦
Shishi * handleβ the shishi handle, bestie. You get one fromshishi_init(), don't just make one up out of vibes.Shishi_key * keyβ the key you're encrypting with. the moment of truth πint keyusageβ an integer saying what this key is actually for, like what it's encrypting. context matters, periodt.int32_t etypeβ an integer telling it which cipher to use. this is the whole point of the_etypeflavour, so choose wisely β¨const char * inβ the input array, aka the data you wanna encrypt. the precious cargo π¦size_t inlenβ how big that input array is.char ** outβ output array that gets filled with the newly allocated encrypted data. yes, newly allocated, we'll talk about that in a sec πsize_t * outlenβ output variable that receives the size of that newly allocated output array. so you know how much you got.
π DESCRIPTION π
So what it do: it encrypts your data according to the encryption method you picked, using a specified initialization vector and key. It's giving "do the crypto thing" π₯
BUT here's the tea β the key that actually gets used is derived using the key usage. And if keyusage is 0, then no key derivation happens at all. Zero. Nada. Just the key you handed it.
The OUT buffer? The caller has to deallocate it. That's you. You are the caller. It's your responsibility now, bestie π«Ά
Also, the default IV is used here. If you need to mess with the IV, go see shishi_encrypt_iv_etype instead. And heads up β the next IV is lost with this one. If you actually need that next IV, you want shishi_encrypt_ivupdate_etype. Pick your fighter.
Now for the part that lowkey trips everyone up:DECRYPT(ENCRYPT(data))does not necessarily give youdataback exactly. Not a bug, just how it be π
Why? Because some encryption types add pad so the data fits into the block size of the encryption algorithm. And that pad is not guaranteed to look in any special way β like, existing implementations often pad with the zero byte, but "often" is doing a lot of heavy lifting there. So you can't rely on the pad looking a certain way.
Which means: you may have to "frame" your data so you can infer the original length after decryption. Think of it like telling your bestie "this message is exactly 47 characters long" before you send it, so she knows where it ends. Compare with ASN.1 DER, which contains exactly that kind of information. iconic behaviour, honestly π
β RETURN VALUE β
Returns SHISHI_OK iff successful. That's it, that's the return value. slay.
π REPORTING BUGS π
Found a bug? Spill the tea 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/
they're nice, they wanna help, fr fr.
π 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. so like, go off, just keep the receipts π
π 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. iykyk π
and that's the whole page, bestie!! this was shishi_encrypt_etype(3) from shishi 1.0.3, dated 1.0.3 on the footer, section 3 of the manual β go encrypt something responsibly and remember to free your output buffer, i'm literally begging you πβ¨π¦πΈππ
π¦ 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