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 operationsplaintexts- A vector of prepared plaintext values to encryptopts- Encryption options including keyset ID, lock context, and service token
§Returns
A vector of EqlOutput values, one per input plaintext, in the same order:
EqlOperation::Storeinputs yieldEqlOutput::Storecarrying anEqlCiphertextstorage payload (one ofEqlCiphertext::Encryptedfor scalars orEqlCiphertext::SteVecfor structured values).EqlOperation::Queryinputs yieldEqlOutput::Querycarrying anEqlQueryPayload(noc— query payloads are matched against stored ciphertexts in the database).
§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
IndexTermwith no v2.3 representation
§Examples
let opts = EqlEncryptOpts::default();
let outputs = encrypt_eql(cipher, plaintexts, &opts).await?;