Skip to content

Add staged request header decoding - #100

Open
endophysics wants to merge 1 commit into
martinthomson:mainfrom
endophysics:staged-header-decoding
Open

Add staged request header decoding#100
endophysics wants to merge 1 commit into
martinthomson:mainfrom
endophysics:staged-header-decoding

Conversation

@endophysics

Copy link
Copy Markdown

Adds staged server-side request decoding, following the approach discussed in #88 and the scope requested in #99.

Applications can inspect the request header to select a server key, then inspect the encapsulated key (enc) before initializing HPKE or decrypting the body.
This supports key rotation and lets callers reject known replays before cryptographic processing.

Changes

  • Add RequestHeader with the key ID and raw KEM, KDF, and AEAD identifiers.
  • Add Server::decode_header() and a borrowed ServerRequest for buffered requests.
  • Add Server::decode_header_stream(), with separate encapsulated-key decoding and receiver initialization for streamed requests.
  • Preserve decoded headers across validation and decapsulation failures.
  • Keep the existing decapsulate() and decapsulate_stream() convenience APIs.
  • Document staged decoding and caller-owned replay handling.
  • Extend CI coverage to streaming and isolated client/server feature sets, with MSRV-compatible dependency resolution.

Separate header and encapsulated-key inspection from HPKE setup for buffered and streaming requests while preserving the existing convenience APIs.

Cover key selection, validation failures, truncation, and cancelled stream reads. Extend CI to streaming and isolated feature sets with MSRV-aware dependency resolution.

@martinthomson martinthomson left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I just want to acknowledge this. I see a few problems that are worth following up on.

The CI change is a good one that is independent of the main change.

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.

2 participants