-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Feature Request: Built-In RSA Key Parser for JWT Signing (RSA PEM to JWK) #3765
Comments
Got me curious re: how these are encoded... seems like it's asn1:
|
Im recalling all the crypto concepts from the security course back in school 😆 here is what I found an online tool that does the RSA private key conversion to jwk: https://russelldavies.github.io/jwk-creator/ |
💭 I guess we could also make |
That would be absolutely more easy for end users, honestly at the beginning when I worked on my POC it took me a little time to find out the "kty" is actually required even for a symmetric key. Everything become more clear when I have the source code cloned and run locally. I did some "google search" before I submit this issue because I thought it was only me that did not figure out how to convert from PEM to JWK in the rego, but looks no one else seeing this before. So it might be a minority issue 😃, and I guess for now it's ok to only make a simple built-in to unblock the whole process. If we want to go with the full solution later, I think there would be a lot places in the code needed to be updated, and the doc will need to be updated as well as notify the end users regarding the updates. |
Agreed. While the encode functions are rarely used compared to the decoding ones, supporting PEM formatted private keys would simplify things, as that's what you'll normally get from the OpenSSL commands commonly used in examples. |
Hi there, @srenatus and @anderseknert , I have made the changes in my local, could you please walk me thru how to create a pull request? I made a branch locally named "#3765" but I can't push due to permission denied. |
Oh great! Thank you! In short, you'll have to push your branch to a fork of this repo. If you fork it, you'll have full access to your fork and push it there. When you've done that, you can open a PR using github's features. See for example https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork. |
Also let us know if you get stuck there. Happy to help! |
Thanks for the information, and I have created a PR, could anyone please take a look? Thanks again. |
This will help users for JWT signing using RSA key, because currently OPA only accepts RSA key in the JWK format. Fixes: open-policy-agent#3765 Signed-off-by: cris-he <cruztiempo@hotmail.com>
…t#3783) This will help users for JWT signing using RSA key, because currently OPA only accepts RSA key in the JWK format. Fixes: open-policy-agent#3765 Signed-off-by: cris-he <cruztiempo@hotmail.com> Signed-off-by: Dolev Farhi <farhi.dolev@gmail.com>
Expected Behavior
I generated a pair of RSA keys that will be used for JWT signing, and in the example on the OPA docs (https://www.openpolicyagent.org/docs/v0.14.2/policy-reference/#rsa-key-rsa-signature-with-sha-256), it is asking the RSA key in the JWK format where contains the algo params (e.g. "n", "e", "d", "p", "q" etc.)
I am looking for a built-in function that can convert the RSA key into the JWK, so end users can use it in the rego file.
The text was updated successfully, but these errors were encountered: