]> 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 79f6218aa0a3beee5558bec9f357d9f1cb47cd5d..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