node/test/parallel/test-tls-error-stack.js
Filip Skokan da516920fc
crypto,https,tls: runtime-deprecate OpenSSL engine-based APIs (DEP0183)
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/63966
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
2026-06-19 18:03:51 +02:00

28 lines
809 B
JavaScript

'use strict';
// This tests that the crypto error stack can be correctly converted.
const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
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) => {
return err.name === 'Error' &&
/could not load the shared library/.test(err.message) &&
Array.isArray(err.opensslErrorStack) &&
err.opensslErrorStack.length > 0;
});