静态地与openssl lib链接

cag*_*agi 12 windows openssl cryptoapi visual-c++

我 现在按照本指南手动构建openssl(静态库)当我尝试将我的MFC测试应用程序与libeay32.lib链接时出现以下错误:

1>Linking...
1>libeay32.lib(e_capi.obj) : error LNK2019: unresolved external symbol __imp__CertFreeCertificateContext@4 referenced in function _capi_free_key
1>libeay32.lib(e_capi.obj) : error LNK2019: unresolved external symbol __imp__CertGetCertificateContextProperty@16 referenced in function _capi_get_prov_info
1>libeay32.lib(e_capi.obj) : error LNK2019: unresolved external symbol __imp__CertOpenStore@20 referenced in function _capi_open_store
1>libeay32.lib(e_capi.obj) : error LNK2019: unresolved external symbol __imp__CertFindCertificateInStore@24 referenced in function _capi_find_cert
1>libeay32.lib(e_capi.obj) : error LNK2019: unresolved external symbol __imp__CertEnumCertificatesInStore@8 referenced in function _capi_find_cert
1>libeay32.lib(e_capi.obj) : error LNK2019: unresolved external symbol __imp__CertCloseStore@8 referenced in function _capi_find_key
1>libeay32.lib(e_capi.obj) : error LNK2019: unresolved external symbol __imp__CertDuplicateCertificateContext@4 referenced in function _capi_load_ssl_client_cert
Run Code Online (Sandbox Code Playgroud)

有什么建议?提前致谢.

编辑:我已经使用OpenSSL 1.0.1t源代码和Visual Studio 2008命令提示符来构建32位静态库(我没有成功使用1.0.2h版本).我的测试应用程序在动态链接时工作正常,但我希望能够与静态库链接.我正在使用OpenSSL进行EVP对称加密和解密

jww*_*jww 26

当我尝试将我的MFC测试应用程序与libeay32.lib链接时,我收到以下错误...

你需要配置enable-capieng.另请参阅OpenSSL wiki上的编译和安装以及如何在OpenSSL邮件列表存档中使用CAPI引擎.

error LNK2019: unresolved external symbol __imp__CertFreeCertificateContext@4 referenced in function _capi_free_key 
...
Run Code Online (Sandbox Code Playgroud)

正确配置后,您需要链接Windows的crypt32.lib库.例如,参见CertFreeCertificateContext函数.在Windows上,将以下内容添加到MSVC源文件中应该足够了:

#pragma comment (lib, "crypt32");
Run Code Online (Sandbox Code Playgroud)