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.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/simple/test-crypto.js b/test/simple/test-crypto.js
index cfbc5428f4..95fdf7fc41 100644
--- a/test/simple/test-crypto.js
+++ b/test/simple/test-crypto.js
@@ -926,3 +926,25 @@ assert.throws(function() {
c.update('update', 'utf-8');
c.final('utf8'); // Should not throw.
})();
+
+// Regression tests for #5725: hex input that's not a power of two should
+// throw, not assert in C++ land.
+assert.throws(function() {
+ crypto.createCipher('aes192', 'test').update('0', 'hex');
+}, /Bad input string/);
+
+assert.throws(function() {
+ crypto.createDecipher('aes192', 'test').update('0', 'hex');
+}, /Bad input string/);
+
+assert.throws(function() {
+ crypto.createHash('sha1').update('0', 'hex');
+}, /Bad input string/);
+
+assert.throws(function() {
+ crypto.createSign('RSA-SHA1').update('0', 'hex');
+}, /Bad input string/);
+
+assert.throws(function() {
+ crypto.createVerify('RSA-SHA1').update('0', 'hex');
+}, /Bad input string/);