pub fn encrypt_with_aes(
message: &[u8],
key: &[u8; 32],
iv: &[u8; 16],
) -> Result<Vec<u8>, Box<dyn Error>>Expand description
Encrypt a message using AES-256-CBC with a custom IV
§Arguments
message- The plaintext message to encryptkey- A 32-byte encryption keyiv- A 16-byte initialization vector
§Returns
Returns a Result containing the encrypted ciphertext as Vec
§Example
use askrypt::encrypt_with_aes;
let message = b"Hello, World!";
let key = [0u8; 32];
let iv = [0u8; 16];
let ciphertext = encrypt_with_aes(message, &key, &iv).unwrap();