Skip to content
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: fix crypto.verify callback invocation with a private keyobject #37795

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/crypto/crypto_sig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ bool SignTraits::DeriveBits(
}
break;
case SignConfiguration::kVerify:
CHECK_EQ(params.key->GetKeyType(), kKeyTypePublic);
CHECK_NE(params.key->GetKeyType(), kKeyTypeSecret);
if (!EVP_DigestVerifyInit(
context.get(),
&ctx,
Expand Down
4 changes: 3 additions & 1 deletion test/parallel/test-crypto-async-sign-verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ function test(
}));
}

for (const key of [publicPem, publicKey, publicDer]) {
const verifyInputs = [
publicPem, publicKey, publicDer, privatePem, privateKey, privateDer];
for (const key of verifyInputs) {
crypto.verify(algorithm, data, key, expected, common.mustSucceed(
(verified) => assert.strictEqual(verified, true)));

Expand Down