KCAPI_AKCIPHER_SETPU(3)
π KCAPI_AKCIPHER_SETPU(3) π
okay bestie, welcome to the Programming Interface section 3 page for kcapi_akcipher_setpubkey β yes the man page header truncates it to KCAPI_AKCIPHER_SETPU(3) like a bad screen name, but we know the truth π«Ά
β¨ NAME β¨
kcapi_akcipher_setpubkey β set the public key for the cipher handle π
πΈ SYNOPSIS πΈ
int kcapi_akcipher_setpubkey(struct kcapi_handle * handle,
const uint8_t * key, uint32_t keylen);
π ARGUMENTS π
handleβ[in]the cipher handle, aka your main character. πkeyβ[in]the key buffer, and it has to be in DER format, no substitutes. πkeylenβ[in]how long that key buffer is. π
π¦ DESCRIPTION π¦
So like, this function is the moment where you hand over the key for all the cipher operations coming after it. No key, no vibes, no crypto. π₯
The key has to be in DER format, and specifically it looks like this, okay?
SEQUENCE { n INTEGER ({ rsa_get_n }), e INTEGER ({ rsa_get_e }) }
That's the shape. n, e, SEQUENCE, all of it. Not me being extra, that's just literally the requirement. π
Once you've passed the key in, you're free to securely destroy it β because at that point the kernel is the one maintaining it. She's got it from here, bestie, you can let go. π
And on the return tip: when it works, the value returned is the maximum size for the asymmetric operation (like, say, the modulus size). When it doesn't work? You get a negative errno-style error code. So if you're staring at a negative number, that's not a size, that's a whole situation. π
π AUTHOR π
Stephan Mueller <smueller@chronox.de>
- Author. (iconic of him, fr fr β)
π COPYRIGHT π
This page lives under the libkcapi banner β no extra copyright lines were written down here on this page, so that's the whole story. π§
okay that's the whole page, no cap. sending you off with all the love: libkcapi Manual 1.5.0, July 2025 β go set that public key and slay, bestie π β¨ππ¦πΈ
π¦ 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