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_idis the Key Vault key name;versionis the immutable key version.describe_keyresolves 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 thewrapKeyoperation can wrap, and withunwrapKeycan unwrap. Other key types have no capabilities. AES key wrap (A256KW, Managed HSMoct-HSMkeys) is not used: it is deterministic, which fails the conformance kit’s randomized wrapping check.Algorithm.
RSA-OAEP-256; the wrapping algorithm identifier isazure-keyvault-rsa-oaep-256-bound.Binding. The wrapped payload is
data_key || SHA-256("cryptography-suite/v4 azure key vault binding" || 0x00 || binding), wherebindingis the envelope’s protected bytes. Unwrap splits off the digest and compares it in constant time; a mismatch isAUTHENTICATION_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 isAUTHENTICATION_FAILED.State. A disabled, expired, or not-yet-valid version is
DISABLED, so the protector falls back to another recipient (RFC-0011). Missing state isUNKNOWN.Errors. Azure SDK exceptions are matched by class name along their hierarchy, and
HttpResponseErrorby HTTP status: not foundKEY_NOT_FOUND; 401 and 403PROVIDER_AUTH_FAILED; 429PROVIDER_RATE_LIMITED(retryable); 408 and 504PROVIDER_TIMEOUT(retryable); 500, 502, 503, and connection failuresPROVIDER_UNAVAILABLE(retryable). A 400 isAUTHENTICATION_FAILEDfor an unwrap (Key Vault’s answer to undecryptable ciphertext) andCAPABILITY_UNSUPPORTEDotherwise. When the SDK unwraps locally,ValueErrorisAUTHENTICATION_FAILEDandNotImplementedError(no private key) isCAPABILITY_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’sCryptographyClient, 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.