]> www.wagner.pp.ru Git - oss/ctypescrypto.git/blobdiff - ctypescrypto/engine.py
Begin to implement python3 support. Now tests for oid, bio, cipher, digest, mac and...
[oss/ctypescrypto.git] / ctypescrypto / engine.py
index f5bdb7514f007ba6f10e0ae3dadb800a53328e90..1de33d5897e50202db7b4924fcd080448fc756a2 100644 (file)
@@ -2,7 +2,7 @@
 engine loading and configuration
 """
 from ctypes import c_void_p, c_char_p, c_int
-from ctypescrypto import libcrypto
+from ctypescrypto import libcrypto,pyver
 from ctypescrypto.exception import LibCryptoError
 
 __all__ = ['default', 'set_default', 'Engine']
@@ -16,6 +16,8 @@ class Engine(object):
     in the token, accessed by engine
     """
     def __init__(self, engine_id, **kwargs):
+        if pyver > 2 or isinstance(engine_id, unicode):
+            engine_id = engine_id.encode('utf-8')
         eng = libcrypto.ENGINE_by_id(engine_id)
         if eng is None:
             # Try load engine
@@ -69,3 +71,7 @@ libcrypto.ENGINE_set_default.argtypes = (c_void_p, c_int)
 libcrypto.ENGINE_ctrl_cmd_string.argtypes = (c_void_p, c_char_p, c_char_p,
                                              c_int)
 libcrypto.ENGINE_finish.argtypes = (c_char_p, )
+libcrypto.ENGINE_init.argtypes = (c_void_p, )
+libcrypto.UI_OpenSSL.restype = c_void_p
+libcrypto.ENGINE_load_private_key.argtypes = (c_void_p, c_char_p, c_void_p, c_void_p)
+libcrypto.ENGINE_load_private_key.restype = c_void_p