Function olm_sys::olm_pk_encrypt
source · [−]pub unsafe extern "C" fn olm_pk_encrypt(
encryption: *mut OlmPkEncryption,
plaintext: *const c_void,
plaintext_length: usize,
ciphertext: *mut c_void,
ciphertext_length: usize,
mac: *mut c_void,
mac_length: usize,
ephemeral_key: *mut c_void,
ephemeral_key_size: usize,
random: *const c_void,
random_length: usize
) -> usize
Expand description
Encrypt a plaintext for the recipient set using olm_pk_encryption_set_recipient_key. Writes to the ciphertext, mac, and ephemeral_key buffers, whose values should be sent to the recipient. mac is a Message Authentication Code to ensure that the data is received and decrypted properly. ephemeral_key is the public part of the ephemeral key used (together with the recipient’s key) to generate a symmetric encryption key. Returns olm_error() on failure. If the ciphertext, mac, or ephemeral_key buffers were too small then olm_pk_encryption_last_error() will be “OUTPUT_BUFFER_TOO_SMALL”. If there weren’t enough random bytes then olm_pk_encryption_last_error() will be “OLM_INPUT_BUFFER_TOO_SMALL”.