M2Crypto:load_dynamic_engine() 的属性错误
我正在使用 M2Crypto-0.20.2。我想使用 OpenSC 项目中的 engine_pkcs11 和 Aladdin PKI 客户端进行基于令牌的身份验证,通过 ssl 进行 xmlrpc 调用。
我正在尝试加载 PKCS#11 引擎以及 Aladdin 模块(请参阅下面的代码)。但我收到一个错误: AttributeError: 'module' object has no attribute 'load_dynamic_engine'
from M2Crypto import SSL, m2
m2.load_dynamic_engine("dynamic","/usr/local/ssl/lib/engines/engine_pkcs11.so")
m2.load_dynamic_engine("pkcs11","/usr/lib/libeTPkcs11.so")
根据 M2Crypto 文档,此函数应该可用。这是我正在阅读的文档: http://www.heikkitoivonen.net/m2crypto/api/
任何人都可以向我指出正确的文档或帮助我弄清楚如何加载引擎吗?
谢谢!
I am using M2Crypto-0.20.2. I want to use engine_pkcs11 from the OpenSC project and the Aladdin PKI client for token based authentication making xmlrpc calls over ssl.
I am trying to load the PKCS#11 engine as well as the Aladdin module (see code below). But I get an error:
AttributeError: 'module' object has no attribute 'load_dynamic_engine'
from M2Crypto import SSL, m2
m2.load_dynamic_engine("dynamic","/usr/local/ssl/lib/engines/engine_pkcs11.so")
m2.load_dynamic_engine("pkcs11","/usr/lib/libeTPkcs11.so")
According to the M2Crypto documentation, this function should be available. This is the documentation I'm reading: http://www.heikkitoivonen.net/m2crypto/api/
Can anyone point me to the correct documentation or help with figuring out how to load the engines?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我自己没有使用过Engine模块,所以无法给你任何明确的答案。但是,您应该查看 test_engine.py 模块以了解一些信息指针。我猜测要加载 OpenSSL 提供的引擎,您不应该使用
load_dynamic_engine()
的形式,而应该使用load_dynamic()
或load_openssl().您可能仅在加载第 3 方模块时才需要
load_dynamic_engine()
。I haven't used the Engine module myself, so I cannot give you any definite answers. However, you should take a look at test_engine.py module for some pointers. I am guessing that to load engines provided by OpenSSL you shouldn't use that form of
load_dynamic_engine()
, but eitherload_dynamic()
orload_openssl()
. You'd probably needload_dynamic_engine()
only when loading 3rd party modules.我读错了文档。 load_dynamic_engine() 属于 Engine 模块。
我更改了命令,现在出现了不同的错误:
Engine.load_dynamic_engine("dynamic","/usr/local/ssl/lib/engines/engine_pkcs11.so")
错误的引擎 ID
Engine.load_dynamic_engine("动态","/usr/local/ssl/lib/engines/engine_pkcs11.so")
文件“/usr/local/lib/python2.4/site-packages/M2Crypto/Engine.py”,第 92 行,位于 load_dynamic_engine
e.ctrl_cmd_string("LOAD", 无)
文件“/usr/local/lib/python2.4/site-packages/M2Crypto/Engine.py”,第 38 行,在 ctrl_cmd_string 中
引发 EngineError(Err.get_error())
M2Crypto.Engine.EngineError:23541:错误:260B606D:引擎例程:DYNAMIC_LOAD:初始化失败:eng_dyn.c:521:
知道这意味着什么吗?
I was reading the documentation wrong. The load_dynamic_engine() belong in the Engine module.
I changed the command and now get a different error:
Engine.load_dynamic_engine("dynamic","/usr/local/ssl/lib/engines/engine_pkcs11.so")
bad engine id
Engine.load_dynamic_engine("dynamic","/usr/local/ssl/lib/engines/engine_pkcs11.so")
File "/usr/local/lib/python2.4/site-packages/M2Crypto/Engine.py", line 92, in load_dynamic_engine
e.ctrl_cmd_string("LOAD", None)
File "/usr/local/lib/python2.4/site-packages/M2Crypto/Engine.py", line 38, in ctrl_cmd_string
raise EngineError(Err.get_error())
M2Crypto.Engine.EngineError: 23541:error:260B606D:engine routines:DYNAMIC_LOAD:init failed:eng_dyn.c:521:
Any idea what this means?