Since `common/crypto` already exists, it makes sense to keep crypto-related utilities there. The only exception being common.hasCrypto which is needed up front to determine if tests should be skipped. Eliminate the redundant check in hasFipsCrypto and just use crypto.getFips() directly where needed. PR-URL: https://github.com/nodejs/node/pull/56714 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
33 lines
757 B
JavaScript
33 lines
757 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
if (!common.hasCrypto) {
|
|
common.skip('missing crypto');
|
|
}
|
|
|
|
const { hasOpenSSL3 } = require('../common/crypto');
|
|
|
|
if (!hasOpenSSL3) {
|
|
common.skip('OpenSSL legacy failures are only testable with OpenSSL 3+');
|
|
}
|
|
|
|
const fixtures = require('../common/fixtures');
|
|
|
|
const {
|
|
assert, connect, keys
|
|
} = require(fixtures.path('tls-connect'));
|
|
|
|
const legacyPfx = fixtures.readKey('legacy.pfx');
|
|
|
|
connect({
|
|
client: {
|
|
pfx: legacyPfx,
|
|
passphrase: 'legacy',
|
|
rejectUnauthorized: false
|
|
},
|
|
server: keys.agent1
|
|
}, common.mustCall((e, pair, cleanup) => {
|
|
assert.strictEqual(e.code, 'ERR_CRYPTO_UNSUPPORTED_OPERATION');
|
|
assert.strictEqual(e.message, 'Unsupported PKCS12 PFX data');
|
|
cleanup();
|
|
}));
|