[][src]Function enc_file::encrypt_file

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

Encrypts cleartext (Vec) into ciphertext (Vec) using 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(text_vec, key).unwrap();