Hacked By AnonymousFox

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

�
�Rec@@s�ddlmZddlZddlZddlZddlZddlmZmZddl	m
Z
mZmZddl
mZmZddlmZmZmZdd	lmZdZeZeZeZie
d
6ed6ed6Zd
�Zeede�Zy6ddl Z ddl m!Z!m"Z"ddl mZWne#k
rKnXyddl m$Z$e$Z%WnIe#k
r�yddl m%Z$e$Z%Wq�e#k
r�dZ%Z$q�XnXy ddl m&Z&m'Z'm(Z(Wn#e#k
r�d0\Z&Z'dZ(nXdj)ddddddddd d!d"d#d$d%g�Z*ydd&l mZWn'e#k
rnd'e+fd(��YZnXd)�Z,d*�Z-d+�Z.ddddd,�Z/dddddddddddd-�Z0d.�Z1d/�Z2dS(1i(tabsolute_importN(thexlifyt	unhexlify(tmd5tsha1tsha256i(tIPV4_REtBRACELESS_IPV6_ADDRZ_REi(tSSLErrortInsecurePlatformWarningtSNIMissingWarning(tsixi 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((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.pyt_const_compare_digest_backports(tcompare_digest(twrap_sockett
CERT_REQUIRED(tHAS_SNI(tPROTOCOL_TLS(tPROTOCOL_SSLv23(tOP_NO_SSLv2tOP_NO_SSLv3tOP_NO_COMPRESSIONiiit:sECDHE+AESGCMsECDHE+CHACHA20s
DHE+AESGCMsDHE+CHACHA20sECDH+AESGCMs	DH+AESGCMsECDH+AESsDH+AESs
RSA+AESGCMsRSA+AESs!aNULLs!eNULLs!MD5s!DSS(t
SSLContextR cB@sDeZd�Zd�Zdddd�Zd�Zded�ZRS(cC@sO||_t|_tj|_d|_d|_d|_	d|_
d|_dS(Ni(tprotocoltFalsetcheck_hostnametsslt	CERT_NONEtverify_modetNonetca_certstoptionstcertfiletkeyfiletciphers(tselftprotocol_version((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.pyt__init__ks						cC@s||_||_dS(N(R*R+(R-R*R+((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.pytload_cert_chainvs	cC@sC||_|dk	r$td��n|dk	r?td��ndS(Ns-CA directories not supported in older Pythonss&CA data not supported in older Pythons(R(R'R(R-tcafiletcapathtcadata((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.pytload_verify_locationszs
	cC@s
||_dS(N(R,(R-tcipher_suite((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.pytset_ciphers�scC@setjdt�i|jd6|jd6|jd6|jd6|jd6|d6}t|d|j	|�S(	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,(
twarningstwarnR	R+R*R(R&R!RR,(R-tsockettserver_hostnameR9tkwargs((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.pyR�s





N(	t__name__t
__module__R/R0R'R4R6R"R(((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.pyR js
				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((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/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_REQUIRED`.
    If given a string it is assumed to be the name of the constant in the
    :mod:`ssl` module or its abbreviation.
    (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((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/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'RRRRSRTR$(RURV((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.pytresolve_ssl_version�scC@s�t|pt�}|j|p!t�|dkr:tjn|}|dkrsd}|tO}|tO}|t	O}n|j
|O_
|tjks�tjdkr�t
|dd�dk	r�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 pip._vendor.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
    iiiitpost_handshake_authR#N(iii(R RR6tDEFAULT_CIPHERSR'R$RRRRR)tsystversion_infoRTtTrueRZR&R"R#(R8R7R)R,tcontext((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.pytcreate_urllib3_context�s"$


!		cC@s�|}|dkr*t||d|�}n|s<|	s<|r�y|j||	|�Wq�tk
rt}
t|
��q�tk
r�}
|
jtjkr�t|
��n�q�Xn(|dkr�t|d�r�|j	�n|r|
dkrt
|�rtd��n|r>|
dkr(|j||�q>|j|||
�n|dk	rWt|�s]t
r�tr�|dk	r�|j|d|�Stjdt�n|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.
    :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().
    :param key_password:
        Optional password if the keyfile is encrypted.
    :param ca_cert_data:
        Optional string containing CA certificates in PEM format suitable for
        passing as the cadata parameter to SSLContext.load_verify_locations()
    R,tload_default_certss5Client private key is encrypted, password is requiredR=s�An HTTPS request has been made, but the SNI (Server 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`R4tIOErrorRtOSErrorterrnotENOENTthasattrRat_is_key_file_encryptedR0tis_ipaddresstIS_SECURETRANSPORTRRR:R;R
(tsockR+R*R7R(R=R8R,tssl_contexttca_cert_dirtkey_passwordtca_cert_dataR_te((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.pytssl_wrap_socket+s8#


cC@sMtjr+t|t�r+|jd�}nttj|�pItj|��S(s�Detects whether the hostname given is an IPv4 or IPv6 address.
    Also detects IPv6 addresses with Zone IDs.

    :param str hostname: Hostname to examine.
    :return: True if the hostname is an IP address, False otherwise.
    tascii(	RtPY2RRtbytestdecodetboolRtmatchR(thostname((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.pyRh�scC@s=t|d��(}x|D]}d|krtSqWWdQXtS(s*Detects if a key file is encrypted or not.Rt	ENCRYPTEDN(topenR^R"(tkey_filetftline((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.pyRg�s

(ii(3t
__future__RRdR:thmacR\tbinasciiRRthashlibRRRturlRRt
exceptionsRR	R
tpackagesRR'R R"RtIS_PYOPENSSLRiRDRRTRIR$RRtImportErrorRRRRRtjoinR[tobjectRPRWRYR`RpRhRg(((s�/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.pyt<module>s�	





 


1			MR	

Hacked By AnonymousFox1.0, Coded By AnonymousFox