Skip to content

Commit

Permalink
test: remove crypto.DEFAULT_ENCODING usage
Browse files Browse the repository at this point in the history
This commit removes the usage of the deprectated
crypto.DEFAULT_ENCODING.

PR-URL: #20221
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
danbev committed Apr 25, 2018
1 parent 317c2e1 commit c521a20
Show file tree
Hide file tree
Showing 8 changed files with 3 additions and 15 deletions.
4 changes: 3 additions & 1 deletion test/parallel/test-crypto-binary-default.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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');
Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-crypto-certificate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-crypto-ecb.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-crypto-padding-aes256.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-crypto-padding.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-crypto-random.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-crypto-verify-failure.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit c521a20

Please sign in to comment.