Attach an ENGINE context to a SSL_CTX

主宰稳场 提交于 2019-12-05 07:18:54

From what I've seen and read, you can't. If you need to use an engine in your code, you have two options:

  1. Set your engine as a default and it will be used by OpenSSL for all those methods that the engine provides, for all others - OpenSSL built in methods will be used. This is the call that you would need to use in this case:

    ENGINE_set_default(engine, ENGINE_METHOD_ALL)

  2. Set your engine for a few chosen methods, e.g. code below will set it up for the method RAND only:

    ENGINE_set_default(engine, ENGINE_METHOD_RAND)

You can find more examples here: https://www.openssl.org/docs/manmaster/crypto/engine.html and in openssl's README.ENGINE.

In other words, engine is a global setting and if you want to map it to an SSL_CTX object, you would need to maintain that map manually.

BTW, I would be glad to be proven wrong, because I need this kind of functionality myself and hope that it will be implemented in the future.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!