3 ”Re»8ã1@s(ddlmZddlZddlZddlZddlZddlmZmZddl m Z m Z m Z ddl mZmZddlmZmZmZdd lmZdZd Zd Zd Ze e e d œZd d „ZeedeƒZy(ddlZddlmZm Z ddlmZWne!k rìYnXyddlm"Z"e"Z#WnJe!k �rLyddlm#Z"e"Z#Wne!k �rFdZ#Z"YnXYnXyddlm$Z$m%Z%m&Z&Wn"e!k �rˆd7\Z$Z%dZ&YnXdj'ddddddddd d!d"d#d$d%gƒZ(ydd&lmZWn&e!k �ræGd'd(„d(e)ƒZYnXd)d*„Z*d+d,„Z+d-d.„Z,d8d/d0„Z-d9d1d2„Z.d3d4„Z/d5d6„Z0dS):é)Úabsolute_importN)ÚhexlifyÚ unhexlify)Úmd5Úsha1Úsha256é)ÚIPV4_REÚBRACELESS_IPV6_ADDRZ_REé)ÚSSLErrorÚInsecurePlatformWarningÚSNIMissingWarning)ÚsixF)é é(é@cCsHtt|ƒt|ƒƒ}x*tt|ƒt|ƒƒD]\}}|||AO}q(W|dkS)z§ 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. r)ÚabsÚlenÚzipÚ bytearray)ÚaÚbÚresultÚlÚr©rúŒ/builddir/build/BUILDROOT/alt-python36-pip-20.2.4-5.el8.x86_64/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/urllib3/util/ssl_.pyÚ_const_compare_digest_backportsrÚcompare_digest)Ú wrap_socketÚ CERT_REQUIRED)ÚHAS_SNI)Ú PROTOCOL_TLS)ÚPROTOCOL_SSLv23)Ú OP_NO_SSLv2Ú OP_NO_SSLv3ÚOP_NO_COMPRESSIONééiú:z ECDHE+AESGCMzECDHE+CHACHA20z DHE+AESGCMz DHE+CHACHA20z ECDH+AESGCMz DH+AESGCMzECDH+AESzDH+AESz RSA+AESGCMzRSA+AESz!aNULLz!eNULLz!MD5z!DSS)Ú SSLContextc@s8eZdZdd„Zdd„Zd dd„Zdd „Zdd d „ZdS)r+cCs6||_d|_tj|_d|_d|_d|_d|_d|_ dS)NFr) ÚprotocolÚcheck_hostnameÚsslÚ CERT_NONEÚ verify_modeÚca_certsÚoptionsÚcertfileÚkeyfileÚciphers)ÚselfZprotocol_versionrrrÚ__init__kszSSLContext.__init__cCs||_||_dS)N)r3r4)r6r3r4rrrÚload_cert_chainvszSSLContext.load_cert_chainNcCs*||_|dk rtdƒ‚|dk r&tdƒ‚dS)Nz-CA directories not supported in older Pythonsz&CA data not supported in older Pythons)r1r )r6ÚcafileÚcapathÚcadatarrrÚload_verify_locationszs z SSLContext.load_verify_locationscCs ||_dS)N)r5)r6Z cipher_suiterrrÚ set_ciphersƒszSSLContext.set_ciphersFcCs>tjdtƒ|j|j|j|j|j|dœ}t|fd|j i|—ŽS)Na2A 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-warnings)r4r3r1Ú cert_reqsÚ ssl_versionÚ server_sider5) ÚwarningsÚwarnr r4r3r1r0r,r r5)r6ÚsocketÚserver_hostnamer@Úkwargsrrrr †szSSLContext.wrap_socket)NNN)NF)Ú__name__Ú __module__Ú __qualname__r7r8r<r=r rrrrr+js   r+cCsn|jddƒjƒ}t|ƒ}tj|ƒ}|s4tdj|ƒƒ‚t|jƒƒ}||ƒj ƒ}t ||ƒsjtdj|t |ƒƒƒ‚dS)zá 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. r*Úz"Fingerprint of invalid length: {0}z6Fingerprints did not match. Expected "{0}", got "{1}".N) ÚreplaceÚlowerrÚ HASHFUNC_MAPÚgetr ÚformatrÚencodeÚdigestÚ_const_compare_digestr)ÚcertÚ fingerprintÚ digest_lengthÚhashfuncÚfingerprint_bytesÚ cert_digestrrrÚassert_fingerprint›s     rXcCs@|dkr tSt|tƒrr2r5ÚcontextrrrÚcreate_urllib3_contextßs"$ rjc CsJ|} | dkrt|||d�} |s&| s&| rœy| j|| | ƒWq¶tk rb} zt| ƒ‚WYdd} ~ Xq¶tk r˜} z| jtjkr†t| ƒ‚‚WYdd} ~ Xq¶Xn|dkr¶t| dƒr¶| jƒ|rÒ| dkrÒt |ƒrÒtdƒ‚|rú| dkrì| j ||ƒn| j ||| ƒ|dk �rt |ƒ �st �r@t �r4|dk �r4| j||d�Stjdtƒ| j|ƒS)aÈ 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() N)r5Úload_default_certsz5Client private key is encrypted, password is required)rDa€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-warnings)rjr<ÚIOErrorr ÚOSErrorÚerrnoÚENOENTÚhasattrrkÚ_is_key_file_encryptedr8Ú is_ipaddressÚIS_SECURETRANSPORTr"r rArBr)Úsockr4r3r>r1rDr?r5Ú ssl_contextÚ ca_cert_dirÚ key_passwordÚ ca_cert_datariÚerrrÚssl_wrap_socket+s8#  rzcCs4tj rt|tƒr|jdƒ}ttj|ƒp0tj|ƒƒS)zæ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. Úascii) rÚPY2rZÚbytesÚdecodeÚboolr Úmatchr )Úhostnamerrrrr‰s rrc Cs4t|dƒ� }x|D]}d|krdSqWWdQRXdS)z*Detects if a key file is encrypted or not.rÚ ENCRYPTEDTNF)Úopen)Úkey_fileÚfÚlinerrrrq–s   rq)r(r))NNNN) NNNNNNNNNNN)1Ú __future__rrnrAÚhmacrgÚbinasciirrÚhashlibrrrÚurlr r Ú exceptionsr r rÚpackagesrr+r"Ú IS_PYOPENSSLrsrLrr\rQr.r r!Ú ImportErrorr#r$r%r&r'ÚjoinrfÚobjectrXr_rarjrzrrrqrrrrÚs�       1 M R