镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content
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