Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: remove crypto.DEFAULT_ENCODING usage #20221

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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