[−][src]Function yaca::simple_encrypt
pub fn simple_encrypt(
algo: &EncryptAlgorithm,
bcm: &BlockCipherMode,
sym_key: &Key,
iv: Option<&Key>,
plaintext: &[u8]
) -> Result<Vec<u8>>
Encrypts data using a symmetric cipher
algo
is an encryption algorithm (selectEncryptAlgorithm::Aes
if unsure).bcm
is a chaining mode (selectBlockCipherMode::Cbc
if unsure).sym_key
is a symmetric encryption key (seeKey
for key generation functions).iv
is an Initialization Vector (seeEncryptContext::get_iv_length()
.plaintext
is the data to be encrypted, can be empty.- The function returns the encrypted data.
- It doesn't support
BlockCipherMode::Gcm
andBlockCipherMode::Ccm
.