Skip to main content

encrypt_eql

Function encrypt_eql 

pub async fn encrypt_eql<'a, C: Credentials<Token = ServiceToken>>(
    cipher: Arc<ScopedCipher<C>>,
    plaintexts: Vec<PreparedPlaintext<'a>>,
    opts: &EqlEncryptOpts<'a>,
) -> Result<Vec<EqlCiphertext>, EqlError>
Expand description

Encrypts multiple plaintexts into EQL format.

This is the main encryption entry point for the EQL system. It takes prepared plaintext values and encrypts them into EQL payloads suitable for database storage or query generation. The function handles both storage encryption (with all SEM terms) and only SEM term generation for queries.

§Arguments

  • cipher - The scoped cipher for performing cryptographic operations
  • plaintexts - A vector of prepared plaintext values to encrypt
  • opts - Encryption options including keyset ID, lock context, and service token

§Returns

A vector of EqlCiphertext payloads, one for each input plaintext, in the same order.

§Errors

Returns EqlError if:

  • Data key generation fails
  • Encryption of any plaintext fails
  • Index generation fails
  • The ZeroKMS service is unavailable

§Examples

let opts = EqlEncryptOpts::default();
let encrypted = encrypt_eql(cipher, plaintexts, &opts).await?;