You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[auto-rotation feature] feat(rekey): Manual rotation for all key types + test vectors (#969)
* feat(rekey): implement symmetric key ReKey with wrapping key re-wrap
- Implement KMIP ReKey for symmetric keys with name transfer per §4.4
- Support re-wrapping dependent keys when a wrapping key is rekeyed
- Add find_wrapped_by() to ObjectsStore trait (SQLite, PostgreSQL, MySQL)
- Fix: transfer Name attribute from old to new key during ReKey
- Fix: error on self-wrap when wrapping_key_id is user-supplied
- Fix: bypass ownership check for server-configured KEK
Tested with 37 vector tests (9 symmetric + 27 keypair + 1 security)
* fix: consolidate rekey operations using trait
* feat: consolidate Recertify operation
- Add `KeyRetirement` struct + `finalize_rekey` function in `common.rs` — shared Phase 2 logic (retire old keys + rewrap dependants + atomic commit) used by both symmetric and keypair rekey
17
+
- Move `compute_rotation_uid` and `rewrap_dependants` from `symmetric.rs` to `common.rs`; keypair rekey now uses name-preserving UIDs
18
+
- Convert `ReKeyKeyPair` to 2-phase commit (matching symmetric) to support dependant re-wrapping on public keys
19
+
- Set rotation metadata (`rotate_generation`, `rotate_date`, `rotate_latest`, `rotate_interval`) on new keys during `ReKeyKeyPair`
20
+
- Clear rotation flags on old keys during `ReKeyKeyPair` to prevent scheduler re-triggering
21
+
- Add default implementations to `RekeyOperation` trait for `detect_wrapping`, `persist_new_key`, `finalize_dependants`, and `rewrap_new_objects` — eliminates duplicate code across symmetric.rs, keypair.rs, and recertify.rs
22
+
- Extract `extract_rewrap_spec`, `extract_wrapping_key_uid`, and `retrieve_eligible_keys` into `common.rs` as shared helpers — removes 40+ lines of duplicated logic
23
+
- Extract shared `validate_no_crypto_param_change` into `common.rs` — validates that ReKey/ReKeyKeyPair requests do not alter algorithm, curve, or key length; now applies to both symmetric and keypair rekey
24
+
- Refactor `prepare_attributes` in `keypair.rs` — extract `finalize_replacement_key` helper to eliminate SK/PK code duplication
25
+
- Move `setup_new_key` and `finalize_replacement_key` from keypair.rs to common.rs as shared helpers
26
+
- Extract `preserve_wrapping_key_link` into common.rs — copies WrappingKeyLink from old to new key
27
+
- Split `rewrap_dependants` (70→25 lines) by extracting `rewrap_single_dependant` helper
28
+
- Split `relink_keys_to_new_certificate` by extracting `relink_single_key` helper
29
+
30
+
## Bug Fixes
31
+
32
+
- Transfer `Name` attribute from old key to new key during ReKey per KMIP §4.4
33
+
- Return error instead of silently skipping when a user-supplied wrapping key ID equals the key being wrapped
34
+
- Bypass ownership check for server-configured KEK during wrapping operations
35
+
- Fix symmetric ReKey missing server-wide KEK wrapping and unwrapped-cache insert (now consistent with keypair rekey via shared default)
36
+
- Fix keypair rekey not preserving WrappingKeyLink on replacement keys
37
+
- Fix symmetric rekey hardcoding `State::Active` — now uses `setup_object_lifecycle` for date-based state computation
38
+
- Fix `setup_object_lifecycle` not storing `activation_date` for `PreActive` keys — offset-based activation scheduling now works correctly
39
+
- Add `ReCertify` request/response deserialization to KMIP 2.1 message handler
40
+
- Fix `ReCertify.generate_replacement` passing empty user to `get_subject`/`get_issuer` — use certificate owner instead
41
+
- Fix `ReCertify` not computing lifecycle state from offset — certificates with future activation_date are now `PreActive`
42
+
43
+
## Documentation
44
+
45
+
- Add Certificate Renewal (ReCertify) section to key_auto_rotation.md with RFC references (RFC 4210, 4211, 5280, 2986, 5272), KMIP 2.1 §6.1.45 attribute table, and CMP relationship explanation
46
+
47
+
## Testing
48
+
49
+
- Add 9 symmetric ReKey test vectors (basic, wrapped, wrapping-key re-wrap, name transfer, offset, links)
0 commit comments