EDIT (the whole question, it was too unclear)
I want to use OpenSSL.NET
The OpenSSL.NET install instructions page: INSTALL
Make sure you have libeay32.dll and ssleay32.dll in the current working directory of your application or in your PATH. DONE
In your .NET project, add a reference to the ManagedOpenSsl.dll assembly. DONE
I have put libeay32.dll
and ssleay32.dll
in both my bin/Debug
and bin/Release
directories. I have also put them in system32
.
Here is my FULL code:
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
try
{
OpenSSL.Crypto.RSA rsa = new OpenSSL.Crypto.RSA();
}
catch (Exception e)
{
Console.WriteLine(e.InnerException.Message);
}
Console.Read();
}
}
}
I get the following error: Unable to load DLL 'libeay32' http://localhostr.com/files/a719c5/Error.gif (Unable to load DLL 'libeay32')
Here is the Process Monitor log (upon request): alt text http://localhostr.com/files/726a46/ProcMon.gif
What am I doing wrong? Why isn't the DLL found?
You're probably missing the VC++ redistributables. I'm assuming OpenSSL.NET is x86 only, so you can grab the VS2008 version x86 redistributable if they're release builds.
Otherwise, if they're debug builds (you'll see Microsoft.VC90.DebugCRT in EventViewer or the sxstrace logs) then you'll need to either:
Try using probing. You need to create an XML config file named as the application's executable complete name (or named as the assembly that requieres your non-managed dll) with a .config extension. E.g. if your applications is name myapp.exe, the config file will be named myapp.exe.config The config file must be located in the same directory as the executable / assembly .
The config file is a simple xml file:
Now the application will search in PATH when loading the assemblies. PATH is relative to the config /assembly file.
Not sure if it will work for non-managed dlls, but is worth the try.
Try the latest version of OpenSSL.NET (0.4.1) which should now include prebuilt libeay32.dll and ssleay32.dll binaries that link to the CRT statically. Alternatively, you can build these libraries yourself or use an 'official' build from openssl.org.
Create New Folder Named x86 in your application path and then put libeay32.dll,ssleay32.dll in x86 folder.
Without looking at your code exactly, I get that error when I:
EDIT: When all else fails, try dependency walker, because it sounds like your dlls are calling other dlls that aren't in your path or in the directory of the executable.
The .NET way of doing this is to install your assembly in the global assembly cache.