diff options
Diffstat (limited to 'test/parallel/test-tls-keyengine-unsupported.js')
-rw-r--r-- | test/parallel/test-tls-keyengine-unsupported.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/parallel/test-tls-keyengine-unsupported.js b/test/parallel/test-tls-keyengine-unsupported.js new file mode 100644 index 0000000000..149fc4dc31 --- /dev/null +++ b/test/parallel/test-tls-keyengine-unsupported.js @@ -0,0 +1,34 @@ +// 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.setEngineKey = undefined; + return rv; +}; + +const tls = require('tls'); + +{ + common.expectsError( + () => { + tls.createSecureContext({ + privateKeyEngine: 'engine', + privateKeyIdentifier: 'key' + }); + }, + { + code: 'ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED', + message: 'Custom engines not supported by this OpenSSL' + } + ); +} |