shishi_encrypt(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_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 from shishi_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>. πŸ›


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. πŸ’–πŸŽ€πŸ¦‹πŸŒΈπŸ’