|
|
f0ceb1 |
From 8ee31149e63d15d26d4262eb0292bd81e389fbc8 Mon Sep 17 00:00:00 2001
|
|
|
3f476a |
From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= <jstanek@redhat.com>
|
|
|
f0ceb1 |
Date: Wed, 7 Jul 2021 13:37:50 +0200
|
|
|
3f476a |
Subject: [PATCH] Disable tests for unsupported features
|
|
|
3f476a |
MIME-Version: 1.0
|
|
|
3f476a |
Content-Type: text/plain; charset=UTF-8
|
|
|
3f476a |
Content-Transfer-Encoding: 8bit
|
|
|
3f476a |
|
|
|
3f476a |
- Remove tests relying on unsupported features
|
|
|
3f476a |
|
|
|
3f476a |
These test either test some unsupported algorithm itself,
|
|
|
3f476a |
or use fixtures/data created by such algorithm.
|
|
|
3f476a |
Either way, the legacy OpenSSL cannot deal with them.
|
|
|
3f476a |
|
|
|
3f476a |
- Remove tests for TLSv1.3
|
|
|
3f476a |
|
|
|
3f476a |
Signed-off-by: Jan Staněk <jstanek@redhat.com>
|
|
|
3f476a |
---
|
|
|
3f476a |
lib/tls.js | 8 +-
|
|
|
3f476a |
.../test-crypto-certificate.js | 0
|
|
|
3f476a |
.../test-crypto-des3-wrap.js | 0
|
|
|
3f476a |
.../test-crypto-hash-stream-pipe.js | 0
|
|
|
3f476a |
.../test-https-agent-keylog.js | 0
|
|
|
3f476a |
.../test-tls-client-getephemeralkeyinfo.js | 0
|
|
|
3f476a |
.../test-tls-client-renegotiation-13.js | 0
|
|
|
3f476a |
.../test-tls-ecdh-auto.js | 0
|
|
|
3f476a |
.../test-tls-ecdh-multiple.js | 0
|
|
|
3f476a |
.../test-tls-ecdh.js | 0
|
|
|
3f476a |
.../test-tls-enable-keylog-cli.js | 0
|
|
|
3f476a |
.../test-tls-keylog-tlsv13.js | 0
|
|
|
3f476a |
test/parallel/test-crypto-aes-wrap.js | 6 +-
|
|
|
3f476a |
test/parallel/test-crypto-authenticated.js | 17 +-
|
|
|
3f476a |
test/parallel/test-crypto-dh-stateless.js | 17 --
|
|
|
3f476a |
test/parallel/test-crypto-hash.js | 63 --------
|
|
|
3f476a |
test/parallel/test-crypto-key-objects.js | 151 ------------------
|
|
|
710ffe |
test/parallel/test-crypto-keygen.js | 49 ------
|
|
|
3f476a |
test/parallel/test-crypto-sign-verify.js | 108 -------------
|
|
|
3f476a |
test/parallel/test-tls-cli-min-version-1.0.js | 2 +-
|
|
|
3f476a |
test/parallel/test-tls-cli-min-version-1.1.js | 2 +-
|
|
|
3f476a |
test/parallel/test-tls-cli-min-version-1.2.js | 2 +-
|
|
|
3f476a |
test/parallel/test-tls-destroy-stream.js | 2 +-
|
|
|
3f476a |
test/parallel/test-tls-getcipher.js | 22 ---
|
|
|
3f476a |
test/parallel/test-tls-min-max-version.js | 19 +--
|
|
|
3f476a |
test/parallel/test-tls-psk-circuit.js | 4 +-
|
|
|
710ffe |
26 files changed, 33 insertions(+), 439 deletions(-)
|
|
|
3f476a |
rename test/{parallel => known_issues}/test-crypto-certificate.js (100%)
|
|
|
3f476a |
rename test/{parallel => known_issues}/test-crypto-des3-wrap.js (100%)
|
|
|
3f476a |
rename test/{parallel => known_issues}/test-crypto-hash-stream-pipe.js (100%)
|
|
|
3f476a |
rename test/{parallel => known_issues}/test-https-agent-keylog.js (100%)
|
|
|
3f476a |
rename test/{parallel => known_issues}/test-tls-client-getephemeralkeyinfo.js (100%)
|
|
|
3f476a |
rename test/{parallel => known_issues}/test-tls-client-renegotiation-13.js (100%)
|
|
|
3f476a |
rename test/{parallel => known_issues}/test-tls-ecdh-auto.js (100%)
|
|
|
3f476a |
rename test/{parallel => known_issues}/test-tls-ecdh-multiple.js (100%)
|
|
|
3f476a |
rename test/{parallel => known_issues}/test-tls-ecdh.js (100%)
|
|
|
3f476a |
rename test/{parallel => known_issues}/test-tls-enable-keylog-cli.js (100%)
|
|
|
3f476a |
rename test/{parallel => known_issues}/test-tls-keylog-tlsv13.js (100%)
|
|
|
3f476a |
|
|
|
3f476a |
diff --git a/lib/tls.js b/lib/tls.js
|
|
|
3f476a |
index a46031ad7d..50772f3d16 100644
|
|
|
3f476a |
--- a/lib/tls.js
|
|
|
3f476a |
+++ b/lib/tls.js
|
|
|
3f476a |
@@ -70,17 +70,13 @@ else if (getOptionValue('--tls-min-v1.1'))
|
|
|
3f476a |
exports.DEFAULT_MIN_VERSION = 'TLSv1.1';
|
|
|
3f476a |
else if (getOptionValue('--tls-min-v1.2'))
|
|
|
3f476a |
exports.DEFAULT_MIN_VERSION = 'TLSv1.2';
|
|
|
3f476a |
-else if (getOptionValue('--tls-min-v1.3'))
|
|
|
3f476a |
- exports.DEFAULT_MIN_VERSION = 'TLSv1.3';
|
|
|
3f476a |
else
|
|
|
3f476a |
exports.DEFAULT_MIN_VERSION = 'TLSv1.2';
|
|
|
3f476a |
|
|
|
3f476a |
-if (getOptionValue('--tls-max-v1.3'))
|
|
|
3f476a |
- exports.DEFAULT_MAX_VERSION = 'TLSv1.3';
|
|
|
3f476a |
-else if (getOptionValue('--tls-max-v1.2'))
|
|
|
3f476a |
+if (getOptionValue('--tls-max-v1.2'))
|
|
|
3f476a |
exports.DEFAULT_MAX_VERSION = 'TLSv1.2';
|
|
|
3f476a |
else
|
|
|
3f476a |
- exports.DEFAULT_MAX_VERSION = 'TLSv1.3'; // Will depend on node version.
|
|
|
3f476a |
+ exports.DEFAULT_MAX_VERSION = 'TLSv1.2'; // Will depend on node version.
|
|
|
3f476a |
|
|
|
3f476a |
|
|
|
3f476a |
exports.getCiphers = internalUtil.cachedResult(
|
|
|
3f476a |
diff --git a/test/parallel/test-crypto-certificate.js b/test/known_issues/test-crypto-certificate.js
|
|
|
3f476a |
similarity index 100%
|
|
|
3f476a |
rename from test/parallel/test-crypto-certificate.js
|
|
|
3f476a |
rename to test/known_issues/test-crypto-certificate.js
|
|
|
3f476a |
diff --git a/test/parallel/test-crypto-des3-wrap.js b/test/known_issues/test-crypto-des3-wrap.js
|
|
|
3f476a |
similarity index 100%
|
|
|
3f476a |
rename from test/parallel/test-crypto-des3-wrap.js
|
|
|
3f476a |
rename to test/known_issues/test-crypto-des3-wrap.js
|
|
|
3f476a |
diff --git a/test/parallel/test-crypto-hash-stream-pipe.js b/test/known_issues/test-crypto-hash-stream-pipe.js
|
|
|
3f476a |
similarity index 100%
|
|
|
3f476a |
rename from test/parallel/test-crypto-hash-stream-pipe.js
|
|
|
3f476a |
rename to test/known_issues/test-crypto-hash-stream-pipe.js
|
|
|
3f476a |
diff --git a/test/parallel/test-https-agent-keylog.js b/test/known_issues/test-https-agent-keylog.js
|
|
|
3f476a |
similarity index 100%
|
|
|
3f476a |
rename from test/parallel/test-https-agent-keylog.js
|
|
|
3f476a |
rename to test/known_issues/test-https-agent-keylog.js
|
|
|
3f476a |
diff --git a/test/parallel/test-tls-client-getephemeralkeyinfo.js b/test/known_issues/test-tls-client-getephemeralkeyinfo.js
|
|
|
3f476a |
similarity index 100%
|
|
|
3f476a |
rename from test/parallel/test-tls-client-getephemeralkeyinfo.js
|
|
|
3f476a |
rename to test/known_issues/test-tls-client-getephemeralkeyinfo.js
|
|
|
3f476a |
diff --git a/test/parallel/test-tls-client-renegotiation-13.js b/test/known_issues/test-tls-client-renegotiation-13.js
|
|
|
3f476a |
similarity index 100%
|
|
|
3f476a |
rename from test/parallel/test-tls-client-renegotiation-13.js
|
|
|
3f476a |
rename to test/known_issues/test-tls-client-renegotiation-13.js
|
|
|
3f476a |
diff --git a/test/parallel/test-tls-ecdh-auto.js b/test/known_issues/test-tls-ecdh-auto.js
|
|
|
3f476a |
similarity index 100%
|
|
|
3f476a |
rename from test/parallel/test-tls-ecdh-auto.js
|
|
|
3f476a |
rename to test/known_issues/test-tls-ecdh-auto.js
|
|
|
3f476a |
diff --git a/test/parallel/test-tls-ecdh-multiple.js b/test/known_issues/test-tls-ecdh-multiple.js
|
|
|
3f476a |
similarity index 100%
|
|
|
3f476a |
rename from test/parallel/test-tls-ecdh-multiple.js
|
|
|
3f476a |
rename to test/known_issues/test-tls-ecdh-multiple.js
|
|
|
3f476a |
diff --git a/test/parallel/test-tls-ecdh.js b/test/known_issues/test-tls-ecdh.js
|
|
|
3f476a |
similarity index 100%
|
|
|
3f476a |
rename from test/parallel/test-tls-ecdh.js
|
|
|
3f476a |
rename to test/known_issues/test-tls-ecdh.js
|
|
|
3f476a |
diff --git a/test/parallel/test-tls-enable-keylog-cli.js b/test/known_issues/test-tls-enable-keylog-cli.js
|
|
|
3f476a |
similarity index 100%
|
|
|
3f476a |
rename from test/parallel/test-tls-enable-keylog-cli.js
|
|
|
3f476a |
rename to test/known_issues/test-tls-enable-keylog-cli.js
|
|
|
3f476a |
diff --git a/test/parallel/test-tls-keylog-tlsv13.js b/test/known_issues/test-tls-keylog-tlsv13.js
|
|
|
3f476a |
similarity index 100%
|
|
|
3f476a |
rename from test/parallel/test-tls-keylog-tlsv13.js
|
|
|
3f476a |
rename to test/known_issues/test-tls-keylog-tlsv13.js
|
|
|
3f476a |
diff --git a/test/parallel/test-crypto-aes-wrap.js b/test/parallel/test-crypto-aes-wrap.js
|
|
|
3f476a |
index 6fe35258f7..7639ec632d 100644
|
|
|
3f476a |
--- a/test/parallel/test-crypto-aes-wrap.js
|
|
|
3f476a |
+++ b/test/parallel/test-crypto-aes-wrap.js
|
|
|
3f476a |
@@ -8,7 +8,7 @@ const crypto = require('crypto');
|
|
|
3f476a |
|
|
|
3f476a |
const test = [
|
|
|
3f476a |
{
|
|
|
3f476a |
- algorithm: 'aes128-wrap',
|
|
|
3f476a |
+ algorithm: 'id-aes128-wrap',
|
|
|
3f476a |
key: 'b26f309fbe57e9b3bb6ae5ef31d54450',
|
|
|
3f476a |
iv: '3fd838af4093d749',
|
|
|
3f476a |
text: '12345678123456781234567812345678'
|
|
|
3f476a |
@@ -20,7 +20,7 @@ const test = [
|
|
|
3f476a |
text: '12345678123456781234567812345678123'
|
|
|
3f476a |
},
|
|
|
3f476a |
{
|
|
|
3f476a |
- algorithm: 'aes192-wrap',
|
|
|
3f476a |
+ algorithm: 'id-aes192-wrap',
|
|
|
3f476a |
key: '40978085d68091f7dfca0d7dfc7a5ee76d2cc7f2f345a304',
|
|
|
3f476a |
iv: '3fd838af4093d749',
|
|
|
3f476a |
text: '12345678123456781234567812345678'
|
|
|
3f476a |
@@ -32,7 +32,7 @@ const test = [
|
|
|
3f476a |
text: '12345678123456781234567812345678123'
|
|
|
3f476a |
},
|
|
|
3f476a |
{
|
|
|
3f476a |
- algorithm: 'aes256-wrap',
|
|
|
3f476a |
+ algorithm: 'id-aes256-wrap',
|
|
|
3f476a |
key: '29c9eab5ed5ad44134a1437fe2e673b4d88a5b7c72e68454fea08721392b7323',
|
|
|
3f476a |
iv: '3fd838af4093d749',
|
|
|
3f476a |
text: '12345678123456781234567812345678'
|
|
|
3f476a |
diff --git a/test/parallel/test-crypto-authenticated.js b/test/parallel/test-crypto-authenticated.js
|
|
|
3f476a |
index 863907bafd..8c10b350c0 100644
|
|
|
3f476a |
--- a/test/parallel/test-crypto-authenticated.js
|
|
|
3f476a |
+++ b/test/parallel/test-crypto-authenticated.js
|
|
|
3f476a |
@@ -405,6 +405,11 @@ for (const test of TEST_CASES) {
|
|
|
3f476a |
// authentication tag has been specified.
|
|
|
3f476a |
{
|
|
|
3f476a |
for (const mode of ['ccm', 'ocb']) {
|
|
|
3f476a |
+ if (!ciphers.includes(`aes-256-${mode}`)) {
|
|
|
3f476a |
+ common.printSkipMessage(`unsupported aes-256-${mode} test`);
|
|
|
3f476a |
+ continue;
|
|
|
3f476a |
+ }
|
|
|
3f476a |
+
|
|
|
3f476a |
assert.throws(() => {
|
|
|
3f476a |
crypto.createCipheriv(`aes-256-${mode}`,
|
|
|
3f476a |
'FxLKsqdmv0E9xrQhp0b1ZgI0K7JFZJM8',
|
|
|
3f476a |
@@ -565,6 +570,11 @@ for (const test of TEST_CASES) {
|
|
|
3f476a |
const iv = Buffer.from('0123456789ab', 'utf8');
|
|
|
3f476a |
|
|
|
3f476a |
for (const mode of ['gcm', 'ocb']) {
|
|
|
3f476a |
+ if (!ciphers.includes(`aes-128-${mode}`)) {
|
|
|
3f476a |
+ common.printSkipMessage(`unsupported aes-128-${mode} test`);
|
|
|
3f476a |
+ continue;
|
|
|
3f476a |
+ }
|
|
|
3f476a |
+
|
|
|
3f476a |
for (const authTagLength of mode === 'gcm' ? [undefined, 8] : [8]) {
|
|
|
3f476a |
const cipher = crypto.createCipheriv(`aes-128-${mode}`, key, iv, {
|
|
|
3f476a |
authTagLength
|
|
|
3f476a |
@@ -599,6 +609,11 @@ for (const test of TEST_CASES) {
|
|
|
3f476a |
const opts = { authTagLength: 8 };
|
|
|
3f476a |
|
|
|
3f476a |
for (const mode of ['gcm', 'ccm', 'ocb']) {
|
|
|
3f476a |
+ if (!ciphers.includes(`aes-128-${mode}`)) {
|
|
|
3f476a |
+ common.printSkipMessage(`unsupported aes-128-${mode} test`);
|
|
|
3f476a |
+ continue;
|
|
|
3f476a |
+ }
|
|
|
3f476a |
+
|
|
|
3f476a |
const cipher = crypto.createCipheriv(`aes-128-${mode}`, key, iv, opts);
|
|
|
3f476a |
const ciphertext = Buffer.concat([cipher.update(plain), cipher.final()]);
|
|
|
3f476a |
const tag = cipher.getAuthTag();
|
|
|
3f476a |
@@ -659,7 +674,7 @@ for (const test of TEST_CASES) {
|
|
|
3f476a |
Buffer.from(valid.key, 'hex'),
|
|
|
3f476a |
Buffer.from(H(prefix) + valid.iv, 'hex'),
|
|
|
3f476a |
{ authTagLength: valid.tag.length / 2 }
|
|
|
3f476a |
- ), errMessages.length, `iv length ${ivLength} was not rejected`);
|
|
|
3f476a |
+ ), /.*/, `iv length ${ivLength} was not rejected`);
|
|
|
3f476a |
|
|
|
3f476a |
function H(length) { return '00'.repeat(length); }
|
|
|
3f476a |
}
|
|
|
3f476a |
diff --git a/test/parallel/test-crypto-dh-stateless.js b/test/parallel/test-crypto-dh-stateless.js
|
|
|
3f476a |
index b01cea76b2..b91d15fcb5 100644
|
|
|
3f476a |
--- a/test/parallel/test-crypto-dh-stateless.js
|
|
|
3f476a |
+++ b/test/parallel/test-crypto-dh-stateless.js
|
|
|
3f476a |
@@ -204,20 +204,3 @@ assert.throws(() => {
|
|
|
3f476a |
name: 'Error',
|
|
|
3f476a |
code: 'ERR_OSSL_EVP_DIFFERENT_PARAMETERS'
|
|
|
3f476a |
});
|
|
|
3f476a |
-
|
|
|
3f476a |
-// Test ECDH-ES.
|
|
|
3f476a |
-
|
|
|
3f476a |
-test(crypto.generateKeyPairSync('x448'),
|
|
|
3f476a |
- crypto.generateKeyPairSync('x448'));
|
|
|
3f476a |
-
|
|
|
3f476a |
-test(crypto.generateKeyPairSync('x25519'),
|
|
|
3f476a |
- crypto.generateKeyPairSync('x25519'));
|
|
|
3f476a |
-
|
|
|
3f476a |
-assert.throws(() => {
|
|
|
3f476a |
- test(crypto.generateKeyPairSync('x448'),
|
|
|
3f476a |
- crypto.generateKeyPairSync('x25519'));
|
|
|
3f476a |
-}, {
|
|
|
3f476a |
- name: 'Error',
|
|
|
3f476a |
- code: 'ERR_CRYPTO_INCOMPATIBLE_KEY',
|
|
|
3f476a |
- message: 'Incompatible key types for Diffie-Hellman: x448 and x25519'
|
|
|
3f476a |
-});
|
|
|
3f476a |
diff --git a/test/parallel/test-crypto-hash.js b/test/parallel/test-crypto-hash.js
|
|
|
3f476a |
index f3f4df928c..e4db1ba88a 100644
|
|
|
3f476a |
--- a/test/parallel/test-crypto-hash.js
|
|
|
3f476a |
+++ b/test/parallel/test-crypto-hash.js
|
|
|
3f476a |
@@ -182,76 +182,13 @@ assert.throws(
|
|
|
3f476a |
' when called without `new`');
|
|
|
3f476a |
}
|
|
|
3f476a |
|
|
|
3f476a |
-// Test XOF hash functions and the outputLength option.
|
|
|
3f476a |
{
|
|
|
3f476a |
- // Default outputLengths.
|
|
|
3f476a |
- assert.strictEqual(crypto.createHash('shake128').digest('hex'),
|
|
|
3f476a |
- '7f9c2ba4e88f827d616045507605853e');
|
|
|
3f476a |
- assert.strictEqual(crypto.createHash('shake128', null).digest('hex'),
|
|
|
3f476a |
- '7f9c2ba4e88f827d616045507605853e');
|
|
|
3f476a |
- assert.strictEqual(crypto.createHash('shake256').digest('hex'),
|
|
|
3f476a |
- '46b9dd2b0ba88d13233b3feb743eeb24' +
|
|
|
3f476a |
- '3fcd52ea62b81b82b50c27646ed5762f');
|
|
|
3f476a |
- assert.strictEqual(crypto.createHash('shake256', { outputLength: 0 })
|
|
|
3f476a |
- .copy() // Default outputLength.
|
|
|
3f476a |
- .digest('hex'),
|
|
|
3f476a |
- '46b9dd2b0ba88d13233b3feb743eeb24' +
|
|
|
3f476a |
- '3fcd52ea62b81b82b50c27646ed5762f');
|
|
|
3f476a |
-
|
|
|
3f476a |
- // Short outputLengths.
|
|
|
3f476a |
- assert.strictEqual(crypto.createHash('shake128', { outputLength: 0 })
|
|
|
3f476a |
- .digest('hex'),
|
|
|
3f476a |
- '');
|
|
|
3f476a |
- assert.strictEqual(crypto.createHash('shake128', { outputLength: 5 })
|
|
|
3f476a |
- .copy({ outputLength: 0 })
|
|
|
3f476a |
- .digest('hex'),
|
|
|
3f476a |
- '');
|
|
|
3f476a |
- assert.strictEqual(crypto.createHash('shake128', { outputLength: 5 })
|
|
|
3f476a |
- .digest('hex'),
|
|
|
3f476a |
- '7f9c2ba4e8');
|
|
|
3f476a |
- assert.strictEqual(crypto.createHash('shake128', { outputLength: 0 })
|
|
|
3f476a |
- .copy({ outputLength: 5 })
|
|
|
3f476a |
- .digest('hex'),
|
|
|
3f476a |
- '7f9c2ba4e8');
|
|
|
3f476a |
- assert.strictEqual(crypto.createHash('shake128', { outputLength: 15 })
|
|
|
3f476a |
- .digest('hex'),
|
|
|
3f476a |
- '7f9c2ba4e88f827d61604550760585');
|
|
|
3f476a |
- assert.strictEqual(crypto.createHash('shake256', { outputLength: 16 })
|
|
|
3f476a |
- .digest('hex'),
|
|
|
3f476a |
- '46b9dd2b0ba88d13233b3feb743eeb24');
|
|
|
3f476a |
-
|
|
|
3f476a |
- // Large outputLengths.
|
|
|
3f476a |
- assert.strictEqual(crypto.createHash('shake128', { outputLength: 128 })
|
|
|
3f476a |
- .digest('hex'),
|
|
|
3f476a |
- '7f9c2ba4e88f827d616045507605853e' +
|
|
|
3f476a |
- 'd73b8093f6efbc88eb1a6eacfa66ef26' +
|
|
|
3f476a |
- '3cb1eea988004b93103cfb0aeefd2a68' +
|
|
|
3f476a |
- '6e01fa4a58e8a3639ca8a1e3f9ae57e2' +
|
|
|
3f476a |
- '35b8cc873c23dc62b8d260169afa2f75' +
|
|
|
3f476a |
- 'ab916a58d974918835d25e6a435085b2' +
|
|
|
3f476a |
- 'badfd6dfaac359a5efbb7bcc4b59d538' +
|
|
|
3f476a |
- 'df9a04302e10c8bc1cbf1a0b3a5120ea');
|
|
|
3f476a |
- const superLongHash = crypto.createHash('shake256', {
|
|
|
3f476a |
- outputLength: 1024 * 1024
|
|
|
3f476a |
- }).update('The message is shorter than the hash!')
|
|
|
3f476a |
- .digest('hex');
|
|
|
3f476a |
- assert.strictEqual(superLongHash.length, 2 * 1024 * 1024);
|
|
|
3f476a |
- assert.ok(superLongHash.endsWith('193414035ddba77bf7bba97981e656ec'));
|
|
|
3f476a |
- assert.ok(superLongHash.startsWith('a2a28dbc49cfd6e5d6ceea3d03e77748'));
|
|
|
3f476a |
-
|
|
|
3f476a |
// Non-XOF hash functions should accept valid outputLength options as well.
|
|
|
3f476a |
assert.strictEqual(crypto.createHash('sha224', { outputLength: 28 })
|
|
|
3f476a |
.digest('hex'),
|
|
|
3f476a |
'd14a028c2a3a2bc9476102bb288234c4' +
|
|
|
3f476a |
'15a2b01f828ea62ac5b3e42f');
|
|
|
3f476a |
|
|
|
3f476a |
- // Passing invalid sizes should throw during creation.
|
|
|
3f476a |
- assert.throws(() => {
|
|
|
3f476a |
- crypto.createHash('sha256', { outputLength: 28 });
|
|
|
3f476a |
- }, {
|
|
|
3f476a |
- code: 'ERR_OSSL_EVP_NOT_XOF_OR_INVALID_LENGTH'
|
|
|
3f476a |
- });
|
|
|
3f476a |
-
|
|
|
3f476a |
for (const outputLength of [null, {}, 'foo', false]) {
|
|
|
3f476a |
assert.throws(() => crypto.createHash('sha256', { outputLength }),
|
|
|
3f476a |
{ code: 'ERR_INVALID_ARG_TYPE' });
|
|
|
3f476a |
diff --git a/test/parallel/test-crypto-key-objects.js b/test/parallel/test-crypto-key-objects.js
|
|
|
3f476a |
index d3011db79d..644a52a1c7 100644
|
|
|
3f476a |
--- a/test/parallel/test-crypto-key-objects.js
|
|
|
3f476a |
+++ b/test/parallel/test-crypto-key-objects.js
|
|
|
3f476a |
@@ -242,18 +242,6 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
|
|
3f476a |
}
|
|
|
3f476a |
|
|
|
3f476a |
[
|
|
|
3f476a |
- { private: fixtures.readKey('ed25519_private.pem', 'ascii'),
|
|
|
3f476a |
- public: fixtures.readKey('ed25519_public.pem', 'ascii'),
|
|
|
3f476a |
- keyType: 'ed25519' },
|
|
|
3f476a |
- { private: fixtures.readKey('ed448_private.pem', 'ascii'),
|
|
|
3f476a |
- public: fixtures.readKey('ed448_public.pem', 'ascii'),
|
|
|
3f476a |
- keyType: 'ed448' },
|
|
|
3f476a |
- { private: fixtures.readKey('x25519_private.pem', 'ascii'),
|
|
|
3f476a |
- public: fixtures.readKey('x25519_public.pem', 'ascii'),
|
|
|
3f476a |
- keyType: 'x25519' },
|
|
|
3f476a |
- { private: fixtures.readKey('x448_private.pem', 'ascii'),
|
|
|
3f476a |
- public: fixtures.readKey('x448_public.pem', 'ascii'),
|
|
|
3f476a |
- keyType: 'x448' },
|
|
|
3f476a |
].forEach((info) => {
|
|
|
3f476a |
const keyType = info.keyType;
|
|
|
3f476a |
|
|
|
3f476a |
@@ -323,145 +311,6 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
|
|
|
3f476a |
|
|
|
3f476a |
}
|
|
|
3f476a |
|
|
|
3f476a |
-{
|
|
|
3f476a |
- // Test RSA-PSS.
|
|
|
3f476a |
- {
|
|
|
3f476a |
- // This key pair does not restrict the message digest algorithm or salt
|
|
|
3f476a |
- // length.
|
|
|
3f476a |
- const publicPem = fixtures.readKey('rsa_pss_public_2048.pem');
|
|
|
3f476a |
- const privatePem = fixtures.readKey('rsa_pss_private_2048.pem');
|
|
|
3f476a |
-
|
|
|
3f476a |
- const publicKey = createPublicKey(publicPem);
|
|
|
3f476a |
- const privateKey = createPrivateKey(privatePem);
|
|
|
3f476a |
-
|
|
|
3f476a |
- assert.strictEqual(publicKey.type, 'public');
|
|
|
3f476a |
- assert.strictEqual(publicKey.asymmetricKeyType, 'rsa-pss');
|
|
|
3f476a |
-
|
|
|
3f476a |
- assert.strictEqual(privateKey.type, 'private');
|
|
|
3f476a |
- assert.strictEqual(privateKey.asymmetricKeyType, 'rsa-pss');
|
|
|
3f476a |
-
|
|
|
3f476a |
- for (const key of [privatePem, privateKey]) {
|
|
|
3f476a |
- // Any algorithm should work.
|
|
|
3f476a |
- for (const algo of ['sha1', 'sha256']) {
|
|
|
3f476a |
- // Any salt length should work.
|
|
|
3f476a |
- for (const saltLength of [undefined, 8, 10, 12, 16, 18, 20]) {
|
|
|
3f476a |
- const signature = createSign(algo)
|
|
|
3f476a |
- .update('foo')
|
|
|
3f476a |
- .sign({ key, saltLength });
|
|
|
3f476a |
-
|
|
|
3f476a |
- for (const pkey of [key, publicKey, publicPem]) {
|
|
|
3f476a |
- const okay = createVerify(algo)
|
|
|
3f476a |
- .update('foo')
|
|
|
3f476a |
- .verify({ key: pkey, saltLength }, signature);
|
|
|
3f476a |
-
|
|
|
3f476a |
- assert.ok(okay);
|
|
|
3f476a |
- }
|
|
|
3f476a |
- }
|
|
|
3f476a |
- }
|
|
|
3f476a |
- }
|
|
|
3f476a |
-
|
|
|
3f476a |
- // Exporting the key using PKCS#1 should not work since this would discard
|
|
|
3f476a |
- // any algorithm restrictions.
|
|
|
3f476a |
- assert.throws(() => {
|
|
|
3f476a |
- publicKey.export({ format: 'pem', type: 'pkcs1' });
|
|
|
3f476a |
- }, {
|
|
|
3f476a |
- code: 'ERR_CRYPTO_INCOMPATIBLE_KEY_OPTIONS'
|
|
|
3f476a |
- });
|
|
|
3f476a |
- }
|
|
|
3f476a |
-
|
|
|
3f476a |
- {
|
|
|
3f476a |
- // This key pair enforces sha256 as the message digest and the MGF1
|
|
|
3f476a |
- // message digest and a salt length of at least 16 bytes.
|
|
|
3f476a |
- const publicPem =
|
|
|
3f476a |
- fixtures.readKey('rsa_pss_public_2048_sha256_sha256_16.pem');
|
|
|
3f476a |
- const privatePem =
|
|
|
3f476a |
- fixtures.readKey('rsa_pss_private_2048_sha256_sha256_16.pem');
|
|
|
3f476a |
-
|
|
|
3f476a |
- const publicKey = createPublicKey(publicPem);
|
|
|
3f476a |
- const privateKey = createPrivateKey(privatePem);
|
|
|
3f476a |
-
|
|
|
3f476a |
- assert.strictEqual(publicKey.type, 'public');
|
|
|
3f476a |
- assert.strictEqual(publicKey.asymmetricKeyType, 'rsa-pss');
|
|
|
3f476a |
-
|
|
|
3f476a |
- assert.strictEqual(privateKey.type, 'private');
|
|
|
3f476a |
- assert.strictEqual(privateKey.asymmetricKeyType, 'rsa-pss');
|
|
|
3f476a |
-
|
|
|
3f476a |
- for (const key of [privatePem, privateKey]) {
|
|
|
3f476a |
- // Signing with anything other than sha256 should fail.
|
|
|
3f476a |
- assert.throws(() => {
|
|
|
3f476a |
- createSign('sha1').sign(key);
|
|
|
3f476a |
- }, /digest not allowed/);
|
|
|
3f476a |
-
|
|
|
3f476a |
- // Signing with salt lengths less than 16 bytes should fail.
|
|
|
3f476a |
- for (const saltLength of [8, 10, 12]) {
|
|
|
3f476a |
- assert.throws(() => {
|
|
|
3f476a |
- createSign('sha1').sign({ key, saltLength });
|
|
|
3f476a |
- }, /pss saltlen too small/);
|
|
|
3f476a |
- }
|
|
|
3f476a |
-
|
|
|
3f476a |
- // Signing with sha256 and appropriate salt lengths should work.
|
|
|
3f476a |
- for (const saltLength of [undefined, 16, 18, 20]) {
|
|
|
3f476a |
- const signature = createSign('sha256')
|
|
|
3f476a |
- .update('foo')
|
|
|
3f476a |
- .sign({ key, saltLength });
|
|
|
3f476a |
-
|
|
|
3f476a |
- for (const pkey of [key, publicKey, publicPem]) {
|
|
|
3f476a |
- const okay = createVerify('sha256')
|
|
|
3f476a |
- .update('foo')
|
|
|
3f476a |
- .verify({ key: pkey, saltLength }, signature);
|
|
|
3f476a |
-
|
|
|
3f476a |
- assert.ok(okay);
|
|
|
3f476a |
- }
|
|
|
3f476a |
- }
|
|
|
3f476a |
- }
|
|
|
3f476a |
- }
|
|
|
3f476a |
-
|
|
|
3f476a |
- {
|
|
|
3f476a |
- // This key enforces sha512 as the message digest and sha256 as the MGF1
|
|
|
3f476a |
- // message digest.
|
|
|
3f476a |
- const publicPem =
|
|
|
3f476a |
- fixtures.readKey('rsa_pss_public_2048_sha512_sha256_20.pem');
|
|
|
3f476a |
- const privatePem =
|
|
|
3f476a |
- fixtures.readKey('rsa_pss_private_2048_sha512_sha256_20.pem');
|
|
|
3f476a |
-
|
|
|
3f476a |
- const publicKey = createPublicKey(publicPem);
|
|
|
3f476a |
- const privateKey = createPrivateKey(privatePem);
|
|
|
3f476a |
-
|
|
|
3f476a |
- assert.strictEqual(publicKey.type, 'public');
|
|
|
3f476a |
- assert.strictEqual(publicKey.asymmetricKeyType, 'rsa-pss');
|
|
|
3f476a |
-
|
|
|
3f476a |
- assert.strictEqual(privateKey.type, 'private');
|
|
|
3f476a |
- assert.strictEqual(privateKey.asymmetricKeyType, 'rsa-pss');
|
|
|
3f476a |
-
|
|
|
3f476a |
- // Node.js usually uses the same hash function for the message and for MGF1.
|
|
|
3f476a |
- // However, when a different MGF1 message digest algorithm has been
|
|
|
3f476a |
- // specified as part of the key, it should automatically switch to that.
|
|
|
3f476a |
- // This behavior is required by sections 3.1 and 3.3 of RFC4055.
|
|
|
3f476a |
- for (const key of [privatePem, privateKey]) {
|
|
|
3f476a |
- // sha256 matches the MGF1 hash function and should be used internally,
|
|
|
3f476a |
- // but it should not be permitted as the main message digest algorithm.
|
|
|
3f476a |
- for (const algo of ['sha1', 'sha256']) {
|
|
|
3f476a |
- assert.throws(() => {
|
|
|
3f476a |
- createSign(algo).sign(key);
|
|
|
3f476a |
- }, /digest not allowed/);
|
|
|
3f476a |
- }
|
|
|
3f476a |
-
|
|
|
3f476a |
- // sha512 should produce a valid signature.
|
|
|
3f476a |
- const signature = createSign('sha512')
|
|
|
3f476a |
- .update('foo')
|
|
|
3f476a |
- .sign(key);
|
|
|
3f476a |
-
|
|
|
3f476a |
- for (const pkey of [key, publicKey, publicPem]) {
|
|
|
3f476a |
- const okay = createVerify('sha512')
|
|
|
3f476a |
- .update('foo')
|
|
|
3f476a |
- .verify(pkey, signature);
|
|
|
3f476a |
-
|
|
|
3f476a |
- assert.ok(okay);
|
|
|
3f476a |
- }
|
|
|
3f476a |
- }
|
|
|
3f476a |
- }
|
|
|
3f476a |
-}
|
|
|
3f476a |
-
|
|
|
3f476a |
{
|
|
|
3f476a |
// Exporting an encrypted private key requires a cipher
|
|
|
3f476a |
const privateKey = createPrivateKey(privatePem);
|
|
|
3f476a |
diff --git a/test/parallel/test-crypto-keygen.js b/test/parallel/test-crypto-keygen.js
|
|
|
710ffe |
index 5da5715bcb..2f4b1ab407 100644
|
|
|
3f476a |
--- a/test/parallel/test-crypto-keygen.js
|
|
|
3f476a |
+++ b/test/parallel/test-crypto-keygen.js
|
|
|
710ffe |
@@ -257,41 +257,6 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
3f476a |
}));
|
|
|
3f476a |
}
|
|
|
3f476a |
|
|
|
3f476a |
-{
|
|
|
3f476a |
- // Test RSA-PSS.
|
|
|
3f476a |
- generateKeyPair('rsa-pss', {
|
|
|
3f476a |
- modulusLength: 512,
|
|
|
3f476a |
- saltLength: 16,
|
|
|
3f476a |
- hash: 'sha256',
|
|
|
3f476a |
- mgf1Hash: 'sha256'
|
|
|
710ffe |
- }, common.mustSucceed((publicKey, privateKey) => {
|
|
|
3f476a |
- assert.strictEqual(publicKey.type, 'public');
|
|
|
3f476a |
- assert.strictEqual(publicKey.asymmetricKeyType, 'rsa-pss');
|
|
|
3f476a |
-
|
|
|
3f476a |
- assert.strictEqual(privateKey.type, 'private');
|
|
|
3f476a |
- assert.strictEqual(privateKey.asymmetricKeyType, 'rsa-pss');
|
|
|
710ffe |
-
|
|
|
3f476a |
- // Unlike RSA, RSA-PSS does not allow encryption.
|
|
|
3f476a |
- assert.throws(() => {
|
|
|
3f476a |
- testEncryptDecrypt(publicKey, privateKey);
|
|
|
3f476a |
- }, /operation not supported for this keytype/);
|
|
|
3f476a |
-
|
|
|
3f476a |
- // RSA-PSS also does not permit signing with PKCS1 padding.
|
|
|
3f476a |
- assert.throws(() => {
|
|
|
3f476a |
- testSignVerify({
|
|
|
3f476a |
- key: publicKey,
|
|
|
3f476a |
- padding: constants.RSA_PKCS1_PADDING
|
|
|
3f476a |
- }, {
|
|
|
3f476a |
- key: privateKey,
|
|
|
3f476a |
- padding: constants.RSA_PKCS1_PADDING
|
|
|
3f476a |
- });
|
|
|
3f476a |
- }, /illegal or unsupported padding mode/);
|
|
|
3f476a |
-
|
|
|
3f476a |
- // The padding should correctly default to RSA_PKCS1_PSS_PADDING now.
|
|
|
3f476a |
- testSignVerify(publicKey, privateKey);
|
|
|
3f476a |
- }));
|
|
|
3f476a |
-}
|
|
|
710ffe |
-
|
|
|
3f476a |
{
|
|
|
3f476a |
const privateKeyEncoding = {
|
|
|
710ffe |
type: 'pkcs8',
|
|
|
710ffe |
@@ -945,20 +910,6 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|
|
3f476a |
}));
|
|
|
3f476a |
}
|
|
|
3f476a |
|
|
|
3f476a |
-// Test EdDSA key generation.
|
|
|
3f476a |
-{
|
|
|
3f476a |
- if (!/^1\.1\.0/.test(process.versions.openssl)) {
|
|
|
3f476a |
- ['ed25519', 'ed448', 'x25519', 'x448'].forEach((keyType) => {
|
|
|
710ffe |
- generateKeyPair(keyType, common.mustSucceed((publicKey, privateKey) => {
|
|
|
3f476a |
- assert.strictEqual(publicKey.type, 'public');
|
|
|
3f476a |
- assert.strictEqual(publicKey.asymmetricKeyType, keyType);
|
|
|
3f476a |
-
|
|
|
3f476a |
- assert.strictEqual(privateKey.type, 'private');
|
|
|
3f476a |
- assert.strictEqual(privateKey.asymmetricKeyType, keyType);
|
|
|
3f476a |
- }));
|
|
|
3f476a |
- });
|
|
|
3f476a |
- }
|
|
|
3f476a |
-}
|
|
|
3f476a |
|
|
|
3f476a |
// Test classic Diffie-Hellman key generation.
|
|
|
3f476a |
{
|
|
|
3f476a |
diff --git a/test/parallel/test-crypto-sign-verify.js b/test/parallel/test-crypto-sign-verify.js
|
|
|
3f476a |
index ff410dcf00..a7a293a740 100644
|
|
|
3f476a |
--- a/test/parallel/test-crypto-sign-verify.js
|
|
|
3f476a |
+++ b/test/parallel/test-crypto-sign-verify.js
|
|
|
3f476a |
@@ -425,14 +425,6 @@ assert.throws(
|
|
|
3f476a |
}
|
|
|
3f476a |
|
|
|
3f476a |
[
|
|
|
3f476a |
- { private: fixtures.readKey('ed25519_private.pem', 'ascii'),
|
|
|
3f476a |
- public: fixtures.readKey('ed25519_public.pem', 'ascii'),
|
|
|
3f476a |
- algo: null,
|
|
|
3f476a |
- sigLen: 64 },
|
|
|
3f476a |
- { private: fixtures.readKey('ed448_private.pem', 'ascii'),
|
|
|
3f476a |
- public: fixtures.readKey('ed448_public.pem', 'ascii'),
|
|
|
3f476a |
- algo: null,
|
|
|
3f476a |
- sigLen: 114 },
|
|
|
3f476a |
{ private: fixtures.readKey('rsa_private_2048.pem', 'ascii'),
|
|
|
3f476a |
public: fixtures.readKey('rsa_public_2048.pem', 'ascii'),
|
|
|
3f476a |
algo: 'sha1',
|
|
|
3f476a |
@@ -514,106 +506,6 @@ assert.throws(
|
|
|
3f476a |
assert.throws(() => crypto.verify(null, data, 'test', input), errObj);
|
|
|
3f476a |
});
|
|
|
3f476a |
|
|
|
3f476a |
-{
|
|
|
3f476a |
- const data = Buffer.from('Hello world');
|
|
|
3f476a |
- const keys = [['ec-key.pem', 64], ['dsa_private_1025.pem', 40]];
|
|
|
3f476a |
-
|
|
|
3f476a |
- for (const [file, length] of keys) {
|
|
|
3f476a |
- const privKey = fixtures.readKey(file);
|
|
|
3f476a |
- [
|
|
|
3f476a |
- crypto.createSign('sha1').update(data).sign(privKey),
|
|
|
3f476a |
- crypto.sign('sha1', data, privKey),
|
|
|
3f476a |
- crypto.sign('sha1', data, { key: privKey, dsaEncoding: 'der' })
|
|
|
3f476a |
- ].forEach((sig) => {
|
|
|
3f476a |
- // Signature length variability due to DER encoding
|
|
|
3f476a |
- assert(sig.length >= length + 4 && sig.length <= length + 8);
|
|
|
3f476a |
-
|
|
|
3f476a |
- assert.strictEqual(
|
|
|
3f476a |
- crypto.createVerify('sha1').update(data).verify(privKey, sig),
|
|
|
3f476a |
- true
|
|
|
3f476a |
- );
|
|
|
3f476a |
- assert.strictEqual(crypto.verify('sha1', data, privKey, sig), true);
|
|
|
3f476a |
- });
|
|
|
3f476a |
-
|
|
|
3f476a |
- // Test (EC)DSA signature conversion.
|
|
|
3f476a |
- const opts = { key: privKey, dsaEncoding: 'ieee-p1363' };
|
|
|
3f476a |
- let sig = crypto.sign('sha1', data, opts);
|
|
|
3f476a |
- // Unlike DER signatures, IEEE P1363 signatures have a predictable length.
|
|
|
3f476a |
- assert.strictEqual(sig.length, length);
|
|
|
3f476a |
- assert.strictEqual(crypto.verify('sha1', data, opts, sig), true);
|
|
|
3f476a |
- assert.strictEqual(crypto.createVerify('sha1')
|
|
|
3f476a |
- .update(data)
|
|
|
3f476a |
- .verify(opts, sig), true);
|
|
|
3f476a |
-
|
|
|
3f476a |
- // Test invalid signature lengths.
|
|
|
3f476a |
- for (const i of [-2, -1, 1, 2, 4, 8]) {
|
|
|
3f476a |
- sig = crypto.randomBytes(length + i);
|
|
|
3f476a |
- assert.throws(() => {
|
|
|
3f476a |
- crypto.verify('sha1', data, opts, sig);
|
|
|
3f476a |
- }, {
|
|
|
3f476a |
- message: 'Malformed signature'
|
|
|
3f476a |
- });
|
|
|
3f476a |
- }
|
|
|
3f476a |
- }
|
|
|
3f476a |
-
|
|
|
3f476a |
- // Test verifying externally signed messages.
|
|
|
3f476a |
- const extSig = Buffer.from('494c18ab5c8a62a72aea5041966902bcfa229821af2bf65' +
|
|
|
3f476a |
- '0b5b4870d1fe6aebeaed9460c62210693b5b0a300033823' +
|
|
|
3f476a |
- '33d9529c8abd8c5948940af944828be16c', 'hex');
|
|
|
3f476a |
- for (const ok of [true, false]) {
|
|
|
3f476a |
- assert.strictEqual(
|
|
|
3f476a |
- crypto.verify('sha256', data, {
|
|
|
3f476a |
- key: fixtures.readKey('ec-key.pem'),
|
|
|
3f476a |
- dsaEncoding: 'ieee-p1363'
|
|
|
3f476a |
- }, extSig),
|
|
|
3f476a |
- ok
|
|
|
3f476a |
- );
|
|
|
3f476a |
-
|
|
|
3f476a |
- assert.strictEqual(
|
|
|
3f476a |
- crypto.createVerify('sha256').update(data).verify({
|
|
|
3f476a |
- key: fixtures.readKey('ec-key.pem'),
|
|
|
3f476a |
- dsaEncoding: 'ieee-p1363'
|
|
|
3f476a |
- }, extSig),
|
|
|
3f476a |
- ok
|
|
|
3f476a |
- );
|
|
|
3f476a |
-
|
|
|
3f476a |
- extSig[Math.floor(Math.random() * extSig.length)] ^= 1;
|
|
|
3f476a |
- }
|
|
|
3f476a |
-
|
|
|
3f476a |
- // Non-(EC)DSA keys should ignore the option.
|
|
|
3f476a |
- const sig = crypto.sign('sha1', data, {
|
|
|
3f476a |
- key: keyPem,
|
|
|
3f476a |
- dsaEncoding: 'ieee-p1363'
|
|
|
3f476a |
- });
|
|
|
3f476a |
- assert.strictEqual(crypto.verify('sha1', data, certPem, sig), true);
|
|
|
3f476a |
- assert.strictEqual(
|
|
|
3f476a |
- crypto.verify('sha1', data, {
|
|
|
3f476a |
- key: certPem,
|
|
|
3f476a |
- dsaEncoding: 'ieee-p1363'
|
|
|
3f476a |
- }, sig),
|
|
|
3f476a |
- true
|
|
|
3f476a |
- );
|
|
|
3f476a |
- assert.strictEqual(
|
|
|
3f476a |
- crypto.verify('sha1', data, {
|
|
|
3f476a |
- key: certPem,
|
|
|
3f476a |
- dsaEncoding: 'der'
|
|
|
3f476a |
- }, sig),
|
|
|
3f476a |
- true
|
|
|
3f476a |
- );
|
|
|
3f476a |
-
|
|
|
3f476a |
- for (const dsaEncoding of ['foo', null, {}, 5, true, NaN]) {
|
|
|
3f476a |
- assert.throws(() => {
|
|
|
3f476a |
- crypto.sign('sha1', data, {
|
|
|
3f476a |
- key: certPem,
|
|
|
3f476a |
- dsaEncoding
|
|
|
3f476a |
- });
|
|
|
3f476a |
- }, {
|
|
|
3f476a |
- code: 'ERR_INVALID_OPT_VALUE'
|
|
|
3f476a |
- });
|
|
|
3f476a |
- }
|
|
|
3f476a |
-}
|
|
|
3f476a |
-
|
|
|
3f476a |
-
|
|
|
3f476a |
// RSA-PSS Sign test by verifying with 'openssl dgst -verify'
|
|
|
3f476a |
// Note: this particular test *must* be the last in this file as it will exit
|
|
|
3f476a |
// early if no openssl binary is found
|
|
|
3f476a |
diff --git a/test/parallel/test-tls-cli-min-version-1.0.js b/test/parallel/test-tls-cli-min-version-1.0.js
|
|
|
3f476a |
index 577562782e..0a227c0b94 100644
|
|
|
3f476a |
--- a/test/parallel/test-tls-cli-min-version-1.0.js
|
|
|
3f476a |
+++ b/test/parallel/test-tls-cli-min-version-1.0.js
|
|
|
3f476a |
@@ -8,7 +8,7 @@ if (!common.hasCrypto) common.skip('missing crypto');
|
|
|
3f476a |
const assert = require('assert');
|
|
|
3f476a |
const tls = require('tls');
|
|
|
3f476a |
|
|
|
3f476a |
-assert.strictEqual(tls.DEFAULT_MAX_VERSION, 'TLSv1.3');
|
|
|
3f476a |
+assert.strictEqual(tls.DEFAULT_MAX_VERSION, 'TLSv1.2');
|
|
|
3f476a |
assert.strictEqual(tls.DEFAULT_MIN_VERSION, 'TLSv1');
|
|
|
3f476a |
|
|
|
3f476a |
// Check the min-max version protocol versions against these CLI settings.
|
|
|
3f476a |
diff --git a/test/parallel/test-tls-cli-min-version-1.1.js b/test/parallel/test-tls-cli-min-version-1.1.js
|
|
|
3f476a |
index 3af2b39546..1219c82030 100644
|
|
|
3f476a |
--- a/test/parallel/test-tls-cli-min-version-1.1.js
|
|
|
3f476a |
+++ b/test/parallel/test-tls-cli-min-version-1.1.js
|
|
|
3f476a |
@@ -8,7 +8,7 @@ if (!common.hasCrypto) common.skip('missing crypto');
|
|
|
3f476a |
const assert = require('assert');
|
|
|
3f476a |
const tls = require('tls');
|
|
|
3f476a |
|
|
|
3f476a |
-assert.strictEqual(tls.DEFAULT_MAX_VERSION, 'TLSv1.3');
|
|
|
3f476a |
+assert.strictEqual(tls.DEFAULT_MAX_VERSION, 'TLSv1.2');
|
|
|
3f476a |
assert.strictEqual(tls.DEFAULT_MIN_VERSION, 'TLSv1.1');
|
|
|
3f476a |
|
|
|
3f476a |
// Check the min-max version protocol versions against these CLI settings.
|
|
|
3f476a |
diff --git a/test/parallel/test-tls-cli-min-version-1.2.js b/test/parallel/test-tls-cli-min-version-1.2.js
|
|
|
3f476a |
index 8385eabd0b..058dc180f6 100644
|
|
|
3f476a |
--- a/test/parallel/test-tls-cli-min-version-1.2.js
|
|
|
3f476a |
+++ b/test/parallel/test-tls-cli-min-version-1.2.js
|
|
|
3f476a |
@@ -8,7 +8,7 @@ if (!common.hasCrypto) common.skip('missing crypto');
|
|
|
3f476a |
const assert = require('assert');
|
|
|
3f476a |
const tls = require('tls');
|
|
|
3f476a |
|
|
|
3f476a |
-assert.strictEqual(tls.DEFAULT_MAX_VERSION, 'TLSv1.3');
|
|
|
3f476a |
+assert.strictEqual(tls.DEFAULT_MAX_VERSION, 'TLSv1.2');
|
|
|
3f476a |
assert.strictEqual(tls.DEFAULT_MIN_VERSION, 'TLSv1.2');
|
|
|
3f476a |
|
|
|
3f476a |
// Check the min-max version protocol versions against these CLI settings.
|
|
|
3f476a |
diff --git a/test/parallel/test-tls-destroy-stream.js b/test/parallel/test-tls-destroy-stream.js
|
|
|
3f476a |
index a49e985a7e..1964f676c2 100644
|
|
|
3f476a |
--- a/test/parallel/test-tls-destroy-stream.js
|
|
|
3f476a |
+++ b/test/parallel/test-tls-destroy-stream.js
|
|
|
3f476a |
@@ -9,7 +9,7 @@ const net = require('net');
|
|
|
3f476a |
const assert = require('assert');
|
|
|
3f476a |
const tls = require('tls');
|
|
|
3f476a |
|
|
|
3f476a |
-tls.DEFAULT_MAX_VERSION = 'TLSv1.3';
|
|
|
3f476a |
+tls.DEFAULT_MAX_VERSION = 'TLSv1.2';
|
|
|
3f476a |
|
|
|
3f476a |
// This test ensures that an instance of StreamWrap should emit "end" and
|
|
|
3f476a |
// "close" when the socket on the other side call `destroy()` instead of
|
|
|
3f476a |
diff --git a/test/parallel/test-tls-getcipher.js b/test/parallel/test-tls-getcipher.js
|
|
|
3f476a |
index 744276aa59..47d3bbdd98 100644
|
|
|
3f476a |
--- a/test/parallel/test-tls-getcipher.js
|
|
|
3f476a |
+++ b/test/parallel/test-tls-getcipher.js
|
|
|
3f476a |
@@ -72,25 +72,3 @@ server.listen(0, '127.0.0.1', common.mustCall(function() {
|
|
|
3f476a |
this.end();
|
|
|
3f476a |
}));
|
|
|
3f476a |
}));
|
|
|
3f476a |
-
|
|
|
3f476a |
-tls.createServer({
|
|
|
3f476a |
- key: fixtures.readKey('agent2-key.pem'),
|
|
|
3f476a |
- cert: fixtures.readKey('agent2-cert.pem'),
|
|
|
3f476a |
- ciphers: 'TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_CCM_8_SHA256',
|
|
|
3f476a |
- maxVersion: 'TLSv1.3',
|
|
|
3f476a |
-}, common.mustCall(function() {
|
|
|
3f476a |
- this.close();
|
|
|
3f476a |
-})).listen(0, common.mustCall(function() {
|
|
|
3f476a |
- const client = tls.connect({
|
|
|
3f476a |
- port: this.address().port,
|
|
|
3f476a |
- ciphers: 'TLS_AES_128_CCM_8_SHA256',
|
|
|
3f476a |
- maxVersion: 'TLSv1.3',
|
|
|
3f476a |
- rejectUnauthorized: false
|
|
|
3f476a |
- }, common.mustCall(() => {
|
|
|
3f476a |
- const cipher = client.getCipher();
|
|
|
3f476a |
- assert.strictEqual(cipher.name, 'TLS_AES_128_CCM_8_SHA256');
|
|
|
3f476a |
- assert.strictEqual(cipher.standardName, cipher.name);
|
|
|
3f476a |
- assert.strictEqual(cipher.version, 'TLSv1.3');
|
|
|
3f476a |
- client.end();
|
|
|
3f476a |
- }));
|
|
|
3f476a |
-}));
|
|
|
3f476a |
diff --git a/test/parallel/test-tls-min-max-version.js b/test/parallel/test-tls-min-max-version.js
|
|
|
3f476a |
index 4fcb9247d3..085e123264 100644
|
|
|
3f476a |
--- a/test/parallel/test-tls-min-max-version.js
|
|
|
3f476a |
+++ b/test/parallel/test-tls-min-max-version.js
|
|
|
3f476a |
@@ -219,26 +219,19 @@ test(U, U, 'TLSv1_method', 'TLSv1', 'TLSv1.2', U, 'TLSv1');
|
|
|
3f476a |
test(U, U, 'TLSv1_1_method', 'TLSv1', 'TLSv1.2', U, 'TLSv1.1');
|
|
|
3f476a |
test(U, U, 'TLSv1_2_method', 'TLSv1', 'TLSv1.2', U, 'TLSv1.2');
|
|
|
3f476a |
|
|
|
3f476a |
-test('TLSv1', 'TLSv1.1', U, 'TLSv1', 'TLSv1.3', U, 'TLSv1.1');
|
|
|
3f476a |
test('TLSv1', 'TLSv1.1', U, 'TLSv1', 'TLSv1.2', U, 'TLSv1.1');
|
|
|
3f476a |
test('TLSv1', 'TLSv1.2', U, 'TLSv1', 'TLSv1.1', U, 'TLSv1.1');
|
|
|
3f476a |
-test('TLSv1', 'TLSv1.3', U, 'TLSv1', 'TLSv1.1', U, 'TLSv1.1');
|
|
|
3f476a |
test('TLSv1', 'TLSv1', U, 'TLSv1', 'TLSv1.1', U, 'TLSv1');
|
|
|
3f476a |
test('TLSv1', 'TLSv1.2', U, 'TLSv1', 'TLSv1', U, 'TLSv1');
|
|
|
3f476a |
-test('TLSv1', 'TLSv1.3', U, 'TLSv1', 'TLSv1', U, 'TLSv1');
|
|
|
3f476a |
test('TLSv1.1', 'TLSv1.1', U, 'TLSv1', 'TLSv1.2', U, 'TLSv1.1');
|
|
|
3f476a |
test('TLSv1', 'TLSv1.2', U, 'TLSv1.1', 'TLSv1.1', U, 'TLSv1.1');
|
|
|
3f476a |
-test('TLSv1', 'TLSv1.2', U, 'TLSv1', 'TLSv1.3', U, 'TLSv1.2');
|
|
|
3f476a |
|
|
|
3f476a |
// v-any client can connect to v-specific server
|
|
|
3f476a |
-test('TLSv1', 'TLSv1.3', U, 'TLSv1.3', 'TLSv1.3', U, 'TLSv1.3');
|
|
|
3f476a |
-test('TLSv1', 'TLSv1.3', U, 'TLSv1.2', 'TLSv1.3', U, 'TLSv1.3');
|
|
|
3f476a |
-test('TLSv1', 'TLSv1.3', U, 'TLSv1.2', 'TLSv1.2', U, 'TLSv1.2');
|
|
|
3f476a |
-test('TLSv1', 'TLSv1.3', U, 'TLSv1.1', 'TLSv1.1', U, 'TLSv1.1');
|
|
|
3f476a |
-test('TLSv1', 'TLSv1.3', U, 'TLSv1', 'TLSv1', U, 'TLSv1');
|
|
|
3f476a |
+test('TLSv1', 'TLSv1.2', U, 'TLSv1.2', 'TLSv1.2', U, 'TLSv1.2');
|
|
|
3f476a |
+test('TLSv1', 'TLSv1.2', U, 'TLSv1.1', 'TLSv1.1', U, 'TLSv1.1');
|
|
|
3f476a |
+test('TLSv1', 'TLSv1.2', U, 'TLSv1', 'TLSv1', U, 'TLSv1');
|
|
|
3f476a |
|
|
|
3f476a |
// v-specific client can connect to v-any server
|
|
|
3f476a |
-test('TLSv1.3', 'TLSv1.3', U, 'TLSv1', 'TLSv1.3', U, 'TLSv1.3');
|
|
|
3f476a |
-test('TLSv1.2', 'TLSv1.2', U, 'TLSv1', 'TLSv1.3', U, 'TLSv1.2');
|
|
|
3f476a |
-test('TLSv1.1', 'TLSv1.1', U, 'TLSv1', 'TLSv1.3', U, 'TLSv1.1');
|
|
|
3f476a |
-test('TLSv1', 'TLSv1', U, 'TLSv1', 'TLSv1.3', U, 'TLSv1');
|
|
|
3f476a |
+test('TLSv1.2', 'TLSv1.2', U, 'TLSv1', 'TLSv1.2', U, 'TLSv1.2');
|
|
|
3f476a |
+test('TLSv1.1', 'TLSv1.1', U, 'TLSv1', 'TLSv1.2', U, 'TLSv1.1');
|
|
|
3f476a |
+test('TLSv1', 'TLSv1', U, 'TLSv1', 'TLSv1.2', U, 'TLSv1');
|
|
|
3f476a |
diff --git a/test/parallel/test-tls-psk-circuit.js b/test/parallel/test-tls-psk-circuit.js
|
|
|
3f476a |
index 4bcdf36860..0642e18d5e 100644
|
|
|
3f476a |
--- a/test/parallel/test-tls-psk-circuit.js
|
|
|
3f476a |
+++ b/test/parallel/test-tls-psk-circuit.js
|
|
|
3f476a |
@@ -62,9 +62,9 @@ const DISCONNECT_MESSAGE =
|
|
|
3f476a |
|
|
|
3f476a |
test({ psk: USERS.UserA, identity: 'UserA' });
|
|
|
3f476a |
test({ psk: USERS.UserA, identity: 'UserA' }, { maxVersion: 'TLSv1.2' });
|
|
|
3f476a |
-test({ psk: USERS.UserA, identity: 'UserA' }, { minVersion: 'TLSv1.3' });
|
|
|
3f476a |
+test({ psk: USERS.UserA, identity: 'UserA' }, { minVersion: 'TLSv1.2' });
|
|
|
3f476a |
test({ psk: USERS.UserB, identity: 'UserB' });
|
|
|
3f476a |
-test({ psk: USERS.UserB, identity: 'UserB' }, { minVersion: 'TLSv1.3' });
|
|
|
3f476a |
+test({ psk: USERS.UserB, identity: 'UserB' }, { minVersion: 'TLSv1.2' });
|
|
|
3f476a |
// Unrecognized user should fail handshake
|
|
|
3f476a |
test({ psk: USERS.UserB, identity: 'UserC' }, {}, DISCONNECT_MESSAGE);
|
|
|
3f476a |
// Recognized user but incorrect secret should fail handshake
|
|
|
3f476a |
--
|
|
|
f0ceb1 |
2.31.1
|
|
|
3f476a |
|