|
Server : Apache System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64 User : njnconst ( 1116) PHP Version : 8.4.18 Disable Function : NONE Directory : /proc/self/root/usr/lib/python2.7/site-packages/urllib3/contrib/_securetransport/ |
Upload File : |
�
�J�bc @ s< d Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l m
Z
m Z m Z e j
d e j � Z d � Z d � Z d � Z d � Z d
� Z d d � Z d � Z d
� Z d � Z d � Z d � Z d � Z i d d 6d d 6d d 6d d 6d d 6Z d � Z d S( s�
Low-level helpers for the SecureTransport bindings.
These are Python functions that are not directly related to the high-level APIs
but are necessary to get them to work. They include a whole bunch of low-level
CoreFoundation messing about and memory management. The concerns in this module
are almost entirely about trying to avoid memory leaks and providing
appropriate and useful assistance to the higher-level code.
i����Ni ( t CFConstt CoreFoundationt Securitys; -----BEGIN CERTIFICATE-----
(.*?)
-----END CERTIFICATE-----c C s t j t j | t | � � S( sv
Given a bytestring, create a CFData object from it. This CFData object must
be CFReleased by the caller.
( R t CFDataCreatet kCFAllocatorDefaultt len( t
bytestring( ( sM /tmp/pip-install-spIB81/urllib3/urllib3/contrib/_securetransport/low_level.pyt _cf_data_from_bytes s c C sw t | � } d � | D� } d � | D� } t j | | � } t j | | � } t j t j | | | t j t j � S( sK
Given a list of Python tuples, create an associated CFDictionary.
c s s | ] } | d Vq d S( i N( ( t .0t t( ( sM /tmp/pip-install-spIB81/urllib3/urllib3/contrib/_securetransport/low_level.pys <genexpr>, s c s s | ] } | d Vq d S( i N( ( R R ( ( sM /tmp/pip-install-spIB81/urllib3/urllib3/contrib/_securetransport/low_level.pys <genexpr>- s ( R R t CFTypeReft CFDictionaryCreateR t kCFTypeDictionaryKeyCallBackst kCFTypeDictionaryValueCallBacks( t tuplest dictionary_sizet keyst valuest cf_keyst cf_values( ( sM /tmp/pip-install-spIB81/urllib3/urllib3/contrib/_securetransport/low_level.pyt _cf_dictionary_from_tuples% s c C s. t j | � } t j t j | t j � } | S( si
Given a Python binary data, create a CFString.
The string must be CFReleased by the caller.
( t ctypest c_char_pR t CFStringCreateWithCStringR R t kCFStringEncodingUTF8( t py_bstrt c_strt cf_str( ( sM /tmp/pip-install-spIB81/urllib3/urllib3/contrib/_securetransport/low_level.pyt _cfstr; s c C s� d } y� t j t j d t j t j � � } | sB t d � � n xT | D]L } t | � } | sp t d � � n z t j | | � Wd t j
| � XqI WWn? t k
r� } | r� t j
| � n t j
d | f � � n X| S( s�
Given a list of Python binary data, create an associated CFMutableArray.
The array must be CFReleased by the caller.
Raises an ssl.SSLError on failure.
i s Unable to allocate memory!Ns Unable to allocate array: %s( t NoneR t CFArrayCreateMutableR R t byreft kCFTypeArrayCallBackst MemoryErrorR t CFArrayAppendValuet CFReleaset
BaseExceptiont sslt SSLError( t lstt cf_arrt itemR t e( ( sM /tmp/pip-install-spIB81/urllib3/urllib3/contrib/_securetransport/low_level.pyt _create_cfstring_arrayI s(
c C s� t j | t j t j � � } t j | t j � } | d k r� t j d � } t j
| | d t j � } | s~ t d � � n | j } n | d k r� | j
d � } n | S( s�
Creates a Unicode string from a CFString object. Used entirely for error
reporting.
Yes, it annoys me quite a lot that this function is this complex.
i s'