[][src]Function enc_file::encrypt_file_chacha

pub fn encrypt_file_chacha(
    cleartext: Vec<u8>,
    key: &str
) -> Result<Vec<u8>, Box<dyn Error>>

Encrypts cleartext (Vec) into ciphertext (Vec) using XChaCha20Poly1305 with provided key from keyfile. Returns result.

Examples

let text = b"This a test";
let key: &str = "an example very very secret key.";
let text_vec = text.to_vec();
let ciphertext: Vec<u8> = encrypt_file_chacha(text_vec, key).unwrap();