RFC-0019: Azure Key Vault and Managed HSM Provider

  • Status: Proposed; adds a third distribution under the RFC-0016 rules.

  • Owner: Provider and security leads.

  • Last updated: 2026-11-29

Context

RFC-0016 shipped AWS KMS and Google Cloud KMS providers. Organizations standardized on Microsoft Azure keep their keys in Azure Key Vault (software and HSM-backed keys) or Azure Managed HSM (single-tenant HSM pools). Without a provider for them, those organizations cannot use a cloud key as the primary recipient.

Key Vault differs from the other two services in one way that matters here: its key-wrapping operations are RSA-OAEP (and AES key wrap in Managed HSM), none of which accepts associated data, so the envelope header cannot be bound the way AWS uses an encryption context and Google Cloud uses AAD.

Binding decision

cryptography-suite-azure-keyvault follows every RFC-0016 rule: it imports only cryptography_suite.errors and cryptography_suite.providers, never imports the Azure SDK or reads credentials or the environment, and takes an application-constructed azure.keyvault.keys.KeyClient.

  • Identity. key_id is the Key Vault key name; version is the immutable key version. describe_key resolves a name to its current version, and every wrap records the exact version, so rotation never strands an envelope.

  • Keys. RSA keys (RSA, RSA-HSM) with the wrapKey operation can wrap, and with unwrapKey can unwrap. Other key types have no capabilities. AES key wrap (A256KW, Managed HSM oct-HSM keys) is not used: it is deterministic, which fails the conformance kit’s randomized wrapping check.

  • Algorithm. RSA-OAEP-256; the wrapping algorithm identifier is azure-keyvault-rsa-oaep-256-bound.

  • Binding. The wrapped payload is data_key || SHA-256("cryptography-suite/v4 azure key vault binding" || 0x00 || binding), where binding is the envelope’s protected bytes. Unwrap splits off the digest and compares it in constant time; a mismatch is AUTHENTICATION_FAILED. Because RSA-OAEP is IND-CCA2 secure, the digest cannot be changed without the private key, so a wrapped key cannot be moved to another envelope. Anyone with the public key can still create a wrapped key for any header; that is inherent to public-key recipients and, as for HPKE (RFC-0012), envelope integrity comes from the key commitment and the recipient-manifest MAC.

  • Response checks. Key Vault reports the key identifier that performed each operation. A wrap answered by another version is KEY_VERSION_STALE; an unwrap answered by another key or version is AUTHENTICATION_FAILED.

  • State. A disabled, expired, or not-yet-valid version is DISABLED, so the protector falls back to another recipient (RFC-0011). Missing state is UNKNOWN.

  • Errors. Azure SDK exceptions are matched by class name along their hierarchy, and HttpResponseError by HTTP status: not found KEY_NOT_FOUND; 401 and 403 PROVIDER_AUTH_FAILED; 429 PROVIDER_RATE_LIMITED (retryable); 408 and 504 PROVIDER_TIMEOUT (retryable); 500, 502, 503, and connection failures PROVIDER_UNAVAILABLE (retryable). A 400 is AUTHENTICATION_FAILED for an unwrap (Key Vault’s answer to undecryptable ciphertext) and CAPABILITY_UNSUPPORTED otherwise. When the SDK unwraps locally, ValueError is AUTHENTICATION_FAILED and NotImplementedError (no private key) is CAPABILITY_UNSUPPORTED. SDK messages are never kept.

  • SDK compatibility. The SDK’s local RSA path reads algorithm.value, so the provider passes a string subclass that carries it; a plain string fails there. This was found by running the provider through the real SDK’s CryptographyClient, which the test suite keeps doing.

Security consequences

  • The data key and the binding digest travel to Key Vault inside the wrap request when the SDK wraps remotely, exactly as with any KMS. With the public key cached, the SDK wraps locally and only unwraps reach the vault.

  • Key Vault access policies or Azure RBAC decide who can unwrap; logs in Azure Monitor record every unwrap by key version.

Test and validation requirements

tests/provider_packages/test_azure_keyvault.py runs the provider against an in-memory Key Vault that performs real RSA-OAEP-SHA256, reports versioned key identifiers, and raises exceptions with the Azure SDK’s names and hierarchy. It covers the round trip, the conformance kit, rotation and rewrap, fallback from a disabled version to an escrow recipient, every state and capability, binding and tampering, untrustworthy responses, every error mapping, retries, health, and construction. One test drives the provider through the real azure-keyvault-keys CryptographyClient (pinned in requirements-dev.txt), including a public-key-only client that can wrap but not unwrap.

Live tests against a real vault remain release work, as for RFC-0016.