-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
crypto: Assertation failed when createPrivateKey(PUBLIC) #29904
Comments
@nodejs/crypto @tniessen |
@tespent can you provide a runnable reproduction, I can't repro:
|
|
Thanks, I can repro |
Its because spki is a public key format, and it isn't handled in the private key parsing code. I'm rebuildign to see if this fixes it:
|
Right, but I believe execution shouldn't even get to |
Fixes: #29904 PR-URL: #29913 Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
Fixes: #29904 PR-URL: #29913 Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
crypto.createPrivateKey
raise an assertation failure when trying to import a public key.Output of v12.11.1:
I have tried
keyPair=require('crypto').generateKeyPairSync('rsa',{modulusLength:4096})
andkeyPair=require('crypto').generateKeyPairSync('ec',{namedCurve:'P-256'})
, the result are the same.The text was updated successfully, but these errors were encountered: