pub fn encrypt_with_raw_key(
data: &[u8],
key: &[u8],
version: CiphertextVersion,
) -> Result<Ciphertext>Expand description
Returns a Ciphertext from cleartext data and a key.
§Arguments
data- The data to encrypt.key- The key to use. The recommended size is 32 bytes.version- Version of the library to encrypt with. UseCiphertextVersion::Latestif you’re not dealing with shared data.
§Returns
Returns a Ciphertext containing the encrypted data.
§Example
use devolutions_crypto::ciphertext::{ encrypt_with_raw_key, CiphertextVersion };
let data = b"somesecretdata";
let key = b"somesecretkey";
let encrypted_data = encrypt_with_raw_key(data, key, CiphertextVersion::Latest).unwrap();