views:

32

answers:

2

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!

A: 

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?

Becky
A: 

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 either load_dynamic() or load_openssl(). You'd probably need load_dynamic_engine() only when loading 3rd party modules.

Heikki Toivonen
Thank you. load_dynamic() is working for engine_pkcs11 engine.
Becky
Cool! You should then mark this answer as accepted.
Heikki Toivonen