[][src]Function enc_file::decrypt_file_chacha

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

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

Examples

let key: &str = "an example very very secret key.";
let plaintext: Vec<u8> = decrypt_file_chacha(ciphertext, key).unwrap();
assert_eq!(format!("{:?}", text), format!("{:?}", plaintext));