summaryrefslogtreecommitdiff
path: root/test/simple/test-crypto.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/simple/test-crypto.js')
-rw-r--r--test/simple/test-crypto.js16
1 files changed, 11 insertions, 5 deletions
diff --git a/test/simple/test-crypto.js b/test/simple/test-crypto.js
index 01487aca88..1d913fe0b5 100644
--- a/test/simple/test-crypto.js
+++ b/test/simple/test-crypto.js
@@ -698,10 +698,21 @@ var secret3 = dh3.computeSecret(key2, 'hex', 'base64');
assert.equal(secret1, secret3);
+// Run this one twice to make sure that the dh3 clears its error properly
+(function() {
+ var c = crypto.createDecipher('aes-128-ecb', '');
+ assert.throws(function() { c.final('utf8') }, /wrong final block length/);
+})();
+
assert.throws(function() {
dh3.computeSecret('');
}, /key is too small/i);
+(function() {
+ var c = crypto.createDecipher('aes-128-ecb', '');
+ assert.throws(function() { c.final('utf8') }, /wrong final block length/);
+})();
+
// Create a shared using a DH group.
var alice = crypto.createDiffieHellmanGroup('modp5');
var bob = crypto.createDiffieHellmanGroup('modp5');
@@ -858,11 +869,6 @@ assert.equal(-1, crypto.getHashes().indexOf('SHA1'));
assert.equal(-1, crypto.getHashes().indexOf('SHA'));
assertSorted(crypto.getHashes());
-(function() {
- var c = crypto.createDecipher('aes-128-ecb', '');
- assert.throws(function() { c.final('utf8') }, /invalid public key/);
-})();
-
// Base64 padding regression test, see #4837.
(function() {
var c = crypto.createCipher('aes-256-cbc', 'secret');