Skip to content

[keymanager/wsd] Add /keys:destroy Go KOL handler with KEM + binding key destruction#651

Open
atulpatildbz wants to merge 1 commit intogoogle:mainfrom
atulpatildbz:wsd_destroy_go
Open

[keymanager/wsd] Add /keys:destroy Go KOL handler with KEM + binding key destruction#651
atulpatildbz wants to merge 1 commit intogoogle:mainfrom
atulpatildbz:wsd_destroy_go

Conversation

@atulpatildbz
Copy link
Collaborator

@atulpatildbz atulpatildbz commented Feb 9, 2026

Implements the Go orchestration layer (KOL) for POST /v1/keys:destroy, the key destruction endpoint that allows workloads to explicitly destroy a key pair.

Flow:

  1. Workload sends {key_handle: {handle: ...}} to WSD
  2. WSD looks up binding UUID from the KEM→Binding map
  3. WSD calls KPS DestroyKEMKey — destroys the KEM key from the registry
  4. WSD calls WSD KCC DestroyBindingKey — destroys the binding key from the registry
  5. WSD removes the KEM→Binding mapping
  6. Returns 204 No Content

Changes:

  • C headers: Added key_manager_destroy_kem_key (KPS) and key_manager_destroy_binding_key (WSD) declarations
  • CGO bridges: Added DestroyKEMKey() and DestroyBindingKey() Go wrappers for the Rust FFI functions
  • KPS service: Extended Service with DestroyKEMKey method and KEMKeyDestroyer interface
  • WSD server: Added KEMKeyDestroyer/BindingKeyDestroyer interfaces, DestroyRequest type, handleDestroy handler, /v1/keys:destroy route registration
  • Tests: 7 new destroy handler tests + 2 new KPS service tests + Integration test TestIntegrationDestroyKey

Dependencies

This PR is built on top of:

What to review

Please review the following commits:

  1. d1d6badfeat(keymanager): Add manual FFI headers for destroy (C headers for destroy)
  2. 60466aa[keymanager/wsd] Add /keys:destroy endpoint with KEM + binding key destruction (Go implementation)

All other commits are from dependencies (PRs #647, #652) that are not yet merged to main but required for this build.

Verification

Automated Tests

  • Unit tests: go test ./keymanager/workload_service/... (Passed)
  • Integration tests: go test -tags=integration ./keymanager/workload_service/... (Passed)

Manual Verification (Curl)

Manually verified the destruction workflow locally:

  1. Generate Key: POST /v1/keys:generate_kem -> Returns Handle.
  2. Destroy Key (First): POST /v1/keys:destroy -> Returns 204.
  3. Destroy Key (Second): POST /v1/keys:destroy -> Returns 404 (Key mapping removed).

@atulpatildbz atulpatildbz force-pushed the wsd_destroy_go branch 2 times, most recently from 60466aa to cff8e70 Compare February 18, 2026 07:07
@atulpatildbz atulpatildbz force-pushed the wsd_destroy_go branch 7 times, most recently from 4d76482 to 87f6a9f Compare February 26, 2026 19:21

// NewServer creates a new WSD server with the given dependencies.
func NewServer(bindingGen BindingKeyGenerator, kemGen KEMKeyGenerator) *Server {
func NewServer(bindingGen BindingKeyGenerator, kemGen KEMKeyGenerator, kemKeyDestroyer KEMKeyDestroyer, bindingKeyDestroyer BindingKeyDestroyer) *Server {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will need change after #678 is merged.
May have to rebase over that

…struction

Implement the Go KOL handler for POST /keys:destroy that orchestrates
the full key destruction flow:
1. Workload sends {kemKeyHandle} to WSD
2. WSD looks up binding UUID from KEM-to-binding map
3. WSD calls KPS DestroyKEMKey to destroy the KEM key
4. WSD calls WSD KCC DestroyBindingKey to destroy the binding key
5. WSD removes the KEM→Binding mapping
6. Returns 204 No Content

Changes:
- C headers: add key_manager_destroy_kem_key (KPS) and
  key_manager_destroy_binding_key (WSD) declarations
- CGO bridges: add DestroyKEMKey and DestroyBindingKey Go wrappers
- KPS service: extend with DestroyKEMKey method and KEMKeyDestroyer
  interface
- WSD server: add KEMKeyDestroyer/BindingKeyDestroyer interfaces,
  DestroyRequest type, handleDestroy handler, /keys:destroy route
- Tests: 7 new destroy handler tests + 2 new KPS service tests

Remove DecapAndSeal and Open from KPS and WSD
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.

1 participant