# RFC-0024: HashiCorp Vault Transit Provider - **Status:** Proposed; adds a fourth distribution under the RFC-0016 rules. - **Owner:** Provider and security leads. - **Last updated:** 2026-11-29 ## Context Many enterprises run HashiCorp Vault, on premises or across clouds, as their key service; its Transit secrets engine performs encryption without releasing keys. The roadmap listed a Vault provider next to the cloud KMS distributions. ## Binding decision `cryptography-suite-hashicorp-vault` follows every RFC-0016 rule: it imports only `cryptography_suite.errors` and `cryptography_suite.providers`, never imports hvac or reads tokens or the environment, and takes an application-constructed `hvac.Client` (plus the Transit `mount_point`). - **Identity.** `key_id` is the Transit key name; `version` is the key version as canonical decimal text. `describe_key` resolves the latest version and checks that a requested version exists. - **Keys.** `aes128-gcm96`, `aes256-gcm96`, and `chacha20-poly1305` keys that are neither derived nor convergent; `supports_encryption` and `supports_decryption` give the wrap and unwrap capabilities. Other keys have none. - **Binding.** Each wrap calls `encrypt` with `key_version` set to the recorded version and `associated_data = base64("cryptography-suite/v4 binding" || 0x00 || SHA-256(binding))`, so Vault's AEAD authenticates the envelope header. Unwrap sends the same associated data to `decrypt`. - **Version pinning.** The returned ciphertext must start with `vault:v:` (otherwise `KEY_VERSION_STALE`); on unwrap, the stored ciphertext must name the recorded version (otherwise `AUTHENTICATION_FAILED`), so a wrapped key cannot claim a different version than the envelope records. The wrapping algorithm identifier is `vault-transit-aead-bound`. - **State.** A version below `min_decryption_version` is `DISABLED`, so the protector falls back to another recipient (RFC-0011). - **Errors.** hvac exceptions are matched by class name along their hierarchy: `InvalidPath` `KEY_NOT_FOUND`; `Forbidden` and `Unauthorized` `PROVIDER_AUTH_FAILED`; `RateLimitExceeded` `PROVIDER_RATE_LIMITED`; `InternalServerError`, `BadGateway`, `VaultDown`, `PreconditionFailed`, and transport failures retryable; `InvalidRequest` is `AUTHENTICATION_FAILED` on decrypt and `CAPABILITY_UNSUPPORTED` otherwise. Vault messages are never kept. ## Test and validation requirements `tests/provider_packages/test_hashicorp_vault.py` runs the provider against an in-memory Transit engine that performs real AES-256-GCM with the associated data, and covers the round trip, the conformance kit for all three key types, rotation and rewrap, `min_decryption_version` with escrow fallback, capabilities and states, binding and tampering, version pinning, untrustworthy responses, every error mapping, retries, health, and construction. One test drives the provider through the real hvac client over an in-process HTTP transport (hvac pinned in `requirements-dev.txt`), checking the JSON hvac sends and hvac's own exception mapping. Writing that fake exposed two test-side mistakes, both caught by the conformance kit or the tests: an unparsable ciphertext must be a 400 from Vault (not a client-side exception), and a length check in the provider was unreachable because `WrappedKey` already bounds the size, so it was removed. Live tests against a real Vault server remain release work, as for the cloud providers.