Skip to content

TLS: keys from engines? #28921

@OYTIS

Description

@OYTIS

As far as I can see NodeJS TLS does support OpenSSL engines. But it looks like it only supports them for certificates.

My use-case is a private key managed inside an engine. What I would do, e.g. with libcurl is

// load the engine
curl_easy_setopt(curl, CURLOPT_SSLENGINE, "mycoolengine");

// set it as a default engine
curl_easy_setopt(curl, CURLOPT_SSLENGINE_DEFAULT, 1L);

// tell libcurl that private key is managed by the engine
curl_easy_setopt(curl, CURLOPT_SSLKEYTYPE, "ENG");

// set key name (arbitrary string, interpreted by the engine)
curl_easy_setopt(curl, CURLOPT_SSLKEY, "myenginekeyname");

With nodejs it goes like:

> tls_ctx = tls.createSecureContext({"clientCertEngine":"mycoolengine", "key":"myenginekeyname"})

Error: error:0906D06C:PEM routines:PEM_read_bio:no start line
    at Object.createSecureContext (_tls_common.js:104:17)

So looks like it tries to interpret "myenginekeyname" as PEM. Am I doing something wrong, or is this use-case not supported at all?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    cryptoIssues and PRs related to the crypto subsystem.feature requestIssues that request new features to be added to Node.js.tlsIssues and PRs related to the tls subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions