jose cli - Poor feedback on error
I tried to generate a key using the following command:
./jose jwk gen -i '{"alg": "RS256"}' -o mykey.jwk
And various variations on that theme. But the only response I seem to be able to get is JWK generation failed!. It would be nice if the tool helped a bit and let you know what you are doing wrong.
I agree. This is bad. I'll try to address this in a future release.
Hello Henry ! How are you ? Just now I tried to reproduce your problem. I did not reproduce it. What I did exactly: OS Enviromnment: FC 29 x86_64
- built and installed Python-3.6.7
- built and installed cmake-3.13.1
- built and installed meson-0.49.0 for the python3
- built and installed jose. Besides I copied to the /usr/lib64/ all libraries from the build directory
- executed an affective command: jose jwk gen -i '{"alg": "RS256"}' -o mykey.jwk The mykey.jwk file was produced without of any problem. According of the problem description, you have had run a jose from the current directory. ./jose jwk gen -i '{"alg": "RS256"}' -o mykey.jwk May be, you built and installed the jose manually and did not copy all necessary libraries to the /usr/lib64. What kind of Os does you use ? How did you install the jose ?
With Best regards Oleg Nikitenko
A couple of more experiments: pure system FC29 x86_64, only jose package was install. jose binary placed in /usr/bin directory. Inside of the /usr/bin/ directory: ./jose jwk gen -i '{"alg": "RS256"}' -o mykey.jwk produces no file and help output sudo jose jwk gen -i '{"alg": "RS256"}' -o mykey.jwk works fine. On system where was build all packages previously: All distcleaned and uninstalled. The jose binary is placed in the build directory ./jose jwk gen -i '{"alg": "RS256"}' -o mykey.jwk works fine.
@oleshii try this:
$ jose jwk gen -i '{"alg": "RS255"}' -o mykey.jwk
The error message is non descriptive. It would be nice if the tool provided a hint regarding what is wrong with the input parameters or why exactly it couldn't generate the jwk.
Thanks a lot, Daniel. I got it.
Hello Daniel, Happy Merry Christmas and New Year ! I changed the jose-master/cmd/jwkgen.c file. I git results: Input: ./jose jwk gen -i '{"keys":[{"alg":"RS2"},{"alg":"ES256"}]}' -o - Output: jwk_error_handler Generation failed by unknown algo RS2!
Input: ./jose jwk gen -i '{"keys":[{"yuh":"RS2"},{"alg":"ES256"}]}' -o - Output: jwk_error_handler Generation failed by unknown algo selector yuh!
I sent the modified gen.c file to your work e-mail.
With Best regards Oleg Nikitenko
Hello @oleshii. Thanks for the change. Could you please open a PR from it?