[−][src]Function enc_file::decrypt_aes
pub fn decrypt_aes(enc: Vec<u8>, key: &str) -> Result<Vec<u8>, Box<dyn Error>>
Decrypts ciphertext (Vec
Examples
use enc_file::{encrypt_aes, decrypt_aes}; let text = b"This a test"; let key: &str = "an example very very secret key."; // encrypt_aes takes plaintext as Vec<u8>. Text needs to be transformed into vector let text_vec = text.to_vec(); let ciphertext = encrypt_aes(text_vec, key).unwrap(); assert_ne!(&ciphertext, &text); let plaintext = decrypt_aes(ciphertext, key).unwrap(); assert_eq!(format!("{:?}", text), format!("{:?}", plaintext));