Skip to main content

encrypt_data

Function encrypt_data 

Source
pub fn encrypt_data(s_enc: &[u8; 16], iv: &[u8; 16], data: &[u8]) -> Vec<u8> 
Expand description

Encrypt a DATA payload with AES-128-CBC, applying the always-0x80 padding rule. s_enc is the session encryption key, iv is the complemented MAC of the last frame received from the other side.

Output length is ((data.len() + 1).div_ceil(16)) * 16.