Skip to main content

crypto_box_open_easy_inplace

Function crypto_box_open_easy_inplace 

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

Decrypts a box in-place.

Decrypts data (mac || ciphertext) with recipient’s secret key recipient_secret_key and sender’s public key sender_public_key with nonce in-place, 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.

After opening the box, the last CRYPTO_BOX_MACBYTES bytes can be discarded or ignored at the caller’s preference.

§Errors

Returns an error if data is shorter than an authentication tag, sender_public_key is unacceptable, or authentication fails.