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gejo_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/ sed¡e_te/ sed¡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, sed¡e_†e sed¡e_‡e sed¡e_ˆe sed¡e_‰e+e_+e0e_0e/e_/e2e_2W n eŠ�y·   edƒ‚w 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 <will@wbond.net>

    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)Ú	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__ÚCFStringEncodingÚkCFStringEncodingUTF8© r$   r$   úf/var/www/html/myproject/venv/lib/python3.10/site-packages/urllib3/contrib/_securetransport/bindings.pyr   �  s    r   c                   @   s(  e Zd ZdZdZdZdZdZdZdZ	dZ
d	ZdZdZdZdZdZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(d Z)d!Z*d"Z+d#Z,d$Z-d%Z.d&Z/d'Z0d(Z1d)Z2d*Z3d+Z4d,Z5d-Z6d.Z7d/Z8d0Z9d1Z:d2Z;d3Z<d4Z=d5Z>d6Z?d7Z@d8ZAd9ZBd:ZCd;ZDd<ZEd=ZFd>ZGd?ZHd@ZIdAS )BÚSecurityConstzU
    A class object that acts as essentially a namespace for Security constants.
    r   r   é   é   é   r   r   iç  é   é   é   i¸ÙÿÿiµÙÿÿi³Ùÿÿi¨Ùÿÿi²Ùÿÿi±Ùÿÿi¯Ùÿÿi®ÙÿÿiªÙÿÿi©Ùÿÿi¬Ùÿÿi«Ùÿÿi�Ùÿÿi Ùÿÿi‘Ùÿÿi†Ùÿÿi�Ùÿÿi‰Ùÿÿi ÷þÿiQ�ÿÿi,�ÿÿiR�ÿÿi,À  i0À  i+À  i/À  i©Ì  i¨Ì  éŸ   éž   i$À  i(À  i
À  iÀ  ék   é9   i#À  i'À  i	À  iÀ  ég   é3   é�   éœ   é=   é<   é5   é/   i  i  i  i  N)Jr   r   r    r!   Ú"kSSLSessionOptionBreakOnServerAuthÚkSSLProtocol2ÚkSSLProtocol3ÚkTLSProtocol1ÚkTLSProtocol11ÚkTLSProtocol12ÚkTLSProtocol13ÚkTLSProtocolMaxSupportedÚkSSLClientSideÚkSSLStreamTypeÚkSecFormatPEMSequenceÚkSecTrustResultInvalidÚkSecTrustResultProceedÚkSecTrustResultDenyÚkSecTrustResultUnspecifiedÚ&kSecTrustResultRecoverableTrustFailureÚ kSecTrustResultFatalTrustFailureÚkSecTrustResultOtherErrorÚerrSSLProtocolÚerrSSLWouldBlockÚerrSSLClosedGracefulÚerrSSLClosedNoNotifyÚerrSSLClosedAbortÚerrSSLXCertChainInvalidÚerrSSLCryptoÚerrSSLInternalÚerrSSLCertExpiredÚerrSSLCertNotYetValidÚerrSSLUnknownRootCertÚerrSSLNoRootCertÚerrSSLHostNameMismatchÚerrSSLPeerHandshakeFailÚerrSSLPeerUserCancelledÚerrSSLWeakPeerEphemeralDHKeyÚerrSSLServerAuthCompletedÚerrSSLRecordOverflowÚerrSecVerifyFailedÚerrSecNoTrustSettingsÚerrSecItemNotFoundÚerrSecInvalidTrustSettingsÚ'TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384Ú%TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384Ú'TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256Ú%TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256Ú-TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256Ú+TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256Ú#TLS_DHE_RSA_WITH_AES_256_GCM_SHA384Ú#TLS_DHE_RSA_WITH_AES_128_GCM_SHA256Ú'TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384Ú%TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384Ú$TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHAÚ"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHAÚ#TLS_DHE_RSA_WITH_AES_256_CBC_SHA256Ú TLS_DHE_RSA_WITH_AES_256_CBC_SHAÚ'TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256Ú%TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256Ú$TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHAÚ"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHAÚ#TLS_DHE_RSA_WITH_AES_128_CBC_SHA256Ú TLS_DHE_RSA_WITH_AES_128_CBC_SHAÚTLS_RSA_WITH_AES_256_GCM_SHA384ÚTLS_RSA_WITH_AES_128_GCM_SHA256ÚTLS_RSA_WITH_AES_256_CBC_SHA256ÚTLS_RSA_WITH_AES_128_CBC_SHA256ÚTLS_RSA_WITH_AES_256_CBC_SHAÚTLS_RSA_WITH_AES_128_CBC_SHAÚTLS_AES_128_GCM_SHA256ÚTLS_AES_256_GCM_SHA384ÚTLS_AES_128_CCM_8_SHA256ÚTLS_AES_128_CCM_SHA256r$   r$   r$   r%   r&   –  s�    r&   )Žr!   Ú
__future__r   ÚplatformÚctypes.utilr   Úctypesr   r   r   r   r   r	   r
   r   r   r   r   r   Úsecurity_pathÚImportErrorÚcore_foundation_pathÚmac_verÚversionÚtupleÚmapÚintÚsplitÚversion_infoÚOSErrorr   r   ÚBooleanÚCFIndexr"   ÚCFDataÚCFStringÚCFArrayÚCFMutableArrayÚCFDictionaryÚCFErrorÚCFTypeÚCFTypeIDÚ	CFTypeRefÚCFAllocatorRefÚOSStatusÚ	CFDataRefÚCFStringRefÚ
CFArrayRefÚCFMutableArrayRefÚCFDictionaryRefÚCFArrayCallBacksÚCFDictionaryKeyCallBacksÚCFDictionaryValueCallBacksÚSecCertificateRefÚSecExternalFormatÚSecExternalItemTypeÚSecIdentityRefÚSecItemImportExportFlagsÚ SecItemImportExportKeyParametersÚSecKeychainRefÚSSLProtocolÚSSLCipherSuiteÚSSLContextRefÚSecTrustRefÚSSLConnectionRefÚSecTrustResultTypeÚSecTrustOptionFlagsÚSSLProtocolSideÚSSLConnectionTypeÚSSLSessionOptionÚSecItemImportÚargtypesÚrestypeÚSecCertificateGetTypeIDÚSecIdentityGetTypeIDÚSecKeyGetTypeIDÚSecCertificateCreateWithDataÚSecCertificateCopyDataÚSecCopyErrorMessageStringÚ SecIdentityCreateWithCertificateÚSecKeychainCreateÚSecKeychainDeleteÚSecPKCS12ImportÚSSLReadFuncÚSSLWriteFuncÚSSLSetIOFuncsÚSSLSetPeerIDÚSSLSetCertificateÚSSLSetCertificateAuthoritiesÚSSLSetConnectionÚSSLSetPeerDomainNameÚSSLHandshakeÚSSLReadÚSSLWriteÚSSLCloseÚSSLGetNumberSupportedCiphersÚSSLGetSupportedCiphersÚSSLSetEnabledCiphersÚSSLGetNumberEnabledCiphersÚargtypeÚSSLGetEnabledCiphersÚSSLGetNegotiatedCipherÚSSLGetNegotiatedProtocolVersionÚSSLCopyPeerTrustÚSecTrustSetAnchorCertificatesÚ!SecTrustSetAnchorCertificatesOnlyÚ	argstypesÚSecTrustEvaluateÚSecTrustGetCertificateCountÚSecTrustGetCertificateAtIndexÚSSLCreateContextÚSSLSetSessionOptionÚSSLSetProtocolVersionMinÚSSLSetProtocolVersionMaxÚin_dllr   r   ÚCFRetainÚ	CFReleaseÚCFGetTypeIDÚCFStringCreateWithCStringÚCFStringGetCStringPtrÚCFStringGetCStringÚCFDataCreateÚCFDataGetLengthÚCFDataGetBytePtrÚCFDictionaryCreateÚCFDictionaryGetValueÚCFArrayCreateÚCFArrayCreateMutableÚCFArrayAppendValueÚCFArrayGetCountÚCFArrayGetValueAtIndexr   r   r   r   ÚAttributeErrorÚobjectr   r&   r$   r$   r$   r%   Ú<module>   s   ,ÿÿø

ýú
ýÿ

ýýýþ
ýÿÿ


ýü

úüý
ÿÿÿÿ
ÿ	