又是我。我正在与一个YubiHSM2高速加工模块工作,我试图设置它使用pkcs11引擎,这将允许我使用OpenSSL与高速机床。
我正在Windows上实现这一点,这给我带来了很多麻烦。我已经安装了OpenSSL 32,64,OpenSC,YubiHSM2驱动程序以及libp11 (用MSYS2构建)。
我的OpenSSL.cnf中有趣的部分如下:
openssl_conf = openssl_init
[openssl_init]
engines = engine_section
[engine_section]
pkcs11 = pkcs11_section
[pkcs11_section]
engine_id = pkcs11
dynamic_path = "C:\Windows\System32\opensc-pkcs11.dll"
MODULE_path = "C:\Users\myUser\Desktop\SecureTemial\yubihsm2-sdk\bin\yubihsm_pkcs11.dll"
PIN = "0001password"
init = 0当我尝试:
C:\OpenSSL-Win64\bin\openssl.exe req -new -x509 -days 365 -sha256 -config C:\Users\myUser\Desktop\SecureTemial\openssl.cnf -engine pkcs11 -keyform engine -key slot_0-label_my_key -out cert.pem我收到以下消息:
C:\OpenSSL-Win64\bin\openssl.exe : invalid engine "pkcs11"
In Zeile:1 Zeichen:2
+ C:\OpenSSL-Win64\bin\openssl.exe req -new -x509 -days 365 -sha256 -c ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (invalid engine "pkcs11":String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
16056:error:25078067:DSO support routines:win32_load:could not load the shared
library:crypto\dso\dso_win32.c:106:filename(C:\Program Files\OpenSSL\lib\engines-1_1\pkcs11.dll)
16056:error:25070067:DSO support routines:DSO_load:could not load the shared library:crypto\dso\dso_lib.c:161:
16056:error:260B6084:engine routines:dynamic_load:dso not found:crypto\engine\eng_dyn.c:414:
16056:error:2606A074:engine routines:ENGINE_by_id:no such engine:crypto\engine\eng_list.c:339:id=pkcs11
16056:error:25078067:DSO support routines:win32_load:could not load the shared
library:crypto\dso\dso_win32.c:106:filename(pkcs11.dll)
16056:error:25070067:DSO support routines:DSO_load:could not load the shared library:crypto\dso\dso_lib.c:161:
16056:error:260B6084:engine routines:dynamic_load:dso not found:crypto\engine\eng_dyn.c:414:
Error configuring OpenSSL modules
16056:error:25078067:DSO support routines:win32_load:could not load the shared
library:crypto\dso\dso_win32.c:106:filename(C:WindowsSystem32opensc-pkcs11.dll)
16056:error:25070067:DSO support routines:DSO_load:could not load the shared library:crypto\dso\dso_lib.c:161:
16056:error:260B6084:engine routines:dynamic_load:dso not found:crypto\engine\eng_dyn.c:414:
16056:error:260BC066:engine routines:int_engine_configure:engine configuration
error:crypto\engine\eng_cnf.c:141:section=pkcs11_section, name=dynamic_path, value=C:WindowsSystem32opensc-pkcs11.dll
16056:error:0E07606D:configuration file routines:module_run:module initialization
error:crypto\conf\conf_mod.c:173:module=engines, value=engine_section, retcode=-1 我已经检查了dll是否被锁定,并作为管理员运行等等。如果您有任何线索,什么是对这里的麻烦,请告诉我!
非常感谢!
发布于 2018-09-21 09:24:01
这个问题是第一个出现在我的搜索结果中,当我做一些类似的研究时。由于还没有答案,我将概述我的解决方案的结果:
要将libp11的PKCS#11引擎与OpenSSL一起使用,必须将其编译为动态引擎,并与您使用的OpenSSL版本进行静态链接。由于您使用的是灯光制作双星 (根据您在问题中提到的安装目录进行了很好的猜测),使用从第三方资源获得的MSYS2版本可能不起作用,使用OpenSC项目的Windows安装程序附带的PKCS#11库也不起作用。
幸运的是,的OpenSSL版本附带了所有必需的库,因此您可以轻松地自己编译libp11,例如使用NMAKE (按照链接查看如何获得它,以及如何正确设置命令行供其使用):
C:\OpenSSL-Win32或C:\OpenSSL-Win64)。- libp11的makefile期望这些文件夹用于绑定。BUILD_FOR环境变量。跑
设置BUILD_FOR=WIN64
在你的指挥线上。src文件夹中有两个新库:libp11.dll和pkcs11.dll。后者是与您的PKCS#11一起使用的OpenSSL引擎。将其复制到例如Windows文件夹( 32位版本的System32,x64版本的SysWOW64 )。openssl.cnf文件。复制
openssl_conf = openssl_init
到文件的开头,其余的到它的末尾:
openssl_init engines = engine_section engine_section pkcs11 = pkcs11_section pkcs11_section dynamic_path =“C:\Windows\SysWOW64 64\pkcs11.dll”module_path = PIN =“0001密码”一些最后说明:
openssl.cnf文件确实是由OpenSSL获取的。OpenSSL安装附带了几个示例文件。默认情况下,上述二进制文件的配置文件位置为C:\Program Files\Common Files\SSL\openssl.cnf ( x64版本)和C:\Program Files (x86)\Common Files\SSL\openssl.cnf ( x86版本)。但是您系统上的其他OpenSSL安装(例如,来自OpenVPN、MingW、MSYS2,以及与捆绑OpenSSL一起提供的)可能会干扰设置文件的位置。您可以通过相应地设置OPENSSL_CONF环境变量来确保使用正确的设置文件。\\而不是\正确地转义反斜杠。engine_id和init部分的openssl.cnf's [pkcs11_section]。https://stackoverflow.com/questions/49214347
复制相似问题