summaryrefslogtreecommitdiff
path: root/test/parallel/test-crypto-binary-default.js
diff options
context:
space:
mode:
authorStefan Budeanu <stefan@budeanu.com>2015-11-09 00:00:56 -0500
committerJames M Snell <jasnell@gmail.com>2015-11-20 09:35:58 -0800
commit56a2b9a24680841c5abe5660764fde06e01bdddc (patch)
treeb36ac697df526b8c12ed8e3719a2b4d5ff9cc479 /test/parallel/test-crypto-binary-default.js
parent6de82c69a00a1515dbf4019c4f27bb1f82c508e0 (diff)
downloadandroid-node-v8-56a2b9a24680841c5abe5660764fde06e01bdddc.tar.gz
android-node-v8-56a2b9a24680841c5abe5660764fde06e01bdddc.tar.bz2
android-node-v8-56a2b9a24680841c5abe5660764fde06e01bdddc.zip
crypto: disable crypto.createCipher in FIPS mode
FIPS 140-2 disallows use of MD5, which is used to derive the initialization vector and key for createCipher(). Modify all tests to expect exceptions in FIPS mode when disallowed API is used, or to avoid testing such API in FIPS Mode. PR-URL: https://github.com/nodejs/node/pull/3754 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-crypto-binary-default.js')
-rw-r--r--test/parallel/test-crypto-binary-default.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/test/parallel/test-crypto-binary-default.js b/test/parallel/test-crypto-binary-default.js
index 6299c86908..806f5de18b 100644
--- a/test/parallel/test-crypto-binary-default.js
+++ b/test/parallel/test-crypto-binary-default.js
@@ -496,12 +496,13 @@ function testCipher4(key, iv) {
assert.equal(txt, plaintext, 'encryption and decryption with key and iv');
}
+if (!common.hasFipsCrypto) {
+ testCipher1('MySecretKey123');
+ testCipher1(new Buffer('MySecretKey123'));
-testCipher1('MySecretKey123');
-testCipher1(new Buffer('MySecretKey123'));
-
-testCipher2('0123456789abcdef');
-testCipher2(new Buffer('0123456789abcdef'));
+ testCipher2('0123456789abcdef');
+ testCipher2(new Buffer('0123456789abcdef'));
+}
testCipher3('0123456789abcd0123456789', '12345678');
testCipher3('0123456789abcd0123456789', new Buffer('12345678'));