oscerd opened a new pull request, #24676:
URL: https://github.com/apache/camel/pull/24676

   # CAMEL-23845: Camel-PQC — implement InMemoryKeyLifecycleManager
   
   ## Motivation
   
   `pqc-key-lifecycle.adoc` references an **`InMemoryKeyLifecycleManager`** in 
eight places — a dedicated
   subsection, code examples, the implementation comparison table, the "Testing 
Strategy" section and a
   migration example — but **the class was never committed**. So the documented 
examples did not compile,
   and a genuinely useful implementation was missing.
   
   ## What this does
   
   ### `InMemoryKeyLifecycleManager` (new)
   
   A `ConcurrentHashMap`-backed `KeyLifecycleManager` that performs no I/O — 
keys are lost when the
   application stops. Ideal for tests, development and ephemeral workloads.
   
   - Implements the full `KeyLifecycleManager` contract (generate, store, get, 
rotate, expire, revoke,
     list, delete, export/import, `needsRotation`).
   - Thread-safe, as the docs claim.
   - Adds the two documented helpers: **`clear()`** and **`size()`**.
   
   ### `KeyAlgorithmSupport` (new, shared)
   
   `FileBasedKeyLifecycleManager` held the algorithm mapping (JCE algorithm 
name, BouncyCastle provider,
   default parameter set) plus the key-generation logic in **private** methods. 
Rather than copy ~80 lines
   into the new manager, that logic is extracted into a `KeyAlgorithmSupport` 
helper that **both**
   implementations now use. `FileBasedKeyLifecycleManager`'s behaviour is 
unchanged — it just delegates.
   
   ## Documentation
   
   None needed: the existing examples (including the migration snippet and the 
`clear()`-based test setup)
   already match this API exactly. They now actually compile.
   
   ## Testing
   
   New `InMemoryKeyLifecycleManagerTest` (11 tests): generate/retrieve, 
unknown-key handling, rotation
   (old → DEPRECATED, new → ACTIVE), rotation of an unknown key rejected, 
expire/revoke, list/delete,
   `needsRotation` by age and usage, PEM export/import round trip, 
`clear()`/`size()`, and a concurrent
   key-generation test covering the documented thread-safety.
   
   The existing FileBased suites (`PQCKeyLifecycleTest` 18, 
`PQCKeyLifecycleIntegrationTest` 10) still pass
   unchanged, confirming the extraction is behaviour-preserving — **39 green** 
in total. Full reactor build
   green.
   
   ## Backport
   
   None — improvement, `main` only (4.22.0).
   
   ---
   _Claude Code on behalf of Andrea Cosentino._
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to