-
Notifications
You must be signed in to change notification settings - Fork 10
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
Got 'undefined' when using this library. #4
Comments
I am facing exactly the same issue. I tried using 'private' in place of 'public' for generating var JWK. Same issue. |
Hey @modu, I found another Python package to generate JWK and it works. |
This library only supports the You should think about using a better implementation as this project uses a quick hack. Since we wrote this |
Yea this project is broken. |
Make sure there is a newline at the end of your PEM block. It took a few tries but that seemed to be the trick. This works for me: const rsaPemToJwk = require("rsa-pem-to-jwk");
const pem = `-----BEGIN RSA PRIVATE KEY-----
...
...
...
-----END RSA PRIVATE KEY-----
`;
rsaPemToJwk(pem, {use: "sig"}, "public");
// => { kty: 'RSA', use: 'sig', ... } |
Instead of |
Fixed in #6. |
A possible solution could be to add a new line at the end of the PEM file:
|
Seems like this library is using a very old outdated package (https://www.npmjs.com/package/rsa-unpack) ssh-keygen -t rsa -b 2048 -m PEM -f private.pem But not with |
You should maybe make this clear in the README.md that it is better to use |
Hi, I tried your library, and used your example code, but got
undefined
result instead of a JWK.I want a JWK only contains my Public key, so I runned your code as
Here is my PUBLIC key(the content of
pubk.pem
).Any ideas about this ?
The text was updated successfully, but these errors were encountered: