mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 18:25:13 +08:00
Revert "crypto,https,tls: runtime-deprecate OpenSSL engine-based APIs (DEP0183)"
This reverts commit da516920fc.
PR-URL: https://github.com/nodejs/node/pull/64777
Fixes: https://github.com/nodejs/node/issues/56733
Refs: https://github.com/nodejs/node/pull/64211
Refs: https://github.com/nodejs/node/pull/63966
Refs: https://github.com/nodejs/node/pull/53329
Refs: https://github.com/nodejs/node/pull/48950
Refs: https://github.com/nodejs/node/issues/45465
Refs: https://github.com/nodejs/node/issues/42827
Refs: https://github.com/nodejs/node/issues/47076
Refs: https://github.com/nodejs/node/pull/62862
Refs: https://github.com/nodejs/node/pull/38512
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
This commit is contained in:
12 files changed
+5
-95
No files matched your search
+1
-7
@@ -6606,9 +6606,6 @@ added: v15.6.0
|
||||
<!-- YAML
|
||||
added: v0.11.11
|
||||
changes:
|
||||
- version: REPLACEME
|
||||
pr-url: https://github.com/nodejs/node/pull/63966
|
||||
description: Runtime deprecation.
|
||||
- version:
|
||||
- v22.4.0
|
||||
- v20.16.0
|
||||
@@ -6616,14 +6613,11 @@ changes:
|
||||
description: Custom engine support in OpenSSL 3 is deprecated.
|
||||
-->
|
||||
|
||||
> Stability: 0 - Deprecated
|
||||
|
||||
* `engine` {string}
|
||||
* `flags` {crypto.constants} **Default:** `crypto.constants.ENGINE_METHOD_ALL`
|
||||
|
||||
Load and set the `engine` for some or all OpenSSL functions (selected by flags).
|
||||
Use of this API is deprecated because custom engine support has been deprecated
|
||||
since OpenSSL 3.
|
||||
Support for custom engines in OpenSSL is deprecated from OpenSSL 3.
|
||||
|
||||
`engine` could be either an id or a path to the engine's shared library.
|
||||
|
||||
|
||||
@@ -4111,9 +4111,6 @@ that are shorter than the default authentication tag length (i.e., shorter than
|
||||
|
||||
<!-- YAML
|
||||
changes:
|
||||
- version: REPLACEME
|
||||
pr-url: https://github.com/nodejs/node/pull/63966
|
||||
description: Runtime deprecation.
|
||||
- version:
|
||||
- v22.4.0
|
||||
- v20.16.0
|
||||
@@ -4121,7 +4118,7 @@ changes:
|
||||
description: Documentation-only deprecation.
|
||||
-->
|
||||
|
||||
Type: Runtime
|
||||
Type: Documentation-only
|
||||
|
||||
OpenSSL 3 has deprecated support for custom engines with a recommendation to
|
||||
switch to its new provider model. The `clientCertEngine` option for
|
||||
|
||||
@@ -427,9 +427,6 @@ a `timeout` of 5 seconds.
|
||||
<!-- YAML
|
||||
added: v0.3.6
|
||||
changes:
|
||||
- version: REPLACEME
|
||||
pr-url: https://github.com/nodejs/node/pull/63966
|
||||
description: The `clientCertEngine` option is runtime deprecated.
|
||||
- version:
|
||||
- v22.4.0
|
||||
- v20.16.0
|
||||
|
||||
@@ -1988,10 +1988,6 @@ argument.
|
||||
<!-- YAML
|
||||
added: v0.11.13
|
||||
changes:
|
||||
- version: REPLACEME
|
||||
pr-url: https://github.com/nodejs/node/pull/63966
|
||||
description: The `clientCertEngine`, `privateKeyEngine` and
|
||||
`privateKeyIdentifier` options are runtime deprecated.
|
||||
- version:
|
||||
- v26.4.0
|
||||
- v24.19.0
|
||||
@@ -2216,9 +2212,6 @@ permissible, use 2048 bits or larger for stronger security.
|
||||
<!-- YAML
|
||||
added: v0.3.2
|
||||
changes:
|
||||
- version: REPLACEME
|
||||
pr-url: https://github.com/nodejs/node/pull/63966
|
||||
description: The `clientCertEngine` option is runtime deprecated.
|
||||
- version:
|
||||
- v22.4.0
|
||||
- v20.16.0
|
||||
|
||||
@@ -96,7 +96,6 @@ const { Buffer } = require('buffer');
|
||||
const {
|
||||
emitExperimentalWarning,
|
||||
filterDuplicateStrings,
|
||||
getDeprecationWarningEmitter,
|
||||
lazyDOMException,
|
||||
setOwnProperty,
|
||||
} = require('internal/util');
|
||||
@@ -213,11 +212,6 @@ const getMacs = cachedArrayByFipsGeneration(
|
||||
const getCurves = cachedArrayByFipsGeneration(
|
||||
() => filterDuplicateStrings(_getCurves()));
|
||||
|
||||
const emitOpenSSLEngineDeprecation = getDeprecationWarningEmitter(
|
||||
'DEP0183',
|
||||
'OpenSSL engine-based APIs are deprecated.',
|
||||
);
|
||||
|
||||
function setEngine(id, flags) {
|
||||
validateString(id, 'id');
|
||||
if (flags)
|
||||
@@ -228,8 +222,6 @@ function setEngine(id, flags) {
|
||||
if (flags === 0)
|
||||
flags = ENGINE_METHOD_ALL;
|
||||
|
||||
emitOpenSSLEngineDeprecation();
|
||||
|
||||
if (typeof _setEngine !== 'function')
|
||||
throw new ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED();
|
||||
if (!_setEngine(id, flags))
|
||||
@@ -1286,7 +1278,6 @@ module.exports = {
|
||||
getHashes,
|
||||
getMacs,
|
||||
getOptionalByteLength,
|
||||
emitOpenSSLEngineDeprecation,
|
||||
kHandle,
|
||||
setEngine,
|
||||
toBuf,
|
||||
|
||||
@@ -34,7 +34,6 @@ const {
|
||||
} = require('internal/validators');
|
||||
|
||||
const {
|
||||
emitOpenSSLEngineDeprecation,
|
||||
toBuf,
|
||||
} = require('internal/crypto/util');
|
||||
|
||||
@@ -270,7 +269,6 @@ function configSecureContext(context, options = kEmptyObject, name = 'options')
|
||||
|
||||
if (typeof privateKeyIdentifier === 'string' &&
|
||||
typeof privateKeyEngine === 'string') {
|
||||
emitOpenSSLEngineDeprecation();
|
||||
if (context.setEngineKey)
|
||||
context.setEngineKey(privateKeyIdentifier, privateKeyEngine);
|
||||
else
|
||||
@@ -332,7 +330,6 @@ function configSecureContext(context, options = kEmptyObject, name = 'options')
|
||||
}
|
||||
|
||||
if (typeof clientCertEngine === 'string') {
|
||||
emitOpenSSLEngineDeprecation();
|
||||
if (typeof context.setClientCertEngine !== 'function')
|
||||
throw new ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED();
|
||||
else
|
||||
|
||||
@@ -26,12 +26,6 @@ const agentKey = fs.readFileSync(fixture.path('/keys/agent1-key.pem'));
|
||||
const agentCert = fs.readFileSync(fixture.path('/keys/agent1-cert.pem'));
|
||||
const agentCa = fs.readFileSync(fixture.path('/keys/ca1-cert.pem'));
|
||||
|
||||
common.expectWarning({
|
||||
DeprecationWarning: {
|
||||
DEP0183: 'OpenSSL engine-based APIs are deprecated.',
|
||||
},
|
||||
});
|
||||
|
||||
const serverOptions = {
|
||||
key: agentKey,
|
||||
cert: agentCert,
|
||||
|
||||
@@ -26,12 +26,6 @@ const agentKey = fs.readFileSync(fixture.path('/keys/agent1-key.pem'));
|
||||
const agentCert = fs.readFileSync(fixture.path('/keys/agent1-cert.pem'));
|
||||
const agentCa = fs.readFileSync(fixture.path('/keys/ca1-cert.pem'));
|
||||
|
||||
common.expectWarning({
|
||||
DeprecationWarning: {
|
||||
DEP0183: 'OpenSSL engine-based APIs are deprecated.',
|
||||
},
|
||||
});
|
||||
|
||||
const serverOptions = {
|
||||
key: agentKey,
|
||||
cert: agentCert,
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
const assert = require('assert');
|
||||
const crypto = require('crypto');
|
||||
|
||||
common.expectWarning({
|
||||
DeprecationWarning: {
|
||||
DEP0183: 'OpenSSL engine-based APIs are deprecated.',
|
||||
},
|
||||
});
|
||||
|
||||
assert.throws(
|
||||
() => crypto.setEngine('nodejs-test-invalid-engine'),
|
||||
(err) => {
|
||||
return err.code === 'ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED' ||
|
||||
err.code === 'ERR_CRYPTO_ENGINE_UNKNOWN';
|
||||
},
|
||||
);
|
||||
@@ -6,15 +6,6 @@ if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
const assert = require('assert');
|
||||
|
||||
common.expectWarning({
|
||||
'internal/test/binding':
|
||||
'These APIs are for internal testing only. Do not use them.',
|
||||
'DeprecationWarning': {
|
||||
DEP0183: 'OpenSSL engine-based APIs are deprecated.',
|
||||
},
|
||||
});
|
||||
|
||||
// Monkey-patch SecureContext
|
||||
const { internalBinding } = require('internal/test/binding');
|
||||
const binding = internalBinding('crypto');
|
||||
|
||||
@@ -8,19 +8,12 @@ if (!common.hasCrypto)
|
||||
const assert = require('assert');
|
||||
const tls = require('tls');
|
||||
|
||||
const secureContext = tls.createSecureContext();
|
||||
if (typeof secureContext.context.setClientCertEngine !== 'function')
|
||||
common.skip('OpenSSL dropped engine support');
|
||||
|
||||
common.expectWarning({
|
||||
DeprecationWarning: {
|
||||
DEP0183: 'OpenSSL engine-based APIs are deprecated.',
|
||||
},
|
||||
});
|
||||
|
||||
assert.throws(() => {
|
||||
tls.createSecureContext({ clientCertEngine: 'x' });
|
||||
}, (err) => {
|
||||
if (err.code === 'ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED')
|
||||
common.skip('OpenSSL dropped engine support');
|
||||
|
||||
return err.name === 'Error' &&
|
||||
/could not load the shared library/.test(err.message) &&
|
||||
Array.isArray(err.opensslErrorStack) &&
|
||||
|
||||
@@ -6,15 +6,6 @@ if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
const assert = require('assert');
|
||||
|
||||
common.expectWarning({
|
||||
'internal/test/binding':
|
||||
'These APIs are for internal testing only. Do not use them.',
|
||||
'DeprecationWarning': {
|
||||
DEP0183: 'OpenSSL engine-based APIs are deprecated.',
|
||||
},
|
||||
});
|
||||
|
||||
// Monkey-patch SecureContext
|
||||
const { internalBinding } = require('internal/test/binding');
|
||||
const binding = internalBinding('crypto');
|
||||
|
||||
Reference in new issue
Block a user