Files
node/test/parallel/test-crypto-sec-level.js
T
Filip Skokan 137ff67fd3 crypto: use available BoringSSL APIs
Use BoringSSL's current RSA and DH validation results instead of
maintaining backend-specific prechecks and collapsing key errors.

Report negotiated TLS groups and the documented zero security level
through BoringSSL's compatibility APIs.

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/65423
Backport-PR-URL: https://github.com/nodejs/node/pull/65483
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Tim Perry <pimterry@gmail.com>
2026-08-26 00:56:01 +02:00

23 lines
845 B
JavaScript

// Flags: --expose-internals
'use strict';
const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
const assert = require('assert');
// OpenSSL has a set of security levels which affect what algorithms
// are available by default. Different OpenSSL versions have different
// default security levels and we use this value to adjust what a test
// expects based on the security level. You can read more in
// https://docs.openssl.org/1.1.1/man3/SSL_CTX_set_security_level/#default-callback-behaviour
// This test simply validates that we can get some value for the secLevel
// when needed by tests.
const secLevel = require('internal/crypto/util').getOpenSSLSecLevel();
if (process.features.openssl_is_boringssl) {
assert.strictEqual(secLevel, 0);
} else {
assert.ok(secLevel >= 0 && secLevel <= 5);
}