shishi_decrypt_etype(3)

πŸ“¦
version 1.0.3 Β· 2 versions
  • 1.0.3 Β· debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 1.0.2 Β· ubuntu jammy
, in debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– shishi_decrypt_etype β€” bestie, it's decryption o'clock πŸ’–

okay so this is a page from the shishi manual, section 3 (that's the library-functions section, iykyk 🫢). It's called shishi_decrypt_etype and it's literally the girl whose whole job is: take the scrambled data, hand you back the real data. slay.


✨ SYNOPSIS ✨

#include <shishi.h>

int shishi_decrypt_etype(Shishi * handle, Shishi_key * key, int
keyusage, int32_t etype, const char * in, size_t inlen, char ** out,
size_t * outlen);

that's the whole vibe. one function call, eight arguments, zero chill 🌸


πŸŽ€ ARGUMENTS πŸŽ€

  • Shishi * handle β€” your shishi handle, the one you got from shishi_init(). it's the passport, don't lose it πŸ’…
  • Shishi_key * key β€” the key you're decrypting with. the moment.
  • int keyusage β€” an integer saying what exactly this key is decrypting. context is everything bestie.
  • int32_t etype β€” an integer saying which cipher to use. pick your fighter ✨
  • const char * in β€” the input array holding the data you want decrypted.
  • size_t inlen β€” how big that input array is. size matters, fr fr.
  • char ** out β€” the output array where the freshly allocated decrypted data lands. new memory, just for you 🎁
  • size_t * outlen β€” an output variable that tells you how big that newly allocated output array is.

🌈 DESCRIPTION 🌈

So. This function decrypts data according to the encryption method you specified, using the key you handed over. πŸ¦‹

Here's the tea though: the key that actually gets used is derived using the key usage. And if key usage is 0, then no key derivation happens at all β€” raw key, no middleman. periodt.

⚠️ The OUT buffer must be deallocated by the caller. that's on you, not on shishi. free it or leak it, your choice (pls free it 😭).

The default IV is what gets used here. If you need to change the IV, go see shishi_decrypt_iv_etype. And the next IV? gone. lost. not coming back. if you need it, shishi_decrypt_ivupdate_etype is your girl.

Now for the part everyone forgets and then cries about 🫢: DECRYPT(ENCRYPT(data)) does not necessarily give you data back exactly. 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 particular way either β€” existing implementations often pad with the zero byte, but that's a "often", not a promise. πŸ’€

Which means... you may have to "frame" your data, so that after decryption it's actually possible to infer the original length. Think of it like tagging your luggage so you know which bag is yours at baggage claim. Compare ASN.1 DER, which contains exactly that kind of information. ⭐


πŸ‘‘ RETURN VALUE πŸ‘‘

Returns SHISHI_OK iff successful. that's it. that's the whole answer. slay.


πŸ› REPORTING BUGS πŸ›

Found a bug? Report it to <bug-shishi@gnu.org>. They want to know, bestie, don't gatekeep 🫢


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, the command

info shishi

should give you access to the complete manual. go read it, it's giving encyclopedia but make it fun πŸ’œ


shishi version 1.0.3 β€” that's the source and the version, and this page is shishi_decrypt_etype(3), section 3, GNU Shishi. mwah, go decrypt something responsibly πŸ’–βœ¨πŸŽ€πŸ¦‹