Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
test: add dsaEncoding compatibility test
This adds a test case for the dsaEncoding option using data generated
in Chrome 76.
  • Loading branch information
tniessen committed Nov 19, 2019
commit 9caf740905107dcc87ad6022bd61d92a27e59d37
16 changes: 16 additions & 0 deletions test/parallel/test-crypto-sign-verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,22 @@ common.expectsError(
}
}

// Test verifying externally signed messages.
const extSig = Buffer.from('494c18ab5c8a62a72aea5041966902bcfa229821af2bf65' +
'0b5b4870d1fe6aebeaed9460c62210693b5b0a300033823' +
'33d9529c8abd8c5948940af944828be16c', 'hex');
for (const ok of [true, false]) {
assert.strictEqual(
crypto.verify('sha256', data, {
key: fixtures.readKey('ec-key.pem'),
dsaEncoding: 'ieee-p1363'
}, extSig),
ok
);

extSig[Math.floor(Math.random() * extSig.length)] ^= 1;
}

// Non-(EC)DSA keys should ignore the option.
const sig = crypto.sign('sha1', data, {
key: keyPem,
Expand Down