jose icon indicating copy to clipboard operation
jose copied to clipboard

jose cli - Poor feedback on error

Open hkleynhans opened this issue 8 years ago • 7 comments

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.

hkleynhans avatar Oct 25 '17 15:10 hkleynhans

I agree. This is bad. I'll try to address this in a future release.

npmccallum avatar Oct 26 '17 20:10 npmccallum

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

  1. built and installed Python-3.6.7
  2. built and installed cmake-3.13.1
  3. built and installed meson-0.49.0 for the python3
  4. built and installed jose. Besides I copied to the /usr/lib64/ all libraries from the build directory
  5. 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

oleshii avatar Dec 12 '18 06:12 oleshii

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 avatar Dec 14 '18 07:12 oleshii

@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.

dkopecek avatar Dec 14 '18 11:12 dkopecek

Thanks a lot, Daniel. I got it.

oleshii avatar Dec 17 '18 06:12 oleshii

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

oleshii avatar Dec 25 '18 06:12 oleshii

Hello @oleshii. Thanks for the change. Could you please open a PR from it?

sarroutbi avatar Oct 06 '21 15:10 sarroutbi