Skip to content

Add abstraction for managing pools of certified keys. - #1978

Merged
davidz25 merged 1 commit into
mainfrom
reader-key-manager
Sep 4, 2026
Merged

Add abstraction for managing pools of certified keys.#1978
davidz25 merged 1 commit into
mainfrom
reader-key-manager

Conversation

@davidz25

@davidz25 davidz25 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Add an abstraction for managing pools of keys generated locally in a secure area and certified by a certifying authority:

  • In CertifiedKeyManager, implement a key pool manager backed by any SecureArea and Storage implementation. Support batch certification of locally generated keys, proactive replenishment when the pool of fresh keys falls below 50%, proactive key retirement after two thirds of certificate validity, resilient offline operation by retaining the last valid key during network outages, and self-healing cleanup of stale keys removed from the underlying secure area.
  • Expose CertifiedKeyManager.createWithSingleKeyCertifier() to support single-key certification callbacks without JVM method signature clashes.
  • In CertifiedKeyManagerTest, add comprehensive multiplatform unit tests covering happy path retrieval, batch replenishment, key expiration, offline degradation, stale key cleanup, single-key certifier factory creation, and pool clearing.

Fixes #1977.

Test: Ran ./gradlew :multipaz:jvmTest
Test: Ran ./gradlew :multipaz:assemble
Test: Ran ./gradlew detekt

Add an abstraction for managing pools of keys generated locally in a
secure area and certified by a certifying authority:

- In `CertifiedKeyManager`, implement a key pool manager backed by any
  `SecureArea` and `Storage` implementation. Support batch certification of
  locally generated keys, configurable proactive replenishment threshold
  (`replenishThresholdFraction`, defaulting to 50%), configurable key
  retirement threshold (`refreshThresholdFraction`, defaulting to two
  thirds of certificate validity), resilient offline operation by retaining
  the last valid key during network outages, and self-healing cleanup of
  stale keys removed from the underlying secure area.
- Expose `CertifiedKeyManager.createWithSingleKeyCertifier()` to support
  single-key certification callbacks without JVM method signature clashes.
- In `CertifiedKeyManagerTest`, add comprehensive multiplatform unit tests
  covering happy path retrieval, batch replenishment, key expiration, offline
  degradation, stale key cleanup, single-key certifier factory creation, pool
  clearing, and custom threshold configurations.

Fixes #1977.

Test: Ran ./gradlew :multipaz:jvmTest
Test: Ran ./gradlew :multipaz:assemble
Test: Ran ./gradlew detekt

Signed-off-by: David Zeuthen <zeuthen@gmail.com>
@davidz25
davidz25 merged commit 2cde7be into main Sep 4, 2026
4 of 5 checks passed
@davidz25
davidz25 deleted the reader-key-manager branch September 4, 2026 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add CertifiedKeyManager to manage pools of certified SecureArea keys

1 participant