Skip to content
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

RS256 problem 4.2.x #70

Closed
graovic opened this issue Mar 17, 2015 · 6 comments
Closed

RS256 problem 4.2.x #70

graovic opened this issue Mar 17, 2015 · 6 comments

Comments

@graovic
Copy link

graovic commented Mar 17, 2015

Hi,

this package have a problem with decoding RS256 signed messages

var jwt = require('jsonwebtoken');
var fs = require('fs');
var cert_pub = fs.readFileSync('app.rsa.pub');
var cert_priv = fs.readFileSync('app.rsa');

var token = jwt.sign({ foo: 'bar' }, cert_priv, { algorithm: 'RS256'});
jwt.verify(token, cert_pub, function(err, decoded) {
console.log("Decoded: " + JSON.stringify(decoded));
console.log("Error: " + err);
});

This code woks fine in 4.1.0, but on 4.2.0 version problem is with verifying token.

@jfromaniello
Copy link
Member

What's the error you get? It seems to be working fine for me. Check the test I added on the branch issue_70.

jfromaniello added a commit that referenced this issue Mar 17, 2015
@graovic
Copy link
Author

graovic commented Mar 17, 2015

~/ cat package.json| grep json
"jsonwebtoken": "4.1.0",
~/ node testtoken.js
Decoded: {"foo":"bar","iat":1426605073}
Error: null

~/ cat package.json| grep json
"jsonwebtoken": "^4.2.0",
~/ node testtoken.js
Decoded: undefined
Error: JsonWebTokenError: invalid signature

@jfromaniello
Copy link
Member

can you give me the first line of your app.rsa.pub file? thanks

@graovic
Copy link
Author

graovic commented Mar 17, 2015

-----BEGIN PUBLIC KEY-----

@jfromaniello
Copy link
Member

got it! Thanks, it should be fixed on 4.2.1

@jedwards1211
Copy link
Contributor

jedwards1211 commented Jul 6, 2016

uhhh...my id_rsa.pub looks different:

ssh-rsa <KEY> <EMAIL>

Should this format be supported by jsonwebtoken?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants