Skip to main content

encrypt

Function encrypt 

Source
pub fn encrypt(key: &MasterKey, flags: u8, plaintext: &[u8]) -> Result<Vec<u8>>
Expand description

Encrypts plaintext, recording flags in the authenticated header.

The returned blob is header || synthetic IV || ciphertext. The header goes in as associated data, so flipping the suite or flag byte invalidates the tag instead of quietly changing how the file is read.

ยงErrors

Error::Crypto if the cipher refuses the input, which for a single associated-data item cannot happen in practice.