Skip to main content

crypto_box_easy_inplace

Function crypto_box_easy_inplace 

Source
pub fn crypto_box_easy_inplace(
    data: &mut [u8],
    nonce: &Nonce,
    recipient_public_key: &PublicKey,
    sender_secret_key: &SecretKey,
) -> Result<(), Error>
Expand description

Encrypts a message in-place in a box.

Encrypts message with recipient’s public key recipient_public_key and sender’s secret key sender_secret_key using nonce in-place in data, without allocating additional memory for the message.

The caller of this function is responsible for allocating data such that there’s enough capacity for the message plus the additional CRYPTO_BOX_MACBYTES bytes for the authentication tag.

For this reason, the last CRYPTO_BOX_MACBYTES bytes from the input is ignored. The length of data should be the length of your message plus CRYPTO_BOX_MACBYTES bytes.

§Errors

Returns an error if data is too short or too long, or recipient_public_key is unacceptable.