Skip to content

bh-status-list: Add x5c field to StatusListTokenHeader#114

Merged
ltomic merged 3 commits into
mainfrom
bh-status-list-x5c
Apr 14, 2026
Merged

bh-status-list: Add x5c field to StatusListTokenHeader#114
ltomic merged 3 commits into
mainfrom
bh-status-list-x5c

Conversation

@ltomic
Copy link
Copy Markdown
Contributor

@ltomic ltomic commented Apr 8, 2026

This PR is split into three commits :

  • Make StatusListTokenHeader kid field optional. The kid field is no longer mandatory since x5c field can also be used for public key information.
  • Add x5c field to StatusListTokenHeader. The field is made optional, same as kid field. There is no restrictions on the fields. Any combination of x5c and kid fields is valid.
  • Add StatusListToken::parse_unverified_header function. This commit adds StatusListToken::parse_unverified_header function so that the caller code can use it to inspect the kid and x5c values from the StatusListTokenHeader choose the public-key retrieval strategy, and then call the verify function with the fetched key. The alternative would be to inject a signature verifier which would potentially require async. This extra capability avoids color-coding the verify function with async.

@ltomic ltomic requested a review from m4t1j4 April 8, 2026 16:43
@ltomic ltomic marked this pull request as ready for review April 9, 2026 07:30
Comment on lines 51 to 56
pub fn new(
claims: StatusListTokenClaims,
kid: Option<String>,
x5c: Option<JwtX5Chain>,
key: &impl JwtSigner,
) -> Result<Self> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

With already two optional values, we might think about making a builder, or providing (set/with)_(kid/x5c/...) methods to make it cleaner. But no need to do it within this PR, just thinking out loud.

Comment thread bh-status-list/CHANGELOG.md Outdated
Comment thread bh-status-list/src/status_list_token.rs
Comment thread bh-status-list/src/status_list_token.rs Outdated
) -> Result<Self> {
let alg = key.algorithm();

// TODO: verify x5c leaf key is the JWT signing key
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

@ltomic ltomic force-pushed the bh-status-list-x5c branch from 2aa6f4d to 2c7fb8d Compare April 13, 2026 12:57
@ltomic ltomic force-pushed the bh-status-list-x5c branch from 2c7fb8d to 4c138f5 Compare April 13, 2026 14:07
ltomic added 2 commits April 13, 2026 16:12
This commit adds `StatusListTokenHeader::unverified_from_token` function
so that the caller code can use it to inspect the `kid` and `x5c` values
from the `StatusListTokenHeader`, choose the public-key retrieval
strategy, and then call the `verify` function with the fetched key. The
alternative would be to inject a signature verifier which would
potentially require `async`. This extra capability avoids color-coding
the `verify` function with `async`.
@ltomic ltomic force-pushed the bh-status-list-x5c branch from 4c138f5 to 3adb0b9 Compare April 13, 2026 14:14
@ltomic ltomic requested a review from m4t1j4 April 13, 2026 14:19

fn get_valid_jwt(alg: SigningAlgorithm, iss: UriBuf, sub: UriBuf, exp: Option<u64>) -> String {
let status_list = StatusListInternal::new(StatusBits::Eight, Option::None);
let status_list = StatusListInternal::new(StatusBits::Eight, None);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems I was using Option::None for some reason. 😅

@ltomic ltomic merged commit f51ab52 into main Apr 14, 2026
9 checks passed
@ltomic ltomic deleted the bh-status-list-x5c branch April 14, 2026 09:12
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