-
Notifications
You must be signed in to change notification settings - Fork 377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support verifying signature signed using x5c header #59
Comments
We need to implement JWK for that. You may have a look at the 2.x branch. |
Don't forget, you need the ENTIRE certificate chain in that field. The signing certificate first followed by each intermediate and root CA that owns that one. |
@stunney It 'MAY' contain the entire certificate chain. The last certificate in the x5c chain could be rooted in a certificate store managed by the entity validating the token. |
You are correct. The first must be the cert that signed the token. The rest are optional. |
adding to this, using a keyfinder block is really ugly if you have additionaly options to pass in. JWT.decode(raw_token, nil, true, additional_options) do |header|
...
end I don't like that I have to pass in a key ( |
Hey @punkle @excpt, I'm taking a quick stab at this since I need support for this. Open question: Should this be implementing x5c as specified in JWS (RFC-7515) or as specified in JWK? JWS spec for x5c:
JWK spec for x5c:
the main difference being that the JWK spec also wants you to supply the public key in one of the JWK fields, which feels redundant to me since it is already in the x5c field's first cert. |
@itstehkman I am not very familiar with the specs. Can both be supported? |
@itstehkman I would go for the JWS RFC 7515 specs. This should keep things as simple and should avoid the redundancy. |
Sounds good! After taking a look at most common implementations, they use the JWK RFC. I can probably do this in two parts - first part supporting the JWK implementation, then the pure JWS implementation too. |
It is currently possible to verify the signature of a jwt token using the x5c header by providing a key finder function. e.g.
In order to validate the x5c certificate chain in full, I must provide my own implementation. It would be great if ruby-jwt gem could support the validation of the x5c certificate chain natively.
Here is an excerpt from https://tools.ietf.org/html/draft-ietf-jose-json-web-key-41#section-4.7
The text was updated successfully, but these errors were encountered: