X-Git-Url: https://www.wagner.pp.ru/gitweb/?a=blobdiff_plain;f=ctypescrypto%2Fengine.py;h=1de33d5897e50202db7b4924fcd080448fc756a2;hb=305f347018c18fa4183f8ec76177336881b713c9;hp=79f6218aa0a3beee5558bec9f357d9f1cb47cd5d;hpb=952f64afcfc4663797bf6cb36220e9c0e5116c17;p=oss%2Fctypescrypto.git diff --git a/ctypescrypto/engine.py b/ctypescrypto/engine.py index 79f6218..1de33d5 100644 --- a/ctypescrypto/engine.py +++ b/ctypescrypto/engine.py @@ -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