HxVault is Velaris's envelope-encryption layer for sensitive data at rest. Every tenant gets its own encryption key that can be individually destroyed — so deleting that key makes the tenant's encrypted data permanently unrecoverable. This turns GDPR Article 17 ("right to erasure") into a real cryptographic mechanism rather than a best-effort delete.
HxVault replaces the previous single-platform-key approach to protecting data like connector credentials with true envelope encryption: a master key wraps many per-tenant keys, and each per-tenant key encrypts that tenant's data. Because each tenant's key is random and stored (never re-derivable), destroying it — crypto-shredding — leaves the ciphertext unreadable forever, even to the platform operator.
HxVault is the data-encryption half of the security stack; OpenBao is the secrets-manager half that holds the master key (see Architecture). HxVault is not a screen or an API you call directly — it is the crypto layer the platform uses internally whenever it stores protected data.
HxVault uses three layers. The master key (KEK) wraps each tenant's data key (DEK); the DEK encrypts the actual field data. All encryption is AES-256-GCM.
KEK (master, 32 bytes) from VELARIS_CASE_KEK, rendered from OpenBao at startup
| wraps / unwraps (AES-256-GCM)
v
per-tenant DEK (random 32 bytes, STORED wrapped) > tenant_deks table
| encrypts / decrypts field data (AES-256-GCM, AAD-bound)
v
ciphertext "hxv2:<tenant|->:<key_version>:<context>:<payload>"
tenant_id of NULL selects the platform DEK, which covers tenantless data.VELARIS_CASE_KEK. When it is unset in development, a dev key is derived from the auth secret (with a startup warning) — shredding still works.hxv2: prefix, so read paths can decrypt without being told which tenant it belongs to.hxv2), the platform-key format (hxv3), the legacy format (hxv1, read only) and plain values — so there is no big-bang re-encryption.| Format | Cipher | Key | Written? |
|---|---|---|---|
hxv2: | AES-256-GCM | Per-tenant DEK — can be crypto-shredded | Yes, wherever the caller has a tenant and a database session |
hxv3: | AES-256-GCM | Platform key derived from the auth secret | Yes, everywhere else |
hxv1: | Hand-rolled keystream with an HMAC tag | Platform key derived from the auth secret | Never — read only |
hxv1 was not broken: it appended an authentication tag and verified it before decrypting, so stored secrets were never trivially forgeable. It was replaced because it was cipher code written by hand in a platform that already depends on a vetted AES-GCM implementation, and because it derived both the keystream and the authentication tag from a single key.
Writers prefer hxv2 and fall back to hxv3 when a tenant key cannot be resolved — never to plaintext, and never to a failed write. A table holding a mix of the two is the expected steady state, not a migration debt.
When no master key is configured, one is derived from the platform’s auth secret so that development round-trips work. Adopting a real one is not a configuration change: setting the variable changes the master key, and every tenant key already wrapped under the derived one stops opening — the platform returns with its tenants’ data unreadable and nothing saying why.
The supplied tool re-wraps every readable tenant key under a new master key in a single transaction, verifying each one opens under the new key before replacing the old, and prints the value once. Re-wrap first, set the variable second, restart third. It refuses to run when the variable is already set, or while any active key is unreadable.
The two failures look identical inside the system — the key is simply not in the cache — but they mean opposite things to whoever is called, so they are reported as different HTTP responses. Confusing them costs a retry loop, an escalation, and a restore attempt that cannot work.
| Code | HTTP | Meaning | What to do |
|---|---|---|---|
VEL-VAULT-DEK-503 | 503 | Transient. The vault is sealed or unreachable, or the master key is unset. The data is intact. | Unseal or restore connectivity, then retry. If only some workers are affected, wait for the next cache reconcile. |
VEL-VAULT-SHREDDED-410 | 410 | Terminal. The key was destroyed on purpose. The ciphertext remains and is permanently unreadable. | Nothing. There is no recovery path, and restoring a database backup does not help — the backup holds the same ciphertext and the key is gone from the vault too. Confirm the shred was intended; it is an audited action. |