RFC-0022: Post-Quantum Key Encapsulation in Google Cloud KMS

  • Status: Proposed; extends the RFC-0016 Google Cloud KMS provider.

  • Owner: Provider and security leads.

  • Last updated: 2026-11-29

Context

RFC-0017 made offline recipients quantum-resistant. A cloud primary key was still classical: its wrap is protected by Cloud KMS’s symmetric keys, and the service keeps them, but an organization that must show quantum-resistant key establishment end to end also wants the key-encapsulation private key held by the key service, in an HSM, never exported. Cloud KMS offers KEY_ENCAPSULATION CryptoKeys with the algorithms ML_KEM_768, ML_KEM_1024, and KEM_XWING, a GetPublicKey call (formats NIST_PQC and XWING_RAW_BYTES), and a Decapsulate call. Encapsulation is left to the client.

Binding decision

The cryptography-suite-gcp-kms provider supports those keys beside the existing symmetric ones:

Cloud KMS algorithm

HPKE KEM id

HPKE suite

Wrapping algorithm identifier

ML_KEM_768

0x0041

HKDF-SHA256, AES-256-GCM

gcp-kms-ml-kem-768-hpke-sha256-aes-256-gcm

ML_KEM_1024

0x0042

HKDF-SHA384, AES-256-GCM

gcp-kms-ml-kem-1024-hpke-sha384-aes-256-gcm

KEM_XWING

0x647A

HKDF-SHA256, AES-256-GCM

gcp-kms-xwing-hpke-sha256-aes-256-gcm

  • Format. The wrapped key is an RFC 9180 HPKE base-mode single-shot ciphertext, enc || AES-256-GCM(key, base_nonce, aad = "", data key), with the key schedule of RFC 9180 section 5.1. Any HPKE implementation that holds the private key can open it; the tests prove this by opening every wrap with pyca/cryptography’s independent HPKE implementation.

  • Encapsulation runs locally on the version’s public key. ML-KEM uses pyca/cryptography; X-Wing combines ML-KEM-768 and X25519 as SHA3-256(ss_M || ss_X || ct_X || pk_X || "\.//^\"). The public key is fetched once per version, checked by CRC32C, name, and algorithm, and cached; versions are immutable.

  • Binding. The HPKE info is "cryptography-suite/v4 gcp kms kem wrap" || 0x00 || SHA-256(label || length-prefixed algorithm identifier, key name, version name, and SHA-256(envelope protected bytes)).

  • Unwrap calls Decapsulate on the recorded version with a CRC32C of the encapsulation, requires verified_ciphertext_crc32c and a matching shared_secret_crc32c (otherwise a retryable failure), requires the response to name the recorded version, and then runs the key schedule and AES-256-GCM locally. ML-KEM decapsulation never fails on a forged input; the AEAD tag does, as AUTHENTICATION_FAILED.

  • Capabilities. Wrapping needs ML-KEM in the local backend; unwrapping needs only HMAC and AES-GCM, so a recovery client without ML-KEM still opens everything. describe_key reports UNWRAP alone on such a client, and a wrap there is CAPABILITY_UNSUPPORTED. post_quantum_available() reports which applies.

Security consequences

  • The KEM private key never leaves Cloud KMS; every decapsulation is an authorized, logged Cloud KMS call on an exact version.

  • ML_KEM_* keys are pure post-quantum; KEM_XWING is hybrid and stays secure while either ML-KEM-768 or X25519 holds. As with any keyring (RFC-0011), an envelope is only as strong as its weakest recipient.

Test and validation requirements

tests/provider_packages/test_gcp_kms_post_quantum.py runs the provider against an in-memory Cloud KMS holding real ML-KEM-768, ML-KEM-1024, and X-Wing private keys. It covers round trips through Protector, interoperability with pyca/cryptography’s HPKE, public-key caching, the conformance kit, binding, tampering of the encapsulation and the AEAD body, truncation, cross-version rejection, rotation and rewrap, every corrupted or mismatched response, and a client without ML-KEM that can still unwrap.