Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
Closed
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.cryptoIssues and PRs related to the crypto subsystem.Issues and PRs related to the crypto subsystem.
Description
Introduced in #37500 (released with v15.12.0) the function call crashes node when a private key object is passed to verify when using the callback argument.
constcrypto=require('crypto');constassert=require('assert');constdata=Buffer.from('hello');const{ privateKey }=crypto.generateKeyPairSync('ed25519');constsignature=crypto.sign(null,data,privateKey);assert(crypto.verify(null,data,privateKey,signature));// OKcrypto.verify(null,data,privateKey,signature,(err,verified)=>{// 💥assert(!err);assert(verified);});node[49326]: ../src/crypto/crypto_sig.cc:850:static bool node::crypto::SignTraits::DeriveBits(node::Environment *, const node::crypto::SignConfiguration &, node::crypto::ByteSource *): Assertion `(params.key->GetKeyType()) == (kKeyTypePublic)' failed. This can never happen in webcrypto where this implementation was first used but it is a valid input for one shot verify.
I'm looking into a fix and expanding the test suite.
cc @jasnell
mcollina
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.cryptoIssues and PRs related to the crypto subsystem.Issues and PRs related to the crypto subsystem.