Description
What is the problem this feature will solve?
The fix for #15113, #24234, added support for crypto key objects, but the issue notes that "Loading keys from engines is not supported yet.". Later, c2ce8d0 (see #28973) added support for loading engine keys specifically for TLS, which means that the requisite calls to OpenSSL had to be added but only for SecureContext
objects. In the interim, this code has migrated over to crypto_context.cc, but it is still exclusively associated with SecureContext
objects, meaning, I think, that it is still not possible to use the lower-level cryptographic primitives of the crypto
API with engine keys.
This impacts node.js downstream libraries, by requiring that applications handle exposed private key material to, for example, construct JWTs. See Azure/azure-sdk-for-js#22011 and octokit/auth-app.js#336 .
What is the feature you are proposing to solve the problem?
I would like the API of #24234 to be extended to support loading key objects from engines. This should be, I think, a fairly straightforward refactoring of existing code.
What alternatives have you considered?
There appear to be no general-purpose, viable alternatives that do not require exposing keying material to the running node.js
application. It could be possible to specifically modify https://github.com/auth0/node-jwa to reach around node.js to, say, contact an openssh
agent for PKCS#11 services, but this is much less preferable to just allowing the built-in crypto
layer, which jwa
already uses, able to load engine keys.