- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1
Description
Hi! I'm working on integrating CipherSweet with KMS in a Laravel multi-tenant app.
There’s no official PHP implementation for envelope encryption, but I’ve been studying the AWS Encryption SDK, particularly how it handles DEK caching:
https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/thresholds.html
From what I understand, they cache DEKs in memory via a Cryptographic Materials Manager (CMM), with configurable thresholds on message and byte counts per DEK. This improves performance by avoiding KMS calls on every operation but trades off some audit granularity—you only audit DEK encrypt/decrypt events, not individual data encryptions.
In my design, each tenant may have multiple active DEKs, and I rely on KMS key rotation to ensure forward security (DEKs are short-lived, generated with the latest version of a KMS alias). The payload (the envelope) stores the encrypted DEK, the KMS key ID, and the encrypted data.
Given PHP's short-lived nature, I plan to store active DEKs (plain and encrypted) in Redis, along with their usage counters and TTLs.
However, this approach breaks CipherSweet blind indices, since the salt is derived from the encryption key. If the key changes frequently (due to DEK rotation), the salt—and thus the blind index—changes as well.
Would it be feasible for CipherSweet to support using different keys for encryption and blind index generation?
This would allow data re-encryption under new DEKs without breaking blind index searchability.
Thanks!