python - Need help using M2Crypto.Engine to access USB Token -


I am using M2Crypto-0.20.2. I want to use xmlrpc calls on SML to create tokens based authentication from the Allen PKI client for the Openc project and engine.

  Import Engine Engine.load_dynamic (from M2Crypto) dynamic = Engine.Engine ( 'Dynamic') # OpenSC project dynamic.ctrl_cmd_string ( "SO_PATH", "/ usr / local / ssl / lib load engine_pkcs from /engines/engine_pkcs11.so ") to Enginekcleanup () load Engine.load_dynamic () # Aladdin or PKI client Aladdin = Injinkinjin (" dynamic ") Aladdin. Sitiarel_ Simdi_string ( "SO_PATH", "/ url / lib / Elaibiteepikesi Ll.aso") key = Aladinklod_praivet_ki ( "PIN", "password")  

It is I get an error:

  key = pkcs.load_private_key ( "PIN", "eT0ken") file "/usr/local/lib/python2.4/ Site-packages / M2Crypto / Engine.py", line 70 , self._engine_load_key in load_private_key return (m2.engine_load_private_key, name, zip) file "/usr/local/lib/python2.4/site-packages/M2Crypto/Engine PE", line 60, Increase EngineError in _engine_load_key (Err.get_error ()) M2Cr Ypto.Engine.EngineError: 23730: Error: 26096075: Engine Daily: ENGINE_load_private_key: Not Initial : Eng_pkey.c: 112:  

load_private_key () for , should be passed as the first argument? The M2Crypto documentation does not explain it.

I have not found any error in loading the engine, but I'm not sure I'm loading them correctly. It seems that the Engine ID should be a unique name, but I have not found this list anywhere 'Dynamic' is working for me

Any help appreciated Will go!

found !!!!

Yes, exactly the way I came.

So, in reality, EGNIMIT () is not implemented in MCCRPT.engineine. So, only one solution: Patching !!! (Very small ...) So I have created a new engine method (in Engine.py)

  def engine_nitge (auto): "" "return engine name" "return" m2 Engine_initz (self._ptr)  

Why engine_initz? Because engine_init is already defined in the SWIG / _engine.i:

  void Injan_init (PyObject * engine_err) {Py_INCREF (engine_err); _engine_ar = engine_ar; }  

I do not really know what has been done, so I have advised to create a new one ... So I just swig / _engine.i: / P> < Previous> % Rename (engine_initz) ENGINE_init; Extension int ingiInt (engine *);

and recompile __m2crypto.so, just add "pkcs11.engine_initz ()" before launching the private key, and it works .....


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -