Hi, On Wed, May 26, 2021 at 9:25 AM Piotr Lobacz <piotr.lobacz@xxxxxxxxxxxx> 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