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 Broken #400
Comments
This looks like an error in OpenSSL due to an invalid certificate. Switch to |
Yeah I was just trying to highlight in the simplest way that RS256 wasn't working using their code. Unfortunately Google's OAuth2 requires RSA256 so I'm stuck waiting. |
This looks like an issue with the certificate (either invalid or being fed to the library wrong). I can confirm that RSA is working in Can you provide the public key and some of the code that is failing for you? I can try to help debug. |
I was having the same error show up when I was attempting to .verify() an RS256 token. The solution for me was to ensure the "secret" value (signing certificate) included proper newlines. Hope this tip helps anyone else googling PEM_read_bio. Example:
|
Be sure you use the private key to sign and public key to verify. We have some example in tests, just in case the format is incorrect or not well loaded: |
Can confirm that this works. If you are not reading from a file but are using a string, make sure the string is
In our case we have the following setup :
For base64 encoding the pem private/public keys we devised the following command :
|
I am also experiencing this issue against 8.3.0. It seems to have something to do with whitespace at the beginning or end of the public key. Minimal repro case:
Error:
Keys were generated like this:
This can be worked around by:
|
Thank you, this is exactly what i needed. |
使用OpenSSL生成 RSA公钥与私钥可以解决 |
To generate private and public key use: ssh-keygen -t rsa -b 4096 -m PEM -f private.key Then to read jwtRS256.key file : Don't forget to git ignore those files! 👯 |
If you try to use this to generate a RS256 signature it just returns an error.
Error: error:0906D06C:PEM routines:PEM_read_bio:no start line
at Sign.sign in core crypto.js — line 329
at Object.sign in jwa/index.js — line 55
at Object.jwsSign (as sign) in jws/lib/sign-stream.js — line 23
at module.exports (as sign) in jsonwebtoken/sign.js — line 178
in this notebook — line 5
at Generator.next in core — line 0
at Generator.next in core — line 0
var jsonwebtoken = require("jsonwebtoken")
var cert = "testing";
var token = jsonwebtoken.sign({ foo: 'bar' }, cert, { algorithm: 'RS256'});
console.log(token);
Using their own code from documentation. Switch the R for an H in the algorith section and watch it work.
The text was updated successfully, but these errors were encountered: