jwtgen icon indicating copy to clipboard operation
jwtgen copied to clipboard

How to use jwtgen with RS256

Open AlexandreHagen opened this issue 8 years ago • 3 comments

I tried this:

jwtgen -a "RS256" -p app/var/jwt/private.pem -c "[email protected]"

I got it:

crypto.js:283
  var ret = this._handle.sign(toBuf(key), null, passphrase);
                         ^

Error: error:0906A068:PEM routines:PEM_do_header:bad password read
    at Error (native)
    at Sign.sign (crypto.js:283:26)
    at sign (/usr/local/lib/node_modules/jwtgen/node_modules/jwt-simple/lib/jwt.js:170:57)
    at Object.jwt_encode [as encode] (/usr/local/lib/node_modules/jwtgen/node_modules/jwt-simple/lib/jwt.js:133:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/jwtgen/jwtgen.js:138:17)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

Crypto.js need passphrase ! But how pass passphrase in jwtgen ?

AlexandreHagen avatar Nov 04 '16 13:11 AlexandreHagen

Unfortunately, the library that we're using (jwt-simple) does not allow the use passphrases. I'll contact the author and see if we can fork and suggest a patch for such functionality.

richardhyatt avatar Nov 04 '16 16:11 richardhyatt

Thanks @richardhyatt ! Linked to: https://github.com/hokaccha/node-jwt-simple/issues/51

AlexandreHagen avatar Nov 06 '16 21:11 AlexandreHagen

Are there still news on this?

datenwort avatar Nov 10 '17 11:11 datenwort