Skip to main content

encrypt_eql

Function encrypt_eql 

pub async fn encrypt_eql<'a, C>(
    cipher: Arc<ScopedCipher<C>>,
    plaintexts: Vec<PreparedPlaintext<'a>>,
    opts: &EqlEncryptOpts<'a>,
) -> Result<Vec<EqlOutput>, 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 produces EQL payloads suitable for database storage or for use as query inputs. Each PreparedPlaintext is processed independently, preserving input order in the result.

§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 EqlOutput values, one per 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
  • A query-mode plaintext produces an IndexTerm with no v2.3 representation

§Examples

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