# RFC-0027: FIPS Mode - **Status:** Proposed; amends the RFC-0007 policy model with two fields and a profile. - **Owner:** Policy and security leads. - **Last updated:** 2026-11-30 ## Context Organizations that sell to the United States federal government (FedRAMP, CMMC) or regulated industries must use only FIPS-approved algorithms, executed by a FIPS 140-3 validated module. pyca/cryptography can run on OpenSSL's FIPS provider. The SDK's content suite (AES-256-GCM, HKDF-SHA-512, HMAC-SHA-256) is already made of approved algorithms; recipients are not: X25519, the X-Wing hybrid, and Shamir quorum shares are not approved, and the policy could not express "approved recipients only". ## Binding decision - **Policy fields.** `approved_wrapping_algorithms` (`None` = any, otherwise a non-empty set of wrapping algorithm identifiers) and `require_fips_backend` (default `False`). Both are written to the canonical policy document only when they differ from their defaults, and documents without them parse to the defaults, so every earlier policy document and identifier is unchanged. `restrict` intersects the algorithm sets (an empty intersection is rejected), ORs `require_fips_backend`, and a `fips` profile on either side yields `fips`. - **Profile.** `Policy.fips(approved_providers=...)` is the enterprise profile (explicit providers, audit required) plus `require_fips_backend=True` and `approved_wrapping_algorithms` defaulting to `FIPS_WRAPPING_ALGORITHMS`. A `fips` policy must satisfy all of these, and its algorithms must be a subset of that list. - **Approved list.** `FIPS_WRAPPING_ALGORITHMS` names the identifiers whose primitives are all approved: HPKE with DHKEM(P-384) and with ML-KEM-1024 + P-384, the hierarchical provider (HKDF-SHA256 and AES-GCM), AWS KMS and Google Cloud KMS symmetric keys, Google Cloud KMS ML-KEM-768 and ML-KEM-1024 keys, and Azure Key Vault RSA-OAEP-256. Excluded: X25519 HPKE, ML-KEM-768 + X25519 (X-Wing) in HPKE and in Cloud KMS, quorum shares, and Vault Transit, whose identifier does not reveal whether the key is AES-GCM or ChaCha20-Poly1305. A test pins the list against the identifiers the code defines. - **Enforcement.** A `Protector` with `require_fips_backend` refuses to be constructed unless pyca/cryptography reports FIPS mode (`fips_backend_active()`), with `POLICY_DENIED`. Every wrap is checked after the provider returns and before anything is emitted: a recipient with an unapproved algorithm fails the seal or rewrap with `POLICY_DENIED`, including a rewrap whose destination the envelope already holds. Open considers only recipients with approved algorithms; if a configured provider's recipients are all unapproved, the error is `POLICY_DENIED`. `cryptosuite doctor` reports `fips_backend`. ## Limits of the claim This restricts the SDK to approved algorithms on a FIPS-mode backend. It does not make a product FIPS 140-3 validated: validation covers the cryptographic module and its operational environment, and key-service recipients are only as approved as the service's own validated modules. The hierarchical provider's branch keys must themselves be wrapped by an approved root. ## Test and validation requirements `tests/unit/test_policy_fips.py` covers the profile and its round trip, unchanged earlier documents and identifiers, field validation, restriction, the backend requirement, backend detection, sealing, opening, and rewrapping with approved and unapproved recipients, and the approved list against the algorithms the code defines.