node/test/parallel/test-tls-clientcertengine-unsupported.js
Daniel Bevenius bf5cc3bf1a
crypto: move process.binding('crypto') to internal
This commit makes the crypto builtin an internal builtin, and
changes usage of the builtin from using process.binding('crypto')
to use internalBinding instead.

Refs: https://github.com/nodejs/node/issues/22160

PR-URL: https://github.com/nodejs/node/pull/22426
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2018-08-24 00:49:29 +02:00

30 lines
723 B
JavaScript

// Flags: --expose-internals
'use strict';
const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
// Monkey-patch SecureContext
const { internalBinding } = require('internal/test/binding');
const binding = internalBinding('crypto');
const NativeSecureContext = binding.SecureContext;
binding.SecureContext = function() {
const rv = new NativeSecureContext();
rv.setClientCertEngine = undefined;
return rv;
};
const tls = require('tls');
{
common.expectsError(
() => { tls.createSecureContext({ clientCertEngine: 'Cannonmouth' }); },
{
code: 'ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED',
message: 'Custom engines not supported by this OpenSSL'
}
);
}