我正在尝试使用 Python 连接到 Eracom HSM [大约 15 年前!]。我的 Google 搜索将我带到了一个名为py-hsm的库。根据文档,它似乎有一个非常简单的用法。但是当我尝试使用它时,我遇到了以下错误:
1 C:\> python
2 Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 bit (Intel)] on win32
3
4 >>> from pyhsm.hsmclient import HsmClient
5 >>> c = HsmClient(pkcs11_lib="C:\Eracom\ProtectToolkit C SDK\bin\sw\cryptoki.dll")
6 Traceback (most recent call last):
7 File "<stdin>", line 1, in <module>
8 File "C:\Python\Python38-32\lib\site-packages\pyhsm\hsmclient.py", line 138, in __init__
9 self.__init_libhsm()
10 File "C:\Python\Python38-32\lib\site-packages\pyhsm\hsmclient.py", line 157, in __init_libhsm
11 self.__libhsm = CDLL(self.__pyLibHsmName)
12 File "C:\Python\Python38-32\lib\ctypes\__init__.py", line 373, in __init__
13 self._handle = _dlopen(self._name, mode)
14 FileNotFoundError: Could not find module 'libhsm.dll' (or one of its dependencies). Try using the full path with constructor syntax.
15 >>>
我对提到的 DLL ( libhsm.dll ) 进行了整个系统搜索,但我什么也没找到。
问题1:
- 有没有更好的包/库来实现这个目标?
- 我该如何解决这个问题?