From 44c9fc7c0d151fc43fd0436085f4774a4b14a984 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Mon, 23 Apr 2018 12:39:14 +0200 Subject: [PATCH] test: remove crypto.DEFAULT_ENCODING usage This commit removes the usage of the deprectated crypto.DEFAULT_ENCODING. --- test/parallel/test-crypto-binary-default.js | 4 +++- test/parallel/test-crypto-certificate.js | 2 -- test/parallel/test-crypto-ecb.js | 2 -- test/parallel/test-crypto-padding-aes256.js | 2 -- test/parallel/test-crypto-padding.js | 2 -- test/parallel/test-crypto-random.js | 2 -- test/parallel/test-crypto-verify-failure.js | 2 -- test/parallel/test-crypto.js | 2 -- 8 files changed, 3 insertions(+), 15 deletions(-) diff --git a/test/parallel/test-crypto-binary-default.js b/test/parallel/test-crypto-binary-default.js index 6cdc894753c3ac..228e2cc8abdc81 100644 --- a/test/parallel/test-crypto-binary-default.js +++ b/test/parallel/test-crypto-binary-default.js @@ -20,6 +20,8 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; +// Flags: --expose-internals + // This is the same as test/simple/test-crypto, but from before the shift // to use buffers by default. @@ -36,7 +38,7 @@ const tls = require('tls'); const fixtures = require('../common/fixtures'); const DH_NOT_SUITABLE_GENERATOR = crypto.constants.DH_NOT_SUITABLE_GENERATOR; -crypto.DEFAULT_ENCODING = 'latin1'; +require('internal/crypto/util').setDefaultEncoding('latin1'); // Test Certificates const certPem = fixtures.readSync('test_cert.pem', 'ascii'); diff --git a/test/parallel/test-crypto-certificate.js b/test/parallel/test-crypto-certificate.js index f94c82474e95aa..acbfdf66cc78c4 100644 --- a/test/parallel/test-crypto-certificate.js +++ b/test/parallel/test-crypto-certificate.js @@ -29,8 +29,6 @@ const crypto = require('crypto'); const { Certificate } = crypto; const fixtures = require('../common/fixtures'); -crypto.DEFAULT_ENCODING = 'buffer'; - // Test Certificates const spkacValid = fixtures.readSync('spkac.valid'); const spkacFail = fixtures.readSync('spkac.fail'); diff --git a/test/parallel/test-crypto-ecb.js b/test/parallel/test-crypto-ecb.js index 4faf4af2c576fd..c88ebaabb05e7f 100644 --- a/test/parallel/test-crypto-ecb.js +++ b/test/parallel/test-crypto-ecb.js @@ -30,8 +30,6 @@ if (common.hasFipsCrypto) const assert = require('assert'); const crypto = require('crypto'); -crypto.DEFAULT_ENCODING = 'buffer'; - // Testing whether EVP_CipherInit_ex is functioning correctly. // Reference: bug#1997 diff --git a/test/parallel/test-crypto-padding-aes256.js b/test/parallel/test-crypto-padding-aes256.js index ea31c7e894ee53..d6c395f0a42d35 100644 --- a/test/parallel/test-crypto-padding-aes256.js +++ b/test/parallel/test-crypto-padding-aes256.js @@ -27,8 +27,6 @@ if (!common.hasCrypto) const assert = require('assert'); const crypto = require('crypto'); -crypto.DEFAULT_ENCODING = 'buffer'; - const iv = Buffer.from('00000000000000000000000000000000', 'hex'); const key = Buffer.from('0123456789abcdef0123456789abcdef' + '0123456789abcdef0123456789abcdef', 'hex'); diff --git a/test/parallel/test-crypto-padding.js b/test/parallel/test-crypto-padding.js index 00b600efb735e8..d4a5b95cec9242 100644 --- a/test/parallel/test-crypto-padding.js +++ b/test/parallel/test-crypto-padding.js @@ -27,8 +27,6 @@ if (!common.hasCrypto) const assert = require('assert'); const crypto = require('crypto'); -crypto.DEFAULT_ENCODING = 'buffer'; - // Input data. const ODD_LENGTH_PLAIN = 'Hello node world!'; const EVEN_LENGTH_PLAIN = 'Hello node world!AbC09876dDeFgHi'; diff --git a/test/parallel/test-crypto-random.js b/test/parallel/test-crypto-random.js index 77801f6d53eef2..f00e474b6f2798 100644 --- a/test/parallel/test-crypto-random.js +++ b/test/parallel/test-crypto-random.js @@ -32,8 +32,6 @@ const { kMaxLength } = require('buffer'); const kMaxUint32 = Math.pow(2, 32) - 1; const kMaxPossibleLength = Math.min(kMaxLength, kMaxUint32); -crypto.DEFAULT_ENCODING = 'buffer'; - // bump, we register a lot of exit listeners process.setMaxListeners(256); diff --git a/test/parallel/test-crypto-verify-failure.js b/test/parallel/test-crypto-verify-failure.js index 72dfb926413d8b..7e9fda9f6791f6 100644 --- a/test/parallel/test-crypto-verify-failure.js +++ b/test/parallel/test-crypto-verify-failure.js @@ -29,8 +29,6 @@ const crypto = require('crypto'); const tls = require('tls'); const fixtures = require('../common/fixtures'); -crypto.DEFAULT_ENCODING = 'buffer'; - const certPem = fixtures.readSync('test_cert.pem', 'ascii'); const options = { diff --git a/test/parallel/test-crypto.js b/test/parallel/test-crypto.js index 3047d37c962cff..9a93e8422fd0b4 100644 --- a/test/parallel/test-crypto.js +++ b/test/parallel/test-crypto.js @@ -30,8 +30,6 @@ const crypto = require('crypto'); const tls = require('tls'); const fixtures = require('../common/fixtures'); -crypto.DEFAULT_ENCODING = 'buffer'; - // Test Certificates const caPem = fixtures.readSync('test_ca.pem', 'ascii'); const certPem = fixtures.readSync('test_cert.pem', 'ascii');