ulisescastillo
ulisescastillo

Reputation: 73

Error trying to use OpenSSL .NET

I've downloaded the lates version of the wrapper .NET for the OpenSSL from openssl-net.sourceforge.net Library but having troubles.

I tried to load a private.key like this:

byte[] b = System.IO.File.ReadAllBytes(@"C:\SFDLL\private.key");
            OpenSSL.Core.BIO bio = new OpenSSL.Core.BIO(b);
            OpenSSL.Crypto.CryptoKey key = OpenSSL.Crypto.CryptoKey.FromPrivateKey(bio, "123123");
            int i = 0;

and got error: initializationOpenSSL.Core.Native exception

and the Inner exception is

{"Unable to load DLL 'libeay32': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"}

isn't this the correct way to do this? what I'm doing wrong?

Upvotes: 1

Views: 4681

Answers (1)

jeffora
jeffora

Reputation: 4159

As the error says, libeay32 can't be found. As the installation instructions state on the link you posted for OpenSSL.NET:

Installation

Make sure you have libeay32.dll and ssleay32.dll in the current working directory of your application or in your PATH. In your .NET project, add a reference to the ManagedOpenSsl.dll assembly.

So make sure you have a copy of that dll either in your build directory, or somewhere that is part of your system's PATH.

Upvotes: 3

Related Questions