Skip to main content

encrypt_data

Function encrypt_data 

Source
pub fn encrypt_data(data: &[u8], key: &[u8]) -> Result<Vec<u8>, CloudError>
Expand description

Encrypts data using AES-256-GCM.

The nonce is prepended to the ciphertext, so the output format is: nonce (12 bytes) || ciphertext || tag (16 bytes)

§Arguments

  • data - The plaintext data to encrypt
  • key - The 32-byte encryption key

§Returns

The encrypted data with prepended nonce, suitable for base64 encoding.