XylotrechusZ
3
nf�\�D � @ s� d Z ddlmZ ddlZddlmZ ddlmZmZm Z m
Z
mZmZm
Z
mZmZ ddlmZmZmZ ed�Zesxed��ed �Zes�ed
��ej� d Zeeeejd���Zedk r�eded ed f ��eedd�Zeedd�ZeZ eZ!eZ"eZ#eZ$eZ%eZ&eZ'eZ(eZ)e
Z*ee)�Z+eZ,eZ-ee#�Z.ee$�Z/ee%�Z0ee&�Z1ee'�Z2eZ3eZ4eZ5ee�Z6eZ7eZ8ee�Z9eZ:eZ;ee�Z<eZ=eZ>ee�Z?ee�Z@eZAeZBeZCeZDeZEeZF�y�e.e/ee7�ee8�e:ee;�e<ee0�gejG_He-ejG_Ig ejJ_He*ejJ_Ig ejK_He*ejK_Ig ejL_He*ejL_Ie,e.gejM_He6ejM_Ie6gejN_He.ejN_Ie-egejO_He/ejO_Ie+e6ee9�gejP_He-ejP_Ie eee eee<�gejQ_He-ejQ_Ie<gejR_He-ejR_Ie.e2ee0�gejS_He-ejS_Iee-eAeee
��ZTee-eAee�ee
��ZUe?eTeUgejV_He-ejV_Ie?e e
gejW_He-ejW_Ie?e0gejX_He-ejX_Ie?e+e gejY_He-ejY_Ie?eAgejZ_He-ejZ_Ie?e e
gej[_He-ej[_Ie?gej\_He-ej\_Ie?e e
ee
�gej]_He-ej]_Ie?e e
ee
�gej^_He-ej^_Ie?gej__He-ej__Ie?ee
�gej`_He-ej`_Ie?ee>�ee
�geja_He-eja_Ie?ee>�e
gejb_He-ejb_Ie?ee
�gejc_de-ejc_Ie?ee>�ee
�geje_He-eje_Ie?ee>�gejf_He-ejf_Ie?ee=�gejg_He-ejg_Ie?ee@�gejh_He-ejh_Ie@e0geji_He-eji_Ie@e gejj_ke-ejj_Ie@eeB�gejl_He-ejl_Ie@gejm_He!ejm_Ie@e!gejn_He6ejn_Ie,eDeEgejo_He?ejo_Ie?eFe gejp_He-ejp_Ie?e=gejq_He-ejq_Ie?e=gejr_He-ejr_Ie-egejO_He/ejO_IeTe_TeUe_Ue?e_?e=e_=e>e_>e9e_9e<e_<e@e_@eBe_Be7e_7e-e_-e/jsed�e_te/jsed�e_ue+gejv_He+ejv_Ie+gejw_Hdejw_Ie+gejx_He*ejx_Ie,e e"gejy_He/ejy_Ie/e"gejz_He ejz_Ie/e e!e"gej{_Heej{_Ie,e e!gej|_He.ej|_Ie.gej}_He!ej}_Ie.gej~_Heej~_Ie,ee+�ee+�e!e4e5gej_He2ej_Ie2e+gej�_He+ej�_Ie,ee+�e!e3gej�_He0ej�_Ie,e!e3gej�_He1ej�_Ie1egej�_Hdej�_Ie0gej�_He!ej�_Ie0e!gej�_Heej�_Ie,jsed�e_�ejsed�e_�ejsed�e_�ejsed�e_�e+e_+e0e_0e/e_/e2e_2W n e�k
�rt ed��Y nX G dd� de��Z�G dd� de��Z�dS )ay
This module uses ctypes to bind a whole bunch of functions and constants from
SecureTransport. The goal here is to provide the low-level API to
SecureTransport. These are essentially the C-level functions and constants, and
they're pretty gross to work with.
This code is a bastardised version of the code found in Will Bond's oscrypto
library. An enormous debt is owed to him for blazing this trail for us. For
that reason, this code should be considered to be covered both by urllib3's
license and by oscrypto's:
Copyright (c) 2015-2016 Will Bond <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
� )�absolute_importN)�find_library) �c_void_p�c_int32�c_char_p�c_size_t�c_byte�c_uint32�c_ulong�c_long�c_bool)�CDLL�POINTER� CFUNCTYPE�Securityz'The library Security could not be found�CoreFoundationz-The library CoreFoundation could not be found�.�
� z1Only OS X 10.8 and newer are supported, not %s.%s� T)Z use_errno�kSecImportExportPassphrase�kSecImportItemIdentity�kCFAllocatorDefault�kCFTypeArrayCallBacks�kCFTypeDictionaryKeyCallBacks�kCFTypeDictionaryValueCallBackszError initializing ctypesc @ s e Zd ZdZed�ZdS )�CFConstz_
A class object that acts as essentially a namespace for CoreFoundation
constants.
i N)�__name__�
__module__�__qualname__�__doc__�CFStringEncodingZkCFStringEncodingUTF8� r"