KCAPI_CIPHER_ENC_AES(3)
๐ KCAPI_CIPHER_ENC_AES_CBC โ okay bestie, let's talk AES CBC โจ
Manual page kcapi_cipher_enc_aes_cbc โ from the Programming Interface crew, no cap. This is the group chat where the C library talks back ๐
๐ธ NAME ๐ธ
kcapi_cipher_enc_aes_cbc โ the convenience function for AES CBC encryption. It's giving "one function, zero drama" ๐
โจ SYNOPSIS โจ
ssize_t kcapi_cipher_enc_aes_cbc(const uint8_t * key, uint32_t keylen,
const uint8_t * in, size_t inlen,
const uint8_t * iv, uint8_t * out,
size_t outlen);
๐ซถ ARGUMENTS ๐ซถ
Every single one of these is a main character, so let's do intros ๐
keyโ[in]the key buffer. Literally the key. The blueprint. The lore ๐keylenโ[in]length of thatkeybuffer. How many bytes of blueprint we're working with ๐inโ[in]the plaintext data buffer. This is the tea before it gets scrambled โinlenโ[in]length of theinbuffer. Count the bytes, bestie ๐งฎivโ[in]the IV to be used for the cipher operation. Yes you need it, no you can't skip it ๐outโ[out]the ciphertext data buffer. Where the glow-up lands ๐ซoutlenโ[in]length of theoutbuffer. Make sure it's big enough, fr fr ๐ซฃ
๐ DESCRIPTION ๐
So like, this convenience function performs an AES CBC encryption operation using the provided key, the given input buffer, and the given iv. The output gets stored in the out buffer. Slay ๐
โ ๏ธ Heads up bestie: AES CBC requires input data that is a multiple of 16 bytes. That's not a vibe, that's the rules.
If you've got data that is not guaranteed to be multiples of 16 bytes, you have two moves:
- Add zero bytes at the end of the buffer to pad it up to a multiple of 16 bytes ๐
- Otherwise, the CTR mode encryption operation may be usable ๐ฅ
Also, the out buffer must be at least as large as the in buffer. No shrinkflation allowed, periodt ๐
And the iv? It must be exactly 16 bytes in size. Exactly. Not 15, not 17. Sixteen. Iconic and precise โจ
The AES type (AES-128, AES-192 or AES-256) is determined by the size of the given key, and the way that works is:
keyis 16 bytes long โ AES-128 is used ๐keyis 24 bytes long โ AES-192 is implied ๐keyis 32 bytes long โ AES-256 is implied ๐งก
And the return value, bestie? Listen up ๐
- On success: the number of bytes generated ๐
- On error: a negative errno-style error code ๐ญ
๐ AUTHOR ๐
Stephan Mueller <smueller@chronox.de>
- Author. Certified legend, respectfully ๐ซก
๐ COPYRIGHT ๐
This is from the libkcapi Manual, version 1.5.0, dated July 2025 ๐ธ
Okay that's the whole page, you ate it, go encrypt something responsibly ๐โจ๐๐ฆ๐ธ๐ ๐ซถ
๐ฆ where this page comes from
- fedora 43: libkcapi-devel 1.5.0-6.fc43 ยท BSD-3-Clause OR GPL-2.0-only
- fedora 43: libkcapi-devel 1.5.0-6.fc43 ยท BSD-3-Clause OR GPL-2.0-only
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms