KCAPI_CIPHER_SETKEY(3)
β¨ NAME β¨
kcapi_cipher_setkey β bestie, this is the one that sets the key for the cipher handle π
πΈ SYNOPSIS πΈ
int kcapi_cipher_setkey(struct kcapi_handle * handle,
const uint8_t * key, uint32_t keylen);
π ARGUMENTS π
handleβ [in] your cipher handle π the little main character you've been working withkeyβ [in] the key buffer, aka the actual secret vibes πkeylenβ [in] how long that key buffer is, in bytes
π¦ DESCRIPTION π¦
Okay so with this function, the caller sets the key for all the encryption or decryption operations that come next. That's it. That's the whole job. Setting the key, slaying, moving on. β¨
And here's the part that lowkey eats: after the caller has provided the key, the caller may securely destroy the key, because it's now maintained by the kernel π the kernel's got it from here, bestie, you don't need to hold onto it anymore.
So what does it return, you ask?
0upon success π«Ά- but wait β in the case of an
akcipherhandle, a positive integer is returned instead, and that number denominates the maximum output size of the cryptographic operation π this value must be used as the size of the output buffer for one cryptographic operation. No cap, do not skip this step. - and if something goes wrong, you get a negative errno-style error code π
fr fr, remember that akcipher exception β it's giving "success but with homework" and you cannot ignore the homework π
π AUTHOR π
Stephan Mueller <smueller@chronox.de> Author. π«‘ iconic of him honestly
π COPYRIGHT π
and that's the whole page bestie, ty for coming to my ted talk π this was the libkcapi Manual, version 1.5.0, from July 2025, and the page itself is KCAPI_CIPHER_SETKEY(3) β go set some keys and stay hydrated π§β¨
π¦ 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