1'use strict';
2const common = require('../common');
3
4if (!common.hasCrypto)
5  common.skip('missing crypto');
6
7const assert = require('assert');
8const tls = require('tls');
9const fixtures = require('../common/fixtures');
10
11{
12  const options = {
13    key: fixtures.readKey('agent11-key.pem'),
14    cert: fixtures.readKey('agent11-cert.pem'),
15    ciphers: 'DEFAULT'
16  };
17
18  // Should throw error as key is too small because openssl v3 doesn't allow it
19  assert.throws(() => tls.createServer(options, common.mustNotCall()),
20                /key too small/i);
21
22  // Reducing SECLEVEL to 0 in ciphers retains compatibility with previous versions of OpenSSL like using a small key.
23  // As ciphers are getting set before the cert and key get loaded.
24  options.ciphers = 'DEFAULT:@SECLEVEL=0';
25  assert.ok(tls.createServer(options, common.mustNotCall()));
26}
27