Btw i have verified that in openssl command line tool if i switch order from the one that worked for me:
OpenSSL> engine dynamic -pre SO_PATH:/usr/lib/engines-1.1/libpkcs11.so -pre ID:pkcs11 -pre LIST_ADD:1 -pre LOAD -pre MODULE_PATH:/usr/lib/libckteec.so to the one that was in the code: OpenSSL> engine dynamic -pre SO_PATH:/usr/lib/engines-1.1/libpkcs11.so -pre MODULE_PATH:/usr/lib/libckteec.so -pre ID:pkcs11 -pre LIST_ADD:1 -pre LOAD the error is the same as for me in the C# code. So the question is if you are telling me that the proper order is like that: dynamic --> set SO_PATH --> LOAD and then set all parameters of the engine that SO_PATH implements. does the order which i used is also correct one? BR Piotr ________________________________ Od: openssl-users <openssl-users-boun...@openssl.org> w imieniu użytkownika Piotr Lobacz <piotr.lob...@softgent.com> Wysłane: środa, 26 maja 2021 22:32 Do: Selva Nair <selva.n...@gmail.com> DW: openssl-users@openssl.org <openssl-users@openssl.org> Temat: ODP: dynamic engine load Yeah, that is what i have figured it out and written it in my previous message:] but big thx for help. BR Piotr Lobacz ________________________________ Od: Selva Nair <selva.n...@gmail.com> Wysłane: środa, 26 maja 2021 15:52 Do: Piotr Lobacz <piotr.lob...@softgent.com> DW: openssl-users@openssl.org <openssl-users@openssl.org> Temat: Re: dynamic engine load Hi, On Wed, May 26, 2021 at 9:25 AM Piotr Lobacz <piotr.lob...@softgent.com> wrote: > > Hi all, > I am trying to write a function which will load dynamic engine for pkcs11. > What i intendt to do is not to use engine id pkcs11 but dynamic. The problem > is that i get an error for ENGINE_ctrl_cmd_string with MODULE_PATH parameter. > My function currently looks like this: > > public void Initialize() > { > if (null == engine) > { > engine = SafeNativeMethods.ENGINE_by_id("dynamic"); > if (engine.IsInvalid) > { > throw new InvalidOperationException($"Unable to load > dynamic engine"); > } > > if (!File.Exists(EnginePath)) > { > throw new InvalidOperationException($"Unable to find > engine library path"); > } > > if (1 != SafeNativeMethods.ENGINE_ctrl_cmd_string(engine, > "SO_PATH", EnginePath, 0)) > { > throw new InvalidOperationException("dynamic: setting > so_path <= '{EnginePath}'"); > } At this point you should do the "LOAD" control to get the dynamic engine shell replaced by pkcs11. Then set the ID and the MODULE_PATH. So its dynamic --> set SO_PATH --> LOAD and then set all parameters of the engine that SO_PATH implements. Selva Selva [https://softgent.com/wp-content/uploads/2020/01/Zasob-14.png]<https://www.softgent.com> Softgent Sp. z o.o., Budowlanych 31d, 80-298 Gdansk, POLAND KRS: 0000674406, NIP: 9581679801, REGON: 367090912 www.softgent.com Sąd Rejonowy Gdańsk-Północ w Gdańsku, VII Wydział Gospodarczy Krajowego Rejestru Sądowego KRS 0000674406, Kapitał zakładowy: 25 000,00 zł wpłacony w całości.