test: increase diffie-hellman test coverage
PR-URL: https://github.com/nodejs/node/pull/17728 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me>
This commit is contained in:
parent
416c0ec952
commit
410ce2164e
@ -22,6 +22,28 @@ assert.strictEqual(secret2.toString('base64'), secret1);
|
||||
assert.strictEqual(dh1.verifyError, 0);
|
||||
assert.strictEqual(dh2.verifyError, 0);
|
||||
|
||||
{
|
||||
const DiffieHellman = crypto.DiffieHellman;
|
||||
const dh = DiffieHellman(p1, 'buffer');
|
||||
assert(dh instanceof DiffieHellman, 'DiffieHellman is expected to return a ' +
|
||||
'new instance when called without `new`');
|
||||
}
|
||||
|
||||
{
|
||||
const DiffieHellmanGroup = crypto.DiffieHellmanGroup;
|
||||
const dhg = DiffieHellmanGroup('modp5');
|
||||
assert(dhg instanceof DiffieHellmanGroup, 'DiffieHellmanGroup is expected ' +
|
||||
'to return a new instance when ' +
|
||||
'called without `new`');
|
||||
}
|
||||
|
||||
{
|
||||
const ECDH = crypto.ECDH;
|
||||
const ecdh = ECDH('prime256v1');
|
||||
assert(ecdh instanceof ECDH, 'ECDH is expected to return a new instance ' +
|
||||
'when called without `new`');
|
||||
}
|
||||
|
||||
[
|
||||
[0x1, 0x2],
|
||||
() => { },
|
||||
|
Loading…
x
Reference in New Issue
Block a user