Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENGINE_load_private_key can't load key.pem file #441

Closed
GauriSpears opened this issue Mar 7, 2023 · 2 comments
Closed

ENGINE_load_private_key can't load key.pem file #441

GauriSpears opened this issue Mar 7, 2023 · 2 comments

Comments

@GauriSpears
Copy link

Debian, OpenSSL 3.0.8, master gost-engine.
I'm trying to embed gost TLS support into Node.JS so I recompiled it with shared OpenSSL support. Node.JS loads private key in its tls module only this way: EVPKeyPointer key(ENGINE_load_private_key(engine.get(), *key_name, nullptr, nullptr));
But when I use it for 'gost' and '/path/to/key.pem' I get an error:

library: 'engine routines',
  reason: 'no load function',
  code: 'ERR_OSSL_ENGINE_NO_LOAD_FUNCTION'

As far as I understand It's because gost-engine doesn't implement load function. Can you fix it?

@beldmit
Copy link
Contributor

beldmit commented Mar 7, 2023

Yiu should not load the key via Engine method. Openssl 3 still supports engines and loading via smth like https://riptutorial.com/openssl/example/16739/load-private-key
. The engine should be loaded via Openssl config file.

@GauriSpears
Copy link
Author

Thanks, now I clearly see that it's Node.JS issue! It uses PEM_read_bio_PrivateKey both in src/crypto/crypto_keys.cc/ParsePrivateKey for Sign.sign() routine and in src/crypto/crypto_context.cc/SecureContext::SetKey for tls.createSecureContext calls. But it works only in first place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants