decrypt_data_symmetric

Function decrypt_data_symmetric 

Source
pub fn decrypt_data_symmetric(
    precomputed_key: &PrecomputedKey,
    nonce: &Nonce,
    encrypted: &[u8],
) -> Result<Vec<u8>, ()>
Expand description

Returns plain data from encrypted, with length of encrypted - 16 due to padding, or () if data couldn’t be decrypted.

Decryption is done using precomputed key (from the secret key of receiver and the public key of sender) and a 24 byte nonce.

sodiumoxide takes care of removing padding from the data, so the resulting plain data has length of encrypted - 16.

This function is a wrapper for the open_precomputed() function from sodiumoxide.