Skip to content

Commit 9e9dad6

Browse files
danbevtniessen
authored andcommitted
test: remove crypto.DEFAULT_ENCODING usage
This commit removes the usage of the deprectated crypto.DEFAULT_ENCODING. PR-URL: nodejs#20221 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent 1ae5218 commit 9e9dad6

8 files changed

+3
-15
lines changed

test/parallel/test-crypto-binary-default.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
// USE OR OTHER DEALINGS IN THE SOFTWARE.
2121

2222
'use strict';
23+
// Flags: --expose-internals
24+
2325
// This is the same as test/simple/test-crypto, but from before the shift
2426
// to use buffers by default.
2527

@@ -36,7 +38,7 @@ const tls = require('tls');
3638
const fixtures = require('../common/fixtures');
3739
const DH_NOT_SUITABLE_GENERATOR = crypto.constants.DH_NOT_SUITABLE_GENERATOR;
3840

39-
crypto.DEFAULT_ENCODING = 'latin1';
41+
require('internal/crypto/util').setDefaultEncoding('latin1');
4042

4143
// Test Certificates
4244
const certPem = fixtures.readSync('test_cert.pem', 'ascii');

test/parallel/test-crypto-certificate.js

-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ const crypto = require('crypto');
2929
const { Certificate } = crypto;
3030
const fixtures = require('../common/fixtures');
3131

32-
crypto.DEFAULT_ENCODING = 'buffer';
33-
3432
// Test Certificates
3533
const spkacValid = fixtures.readSync('spkac.valid');
3634
const spkacFail = fixtures.readSync('spkac.fail');

test/parallel/test-crypto-ecb.js

-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ if (common.hasFipsCrypto)
3030
const assert = require('assert');
3131
const crypto = require('crypto');
3232

33-
crypto.DEFAULT_ENCODING = 'buffer';
34-
3533
// Testing whether EVP_CipherInit_ex is functioning correctly.
3634
// Reference: bug#1997
3735

test/parallel/test-crypto-padding-aes256.js

-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ if (!common.hasCrypto)
2727
const assert = require('assert');
2828
const crypto = require('crypto');
2929

30-
crypto.DEFAULT_ENCODING = 'buffer';
31-
3230
function aes256(decipherFinal) {
3331
const iv = Buffer.from('00000000000000000000000000000000', 'hex');
3432
const key = Buffer.from('0123456789abcdef0123456789abcdef' +

test/parallel/test-crypto-padding.js

-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ if (!common.hasCrypto)
2727
const assert = require('assert');
2828
const crypto = require('crypto');
2929

30-
crypto.DEFAULT_ENCODING = 'buffer';
31-
3230
// Input data.
3331
const ODD_LENGTH_PLAIN = 'Hello node world!';
3432
const EVEN_LENGTH_PLAIN = 'Hello node world!AbC09876dDeFgHi';

test/parallel/test-crypto-random.js

-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ const { kMaxLength } = require('buffer');
3232
const kMaxUint32 = Math.pow(2, 32) - 1;
3333
const kMaxPossibleLength = Math.min(kMaxLength, kMaxUint32);
3434

35-
crypto.DEFAULT_ENCODING = 'buffer';
36-
3735
// bump, we register a lot of exit listeners
3836
process.setMaxListeners(256);
3937

test/parallel/test-crypto-verify-failure.js

-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ const crypto = require('crypto');
2929
const tls = require('tls');
3030
const fixtures = require('../common/fixtures');
3131

32-
crypto.DEFAULT_ENCODING = 'buffer';
33-
3432
const certPem = fixtures.readSync('test_cert.pem', 'ascii');
3533

3634
const options = {

test/parallel/test-crypto.js

-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ const crypto = require('crypto');
3030
const tls = require('tls');
3131
const fixtures = require('../common/fixtures');
3232

33-
crypto.DEFAULT_ENCODING = 'buffer';
34-
3533
// Test Certificates
3634
const caPem = fixtures.readSync('test_ca.pem', 'ascii');
3735
const certPem = fixtures.readSync('test_cert.pem', 'ascii');

0 commit comments

Comments
 (0)