DOKK / manpages / debian 12 / libkcapi-dev / kcapi_akcipher_setpubkey.3.en
KCAPI_AKCIPHER_SETPU(3) Programming Interface KCAPI_AKCIPHER_SETPU(3)

kcapi_akcipher_setpubkey - set the public key for the cipher handle

int kcapi_akcipher_setpubkey(struct kcapi_handle * handle, const uint8_t * key, uint32_t keylen);

handle

[in] cipher handle

key

[in] key buffer in DER format

keylen

[in] length of key buffer

With this function, the caller sets the key for subsequent cipher operations.

The key must be in DER format as follows

SEQUENCE { n INTEGER ({ rsa_get_n }), e INTEGER ({ rsa_get_e }) }

After the caller provided the key, the caller may securely destroy the key as it is now maintained by the kernel.

return upon success the value of the maximum size for the asymmetric operation is returned (e.g. the modulus size); a negative errno-style error code if an error occurred

Stephan Mueller <smueller@chronox.de>

Author.

February 2022 libkcapi Manual 1.4.0