AlkantarClanX12

Your IP : 3.149.24.143


Current Path : /usr/lib/python2.7/site-packages/pip/_vendor/urllib3/util/
Upload File :
Current File : //usr/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.pyc

�
��abc@@sGddlmZddlZddlZddlZddlmZmZddlm	Z	m
Z
mZddlm
Z
mZmZdZeZeZeZie	d6e
d6ed	6Zd
�Zeede�Zy<ddlZddlmZmZmZdd
lmZWnek
rnXy ddlmZm Z m!Z!Wn#ek
red+\ZZ dZ!nXdj"dddddddddddddd d!d"g�Z#ydd#lmZWn3ek
r�ddl$Z$d$e%fd%��YZnXd&�Z&d'�Z'd(�Z(ddddd)�Z)dddddddddd*�	Z*dS(,i(tabsolute_importN(thexlifyt	unhexlify(tmd5tsha1tsha256i(tSSLErrortInsecurePlatformWarningtSNIMissingWarningi i(i@cC@s`tt|�t|��}x7tt|�t|��D]\}}|||AO}q8W|dkS(s�
    Compare two digests of equal length in constant time.

    The digests must be of type str/bytes.
    Returns True if the digests match, and False otherwise.
    i(tabstlentzipt	bytearray(tatbtresulttltr((sA/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.pyt_const_compare_digest_backports(tcompare_digest(twrap_sockett	CERT_NONEtPROTOCOL_SSLv23(tHAS_SNI(tOP_NO_SSLv2tOP_NO_SSLv3tOP_NO_COMPRESSIONiiit:sTLS13-AES-256-GCM-SHA384sTLS13-CHACHA20-POLY1305-SHA256sTLS13-AES-128-GCM-SHA256sECDH+AESGCMs
ECDH+CHACHA20s	DH+AESGCMsDH+CHACHA20sECDH+AES256s	DH+AES256sECDH+AES128sDH+AESs
RSA+AESGCMsRSA+AESs!aNULLs!eNULLs!MD5(t
SSLContextRcB@soeZdejko d	knp1d
ejkZd�Zd�Zddd�Zd�Z	de
d�ZRS(iiicC@sO||_t|_tj|_d|_d|_d|_	d|_
d|_dS(Ni(tprotocoltFalsetcheck_hostnametsslRtverify_modetNonetca_certstoptionstcertfiletkeyfiletciphers(tselftprotocol_version((sA/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.pyt__init__cs						cC@s||_||_dS(N(R%R&(R(R%R&((sA/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.pytload_cert_chainns	cC@s(||_|dk	r$td��ndS(Ns-CA directories not supported in older Pythons(R#R"R(R(tcafiletcapath((sA/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.pytload_verify_locationsrs	cC@s%|jstd��n||_dS(Ns�Your version of Python does not support setting a custom cipher suite. Please upgrade to Python 2.7, 3.2, or later if you need this functionality.(tsupports_set_cipherst	TypeErrorR'(R(tcipher_suite((sA/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.pytset_ciphersxs	cC@stjdt�i|jd6|jd6|jd6|jd6|jd6|d6}|jrnt	|d|j
|�St	||�SdS(	Ns2A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warningsR&R%R#t	cert_reqstssl_versiontserver_sideR'(twarningstwarnRR&R%R#R!RR/RR'(R(tsockettserver_hostnameR5tkwargs((sA/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.pyR�s





	(ii(i(iiN(t__name__t
__module__tsystversion_infoR/R*R+R"R.R2RR(((sA/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.pyR_s				cC@s�|jdd�j�}t|�}tj|�}|sQtdj|���nt|j��}||�j	�}t
||�s�tdj|t|����ndS(s�
    Checks if given fingerprint matches the supplied certificate.

    :param cert:
        Certificate as bytes object.
    :param fingerprint:
        Fingerprint as string of hexdigits, can be interspersed by colons.
    Rts"Fingerprint of invalid length: {0}s6Fingerprints did not match. Expected "{0}", got "{1}".N(treplacetlowerR
tHASHFUNC_MAPtgetRtformatRtencodetdigestt_const_compare_digestR(tcerttfingerprintt
digest_lengththashfunctfingerprint_bytestcert_digest((sA/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.pytassert_fingerprint�s
	cC@s[|dkrtSt|t�rWtt|d�}|dkrSttd|�}n|S|S(s�
    Resolves the argument to a numeric constant, which can be passed to
    the wrap_socket function/method from the ssl module.
    Defaults to :data:`ssl.CERT_NONE`.
    If given a string it is assumed to be the name of the constant in the
    :mod:`ssl` module or its abbrevation.
    (So you can specify `REQUIRED` instead of `CERT_REQUIRED`.
    If it's neither `None` nor a string we assume it is already the numeric
    constant which can directly be passed to wrap_socket.
    tCERT_N(R"Rt
isinstancetstrtgetattrR (t	candidatetres((sA/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.pytresolve_cert_reqs�scC@s[|dkrtSt|t�rWtt|d�}|dkrSttd|�}n|S|S(s 
    like resolve_cert_reqs
    t	PROTOCOL_N(R"RRPRQRRR (RSRT((sA/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.pytresolve_ssl_version�scC@s�t|ptj�}|dkr*tjn|}|dkrcd}|tO}|tO}|tO}n|j|O_t	|dt
�r�|j|p�t�n||_
t	|dd�dk	r�t|_n|S(s�All arguments have the same meaning as ``ssl_wrap_socket``.

    By default, this function does a lot of the same work that
    ``ssl.create_default_context`` does on Python 3.4+. It:

    - Disables SSLv2, SSLv3, and compression
    - Sets a restricted set of server ciphers

    If you wish to enable SSLv3, you can do::

        from urllib3.util import ssl_
        context = ssl_.create_urllib3_context()
        context.options &= ~ssl_.OP_NO_SSLv3

    You can do the same to enable compression (substituting ``COMPRESSION``
    for ``SSLv3`` in the last line above).

    :param ssl_version:
        The desired protocol version to use. This will default to
        PROTOCOL_SSLv23 which will negotiate the highest protocol that both
        the server and your installation of OpenSSL support.
    :param cert_reqs:
        Whether to require the certificate verification. This defaults to
        ``ssl.CERT_REQUIRED``.
    :param options:
        Specific OpenSSL options. These default to ``ssl.OP_NO_SSLv2``,
        ``ssl.OP_NO_SSLv3``, ``ssl.OP_NO_COMPRESSION``.
    :param ciphers:
        Which cipher suites to allow the server to select.
    :returns:
        Constructed SSLContext object with specified options
    :rtype: SSLContext
    iR/RN(RR RR"t
CERT_REQUIREDRRRR$RRtTrueR2tDEFAULT_CIPHERSR!RR(R4R3R$R'tcontext((sA/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.pytcreate_urllib3_context�s#


	c
C@s|}
|
dkr*t||d|�}
n|s6|	r�y|
j||	�Wq�tk
rk}t|��q�tk
r�}|jtjkr�t|��n�q�Xn(|dkr�t|
d�r�|
j	�n|r�|
j
||�ntr�|
j|d|�St
jdt�|
j|�S(s
    All arguments except for server_hostname, ssl_context, and ca_cert_dir have
    the same meaning as they do when using :func:`ssl.wrap_socket`.

    :param server_hostname:
        When SNI is supported, the expected hostname of the certificate
    :param ssl_context:
        A pre-made :class:`SSLContext` object. If none is provided, one will
        be created using :func:`create_urllib3_context`.
    :param ciphers:
        A string of ciphers we wish the client to support. This is not
        supported on Python 2.6 as the ssl module does not support it.
    :param ca_cert_dir:
        A directory containing CA certificates in multiple separate files, as
        supported by OpenSSL's -CApath flag or the capath argument to
        SSLContext.load_verify_locations().
    R'tload_default_certsR9s�An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warningsN(R"R\R.tIOErrorRtOSErrorterrnotENOENTthasattrR]R+RRR6R7R(tsockR&R%R3R#R9R4R'tssl_contexttca_cert_dirR[te((sA/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.pytssl_wrap_sockets.

(ii(+t
__future__RR`R6thmactbinasciiRRthashlibRRRt
exceptionsRRRR"RRRtIS_PYOPENSSLtIS_SECURETRANSPORTRBRRRRGR RRRtImportErrorRRRtjoinRZR=tobjectRNRURWR\Rg(((sA/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.pyt<module>sv
	
		
 


:			>