mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
f666a1b754
Co-Authored-By: Fabian Iwand <mootari@users.noreply.github.com> PR-URL: https://github.com/nodejs/node/pull/52627 Fixes: https://github.com/nodejs/node/issues/52448 Refs: https://github.com/nodejs/node/pull/23188 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
33 lines
849 B
JavaScript
33 lines
849 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
const assert = require('assert');
|
|
const tls = require('tls');
|
|
|
|
{
|
|
// Check tlsClientError on invalid pskIdentityHint.
|
|
|
|
const server = tls.createServer({
|
|
ciphers: 'PSK+HIGH',
|
|
pskCallback: () => {},
|
|
pskIdentityHint: 'a'.repeat(512), // Too long identity hint.
|
|
});
|
|
server.on('tlsClientError', (err) => {
|
|
assert.ok(err instanceof Error);
|
|
assert.strictEqual(err.code, 'ERR_TLS_PSK_SET_IDENTITY_HINT_FAILED');
|
|
server.close();
|
|
});
|
|
server.listen(0, () => {
|
|
const client = tls.connect({
|
|
port: server.address().port,
|
|
ciphers: 'PSK+HIGH',
|
|
checkServerIdentity: () => {},
|
|
pskCallback: () => {},
|
|
}, () => {});
|
|
client.on('error', common.expectsError({ code: 'ECONNRESET' }));
|
|
});
|
|
}
|