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

test: cleanup test-crypto-dh.js #10753

Closed
wants to merge 1 commit into from
Closed
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
12 changes: 6 additions & 6 deletions test/parallel/test-crypto-dh.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ assert.strictEqual(dh2.verifyError, 0);

assert.throws(function() {
crypto.createDiffieHellman([0x1, 0x2]);
});
}, /TypeError: First argument should be number, string or Buffer/);

assert.throws(function() {
crypto.createDiffieHellman(function() { });
});
}, /TypeError: First argument should be number, string or Buffer/);

assert.throws(function() {
crypto.createDiffieHellman(/abc/);
});
}, /TypeError: First argument should be number, string or Buffer/);

assert.throws(function() {
crypto.createDiffieHellman({});
});
}, /TypeError: First argument should be number, string or Buffer/);

// Create "another dh1" using generated keys from dh1,
// and compute secret again
Expand Down Expand Up @@ -178,7 +178,7 @@ const key3 = ecdh3.generateKeys();

assert.throws(function() {
ecdh2.computeSecret(key3, 'latin1', 'buffer');
});
}, /Error: Failed to translate Buffer to a EC_POINT/);

// ECDH should allow .setPrivateKey()/.setPublicKey()
const ecdh4 = crypto.createECDH('prime256v1');
Expand Down Expand Up @@ -258,7 +258,7 @@ ecdh5.setPrivateKey(cafebabeKey, 'hex');
'0000000000000000000000000000000000000000000000000000000000000000',
'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141',
'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF',
].forEach(function(element, index, object) {
].forEach(function(element) {
assert.throws(function() {
ecdh5.setPrivateKey(element, 'hex');
}, /Private key is not valid for specified curve/);
Expand Down