You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to use JsonWebToken when I don't have a DER and can't use command line tools #68
I have a rust service that needs to verify JWTs from 3rd-party services that I do not control. The 3rd party service (Portier, in this case) supplies the RSA public components (n modulus, and e exponent). Given that jsonwebtoken can only read DER encoded keys and that I cannot manually run the recommended command-line options for OpenSSL, what is the recommended way of being able to decode a JWT using JsonWebToken in a rust service?
I don't think there is currently an easy way to do that. It would be nice to have a function in jsonwebtoken that does the DER conversion but haven't looked into that yet.
// jwt library expects a `*.der` key wich is a byte encoded file so// we need to convert the key from base64 to their byte value to use them.let private_key = from_base64_to_bytearray_non_url(PRIVATE_KEY_TEST).expect("priv_key");
Activity
Keats commentedon Dec 5, 2018
I don't think there is currently an easy way to do that. It would be nice to have a function in
jsonwebtokenthat does the DER conversion but haven't looked into that yet.AaronFriel commentedon Jan 2, 2019
@Keats there appears to be a function in Ring that will do this: https://briansmith.org/rustdoc/ring/signature/primitive/fn.verify_rsa.html
Would you consider a PR that would add a function with a signature like the following?
Edit: Added the missing key parameter to the signature of the method.
mikeumus commentedon Dec 12, 2019
@greglearns there's these methods from azure-jwt (rust) repo in GitHub that can convert a KEY to a DER format:
Keats commentedon Dec 12, 2019
v7 alpha also does it