[auto-rotation feature] feat: add key auto-rotation specification + manual rotation for all key types#968
[auto-rotation feature] feat: add key auto-rotation specification + manual rotation for all key types#968Manuthor wants to merge 17 commits into
Conversation
fa12cc6 to
5f27e21
Compare
There was a problem hiding this comment.
Pull request overview
This PR is the first in the key auto-rotation feature stack. It introduces the canonical auto-rotation specification document and lands the underlying manual rotation implementation for keys and certificates (ReKey, ReKeyKeyPair, ReCertify), plus the database plumbing and test vectors needed for wrapping-key dependant rewrites and certificate renewal link chains.
Changes:
- Add comprehensive documentation for rotation policy attributes, scheduler semantics, and rotation/renewal scenarios (with diagrams and attribute tables).
- Refactor and extend server KMIP operations to implement manual rotation flows for symmetric keys, key pairs, and certificate renewal (
ReCertify) using a shared orchestration trait. - Add
ObjectsStore::find_wrapped_by()across SQL backends to support wrapping-key rotations that must re-wrap dependants, and extend test vectors/runner docs accordingly.
Reviewed changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated 16 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Adds a documentation link for scheduled key auto-rotation. |
| documentation/mkdocs.yml | Registers the new Key Auto-Rotation documentation page in the nav. |
| documentation/docs/kmip_support/key_auto_rotation.md | Adds the full auto-rotation specification and scenarios (policy attributes, flows, roadmap). |
| crate/test_kms_server/src/vector_runner.rs | Registers new negative and positive vectors for ReCertify and offset state verification. |
| crate/test_kms_server/README.md | Updates vector counts and documents newly added vectors. |
| crate/server/src/core/wrapping/wrap.rs | Tightens self-wrap handling and bypasses KEK ownership checks for server-wide KEK. |
| crate/server/src/core/operations/rekey/* | Introduces a new rekey/ module with shared orchestration + symmetric/keypair flows. |
| crate/server/src/core/operations/recertify.rs | Adds server-side ReCertify implementation and dependant relinking behavior. |
| crate/server/src/core/operations/{mod.rs,message.rs,dispatch.rs} | Wires ReCertify through dispatch and operation processing. |
| crate/server/src/core/operations/key_ops/mod.rs | Fixes lifecycle setup so PreActive objects retain a future activation_date. |
| crate/server/src/core/operations/certify/* | Broadens visibility of certify helpers/types for reuse by ReCertify. |
| crate/server/src/core/kms/kmip.rs | Adds the KMS::recertify entry point. |
| crate/interfaces/src/stores/objects_store.rs | Adds find_wrapped_by() to the store trait (default empty). |
| crate/server_database/src/core/database_objects.rs | Exposes Database::find_wrapped_by() across backends. |
| crate/server_database/src/stores/sql/{sqlite,pgsql,mysql}.rs | Implements find_wrapped_by() using JSON queries in each SQL backend. |
| crate/kmip/src/kmip_2_1/{kmip_operations,kmip_messages}.rs | Adds KMIP 2.1 ReCertify request/response types + message (de)serialization. |
| crate/kmip/src/kmip_1_4/kmip_operations.rs | Adds 1.4↔2.1 conversions for ReCertify types and operation mapping. |
| CHANGELOG/feat_key-rotation-manual.md | Adds the required branch-specific changelog for manual rotation changes. |
| CHANGELOG/docs_key-autorotation-spec.md | Adds the required branch-specific changelog for the spec doc addition. |
291bfbd to
1b09922
Compare
tbrezot
left a comment
There was a problem hiding this comment.
I could not go through all diffs, but thanks to your documentation I could grasp enough of the idea to have a few questions (cf my comment of the doc). I will complete the review once we have discussed those points.
9eb009a to
854aa02
Compare
5911dc5 to
dcc5aa5
Compare
tbrezot
left a comment
There was a problem hiding this comment.
A lot of effort has been put into this MR, and it greatly improves the initial implementation. I still have a few comments though:
- a few nitpicks that are trivial to correct;
- maybe an issue concerning the key-selection procedure;
- some deeper concerns about concurrency management, which are orthogonal to this feature and may be addressed in a dedicated MR.
Also, since it is structuring, it might gain from requesting a review from someone else. In any case, I may spend more time on it if you delay the merge (since it is huge, I could not read everything).
d7c575c to
f610a78
Compare
…pleteness
- server/src/core/operations/{recertify,revoke}.rs: wrap
retrieve_object_for_operation and revoke_key_core calls with
Box::pin to suppress clippy::large_futures.
- routes/crypto/{decrypt,encrypt,sign,unwrap}.rs: same Box::pin
treatment for all retrieve_object_for_operation call sites.
- interfaces/src/hsm/hsm_store.rs: add missing set_key_dates and
set_key_label methods to the mockall! test double so it matches
the updated HSM trait.
- server/src/core/uid_utils.rs: rename second mod tests to
mod hsm_tests to eliminate the 'name defined multiple times' error.
- server_database/src/stores/sql/sqlite.rs: replace undefined
SQLITE_QUERIES with PGSQL_QUERIES in the regression-guard test
(SQLite uses PGSQL_QUERIES / query.sql via get_sqlite_query!).
- nix/expected-hashes/{server.vendor.static,ui.vendor.non-fips}.sha256:
update hashes after thiserror 2.0.17→2.0.18 Cargo.lock bump.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The WASM non-fips vendor tarball hash changed after dependencies were updated. Update to sha256-C/9J14QduLLtw4KtWmxOgLAZKUvEhSnsMu5rF5PZS/A=. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add pin_fn_depth macro variant in dispatch for functions returning (Resp, Option<u32>) - Switch MACVerify dispatch arm to pin_fn_depth to unpack mac_verify tuple return - Remove unused kms.message() wrapper (route calls operations::message() directly) - Remove unused RequestMessage/ResponseMessage imports in kms/kmip.rs - Fix google_cse encrypt/decrypt callers to unpack (Resp, Option<u32>) tuples - Fix kmip.rs single-op dispatch path (dispatch() returns KResult<Operation>, not tuple) - Fix ui.vendor.non-fips.sha256 Nix hash Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The method was removed but is called by 6+ test files in crate/server/src/tests/. Restore it with #[allow(dead_code)] since it is only called from cfg(test) code and cargo build (without --tests) cannot see those callers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ckms subprocess cannot negotiate ML-DSA-44 TLS handshake without calling init_openssl_providers() at startup. Mark as ignored until the ckms binary is updated to support PQC TLS client connections. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
f610a78 to
7b7cbd4
Compare
Summary
Delivers the complete key auto-rotation specification and the full manual-rotation
implementation for all key types.
This is PR 1 of 4 in the key auto-rotation feature stack:
What's included
Documentation
x-rotate-interval,x-rotate-name,x-rotate-offset,x-rotate-generation,x-rotate-date)wrapped key, asymmetric key pair, wrapped private key (CoverCrypt),
certificate renewal (
ReCertify), server-wide KEKReplacementObjectLink/ReplacedObjectLink)Implementation —
Re-Key,Re-Key Key Pair,Re-CertifyComplete manual-rotation implementation for all six scenarios:
(RSA, EC, ML-KEM, ML-DSA, SLH-DSA, X25519, secp256k1, CoverCrypt)
Implements
ReCertify(KMIP 2.1 §6.1.45) for certificate renewal:ReplacedObjectLink/ReplacementObjectLink)PreActivestate for future-activation certificatesAll 344 test vectors pass.
Breaking changes
None.
Reviewer notes
This document is the canonical reference for all subsequent PRs in this stack.
Please review terminology and attribute semantics carefully; changes here will
cascade to the implementation PRs.