<#e XddlZddlZddlZddlmZmZmZmZmZddl m Z ee e ejfZe Zej Zej"Zej%dZdede fdZd eedefd Zd eedeegeffd Zd ede fdZd e de fdZeZdZde dedefdZy)N)AnyCallableNoReturnTypeUnion)BindingF)should_clear_after_alloccharpreturncP|sytj|jdS)z Get a native string type representing of the given CFFI ``char*`` object. :param charp: A C-style string represented using CFFI. :return: :class:`str` utf-8)ffistringdecode)r s //usr/lib/python3/dist-packages/OpenSSL/_util.pytextrs$  ::e  # #G ,,exception_typec g} tj}|dk(rni|jttj |ttj |ttj |f||)ac Convert an OpenSSL library failure into a Python exception. When a call to the native OpenSSL library fails, this is usually signalled by the return value, and an error code is stored in an error queue associated with the current thread. The err library provides functions to obtain these error codes and textual error messages. r)lib ERR_get_errorappendrERR_lib_error_stringERR_func_error_stringERR_reason_error_string)rerrorserrors rexception_from_error_queuer"sF !!# A:  S--e45S..u56S0078     rrc$dtddffd }|S)z~ Create an assert function that uses :func:`exception_from_error_queue` to raise an exception wrapped by *error*. okr Nc&|dur tyy)zT If *ok* is not True, retrieve the error from OpenSSL and raise it. TN)r)r!rs ropenssl_assertz#make_assert..openssl_assertBs T> &u - r)bool)rr#s` r make_assertr%<s .4.D. rsctj|}t|tr#|j t j S|S)z Convert a Python path to a :py:class:`bytes` for the path which can be passed into an OpenSSL API accepting a filename. :param s: A path (valid for os.fspath). :return: An instance of :py:class:`bytes`. )osfspath isinstancestrencodesysgetfilesystemencoding)r&bs r path_bytesr0Ls8 ! A!Sxx11344rc$|jdS)Ncharmap)r,)r&s r byte_stringr3]s 88I rz,str for {0} is no longer accepted, use byteslabelobjct|tr@tjtj |t d|jdS|S)a If ``obj`` is text, emit a warning that it should be bytes instead and try to convert it to bytes automatically. :param str label: The name of the parameter from which ``obj`` was taken (so a developer can easily find the source of the problem and correct it). :return: If ``obj`` is the text string type, a ``bytes`` object giving the UTF-8 encoding of that text is returned. Otherwise, ``obj`` itself is returned. )category stacklevelr)r*r+warningswarn _TEXT_WARNINGformatDeprecationWarningr,)r4r5s rtext_to_bytes_and_warnr?hsD#s   '' zz'"" Jr)r(r-r:typingrrrrr,cryptography.hazmat.bindings.openssl.bindingrr+bytesPathLikeStrOrBytesPathbindingrr new_allocatorno_zero_allocatorr Exceptionrr$r%r0r3object UNSPECIFIEDr<r?rrrLs 77@sE2;;./ ) kk kk %%u%E - - -!tI!8!4 tI 8TFCK+@  .U"35 h > #CCr