-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Using JWK as encoding format for public key in crypto.generateKeyPairSync() throws an error #39205
Comments
The combination |
My cryptographic skills are lacking so I just picked "spki" because it was the only type that private EC keys supported according to the documentation. But from what I've tested, not using the "type" option at all throws the same error. |
🤦♂️ i forgot about this interaction
A simple |
This comment has been minimized.
This comment has been minimized.
Fixes: #39205 PR-URL: #39319 Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: James M Snell <[email protected]>
I believe the issue also exist on node 15 but was not fixed: https://github.com/D4nte/js-libp2p-crypto/runs/4438572378?check_suite_focus=true Can the fix be backported to 15? Cc @jasnell |
@D4nte the fix was never meant to land on v15.x since it has reached End-Of-Life on 2021-06-01. |
What steps will reproduce the bug?
main.js
then just execute the command
node main.js
How often does it reproduce? Is there a required condition?
Everytime. If I change the public key encoding format to "pem" or "der" it dosen't throw an error. It seems like "jwk" is the only broken format.
What is the expected behavior?
Should probably look something like the output below. I used the keyObject.export() to create this output because as mentioned above, crypto.generateKeyPairSync() dosen't work at all with "jwk".
Code to produce the expected output:
Expected output:
What do you see instead?
Additional information
Tested on both node version v16.4.0 and v15.9.0 (v15.9.0 was when keyObject.export() first started to support "jwk" as format.
The text was updated successfully, but these errors were encountered: