mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
test: use an always invalid cipher and cover OpenSSL 4.0 behaviours
Signed-off-by: Filip Skokan <panva.ip@gmail.com> PR-URL: https://github.com/nodejs/node/pull/62805 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
1 parent
036bc6f300
commit
698d8287d1
1 file changed
+18
-1
@@ -7,12 +7,13 @@ if (!common.hasCrypto)
|
||||
const assert = require('assert');
|
||||
const tls = require('tls');
|
||||
const fixtures = require('../common/fixtures');
|
||||
const { hasOpenSSL } = require('../common/crypto');
|
||||
|
||||
{
|
||||
const options = {
|
||||
key: fixtures.readKey('agent2-key.pem'),
|
||||
cert: fixtures.readKey('agent2-cert.pem'),
|
||||
ciphers: 'aes256-sha'
|
||||
ciphers: 'DES-CBC-SHA'
|
||||
};
|
||||
assert.throws(() => tls.createServer(options, common.mustNotCall()),
|
||||
/no[_ ]cipher[_ ]match/i);
|
||||
@@ -23,3 +24,19 @@ const fixtures = require('../common/fixtures');
|
||||
assert.throws(() => tls.createServer(options, common.mustNotCall()),
|
||||
/no[_ ]cipher[_ ]match/i);
|
||||
}
|
||||
|
||||
// Cipher name matching is case-sensitive prior to OpenSSL 4.0, and
|
||||
// case-insensitive starting with OpenSSL 4.0.
|
||||
{
|
||||
const options = {
|
||||
key: fixtures.readKey('agent2-key.pem'),
|
||||
cert: fixtures.readKey('agent2-cert.pem'),
|
||||
ciphers: 'aes256-sha',
|
||||
};
|
||||
if (hasOpenSSL(4, 0)) {
|
||||
tls.createServer(options).close();
|
||||
} else {
|
||||
assert.throws(() => tls.createServer(options, common.mustNotCall()),
|
||||
/no[_ ]cipher[_ ]match/i);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user