Skip to content

Commit bfe3f21

Browse files
panvaruyadorno
authored andcommitted
crypto: fix crypto.verify callback invocation with a private keyobject
fixes #37794 PR-URL: #37795 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 505f9c9 commit bfe3f21

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/crypto/crypto_sig.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ bool SignTraits::DeriveBits(
847847
}
848848
break;
849849
case SignConfiguration::kVerify:
850-
CHECK_EQ(params.key->GetKeyType(), kKeyTypePublic);
850+
CHECK_NE(params.key->GetKeyType(), kKeyTypeSecret);
851851
if (!EVP_DigestVerifyInit(
852852
context.get(),
853853
&ctx,

test/parallel/test-crypto-async-sign-verify.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ function test(
5252
}));
5353
}
5454

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

0 commit comments

Comments
 (0)