首页 文章

尝试使用OpenSSL .NET时出错

提问于
浏览
1

我已经从openssl-net.sourceforge.net Library下载了OpenSSL包装.NET的lates版本,但是遇到了麻烦 .

我试着像这样加载一个private.key:

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;

并得到错误:
initializationOpenSSL.Core.Native exception

而内在的例外是

{“无法加载DLL'lossay32':找不到指定的模块 . (HRESULT异常:0x8007007E)”}

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

1 回答

  • 3

    如错误所示,找不到 libeay32 . 正如您为OpenSSL.NET发布的链接上的安装说明所述:

    安装确保在应用程序的当前工作目录或PATH中有libeay32.dll和ssleay32.dll . 在.NET项目中,添加对ManagedOpenSsl.dll程序集的引用 .

    因此,请确保您在构建目录中或该系统的PATH中包含该dll的副本 .

相关问题