encrypt_with_key

Function encrypt_with_key 

Source
pub fn encrypt_with_key(
    key_id: &str,
    plaintext: &str,
    associated_data: Option<&[u8]>,
) -> Result<String>
Expand description

Encrypt text using a stored key from the key store

§Arguments

  • key_id - Identifier of the key to use for encryption
  • plaintext - Text to encrypt
  • associated_data - Optional associated data for authenticated encryption

§Returns

Base64-encoded encrypted ciphertext

§Errors

Returns an error if the key store is not initialized or the key is not found