Need help using M2Crypto.Engine to access USB Token

前端 未结 6 755
自闭症患者
自闭症患者 2021-01-07 00:09

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.

6条回答
  •  醉酒成梦
    2021-01-07 00:48

    Looking at the pastebin link Becky provided, I believe it translates to something like this in the new API:

    from M2Crypto import Engine, m2
    
    dynamic = Engine.load_dynamic_engine("pkcs11", "/Users/martin/prefix/lib/engines/engine_pkcs11.so")
    
    pkcs11 = Engine.Engine("pkcs11")
    
    pkcs11.ctrl_cmd_string("MODULE_PATH", "/Library/OpenSC/lib/opensc-pkcs11.so")
    
    r = pkcs11.ctrl_cmd_string("PIN", sys.argv[1])
    
    key = pkcs11.load_private_key("id_01")
    

    So I am betting that if you substitute "/Users/martin/prefix/lib/engines/engine_pkcs11.so" with "/usr/local/ssl/lib/engines/engine_pkcs11.so" and "/Library/OpenSC/lib/opensc-pkcs11.so" with "/usr/lib/libeTPkcs11.so" you might get it to work with Aladdin.

提交回复
热议问题