HEX
Server: LiteSpeed
System: Linux s787.bom1.mysecurecloudhost.com 4.18.0-477.13.1.lve.el8.x86_64 #1 SMP Thu Jun 1 16:40:47 EDT 2023 x86_64
User: mobilech (5348)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/urllib3/util/__pycache__/ssl_.cpython-310.pyc
o

;jNE�	@s�UddlmZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZm
Z
ddlmZmZdZdZdZdZd	gZeeeeeefZd
d�dD�Zd]dd�ZejrxddlmZddlmZddl mZ!Gdd�dedd�Z"iZ#de$d<zQddlZddlm%Z%mZm&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.mZm/Z/e)Z0er�ee(�s�dZdD]Z1ze2e/e1�e#e2ede1���<Wq�e3y�Yq�wddl mZWne4y�dZ&dZ'd Z-d!Z.dZ0Z)d"Z*d#Z+d$Z,Ynwej5de6dfZ7d^d)d*�Z8d_d.d/�Z9d`d1d2�Z:							dadbd=d>�Z;ej<	?	?	?	?	?	?	?	?	?	?	?	?dcdddOdP��Z=ej<	?	?	?	?	?	?	?	?	?	?	?	?dcdedRdP��Z=												dfdedSdP�Z=dgdVdW�Z>dhdYdZ�Z?	didjd[d\�Z@dS)k�)�annotationsN)�	unhexlify�)�ProxySchemeUnsupported�SSLError�)�_BRACELESS_IPV6_ADDRZ_RE�_IPV4_REFzhttp/1.1cCsi|]\}}|tt|d��qS�N)�getattr�hashlib)�.0�length�	algorithm�r�E/opt/saltstack/salt/lib/python3.10/site-packages/urllib3/util/ssl_.py�
<dictcomp>s��r))� �md5)�(�sha1)�@�sha256�openssl_version�str�return�boolcCs|�d�}|S)NzOpenSSL )�
startswith)rZ
is_opensslrrr�(_is_has_never_check_common_name_reliables
r)�
VerifyMode)�	TypedDict)�SSLTransportc@s&eZdZUded<ded<ded<dS)�_TYPE_PEER_CERT_RET_DICTztuple[tuple[str, str], ...]�subjectAltNamez'tuple[tuple[tuple[str, str], ...], ...]�subjectrZserialNumberN)�__name__�
__module__�__qualname__�__annotations__rrrrr".s
r")�totalzdict[int, int]�_SSL_VERSION_TO_TLS_VERSION)
�
CERT_REQUIRED�HAS_NEVER_CHECK_COMMON_NAME�OP_NO_COMPRESSION�OP_NO_TICKET�OPENSSL_VERSION�PROTOCOL_TLS�PROTOCOL_TLS_CLIENT�VERIFY_X509_PARTIAL_CHAIN�VERIFY_X509_STRICT�OP_NO_SSLv2�OP_NO_SSLv3�
SSLContext�
TLSVersion)�TLSv1�TLSv1_1�TLSv1_2�	PROTOCOL_ii@ii�ir�cert�bytes | None�fingerprint�NonecCs�|durtd��|�dd���}t|�}|tvrtd|����t�|�}|dur/td|����t|���}||���}t	�
||�sNtd|�d|���d	���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.
    NzNo certificate for the peer.�:�zFingerprint of invalid length: zAHash function implementation unavailable for fingerprint length: z&Fingerprints did not match. Expected "z", got "�")r�replace�lower�len�HASHFUNC_MAP�getr�encode�digest�hmac�compare_digest�hex)r=r?Z
digest_lengthZhashfuncZfingerprint_bytesZcert_digestrrr�assert_fingerprintks$

���rN�	candidate�None | int | strrcCs@|durtSt|t�rtt|d�}|durttd|�}|S|S)a�
    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.
    NZCERT_)r+�
isinstancerr�ssl�rO�resrrr�resolve_cert_reqs�s
rU�intcCsH|durtSt|t�r"tt|d�}|durttd|�}t�t|�S|S)z 
    like resolve_cert_reqs
    Nr;)r0rQrrrR�typing�castrVrSrrr�resolve_ssl_version�s
rY�ssl_version�
int | None�	cert_reqs�options�ciphers�
str | None�ssl_minimum_version�ssl_maximum_version�verify_flags�ssl.SSLContextc	Cs�tdurtd��|dttfvr1|dus|durtd��t�|tj�}t�|tj	�}t
jdtdd�tt�}|dur=||_
ntj|_
|durH||_|rO|�|�|durVtjn|}|durnd}|tO}|tO}|tO}|tO}|j|O_|dur�d}tjdkr�|tO}|tO}|j|O_t|d	d�dur�d
|_|tjkr�ts�||_ d
|_!nd|_!||_ d|_"dt#j$vr�t#j%�&t#j$�d��}nd}|r�||_'|S)
a#Creates and configures an :class:`ssl.SSLContext` instance for use with urllib3.

    :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.

        This parameter is deprecated instead use 'ssl_minimum_version'.
    :param ssl_minimum_version:
        The minimum version of TLS to be used. Use the 'ssl.TLSVersion' enum for specifying the value.
    :param ssl_maximum_version:
        The maximum version of TLS to be used. Use the 'ssl.TLSVersion' enum for specifying the value.
        Not recommended to set to anything other than 'ssl.TLSVersion.MAXIMUM_SUPPORTED' which is the
        default value.
    :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``, and ``ssl.OP_NO_TICKET``.
    :param ciphers:
        Which cipher suites to allow the server to select. Defaults to either system configured
        ciphers if OpenSSL 1.1.1+, otherwise uses a secure default set of ciphers.
    :param verify_flags:
        The flags for certificate verification operations. These default to
        ``ssl.VERIFY_X509_PARTIAL_CHAIN`` and ``ssl.VERIFY_X509_STRICT`` for Python 3.13+.
    :returns:
        Constructed SSLContext object with specified options
    :rtype: SSLContext
    Nz7Can't create an SSLContext object without an ssl modulezZCan't specify both 'ssl_version' and either 'ssl_minimum_version' or 'ssl_maximum_version'zi'ssl_version' option is deprecated and will be removed in urllib3 v3.0. Instead use 'ssl_minimum_version'r)�category�
stacklevelr)��
�post_handshake_authTF�
SSLKEYLOGFILE)(r6�	TypeErrorr0r1�
ValueErrorr*rHr7�MINIMUM_SUPPORTED�MAXIMUM_SUPPORTED�warnings�warn�
FutureWarning�minimum_versionr:�maximum_version�set_ciphersrRr+r4r5r-r.r]�sys�version_infor2r3rbrrh�IS_PYOPENSSL�verify_mode�check_hostname�hostname_checks_common_name�os�environ�path�
expandvars�keylog_filename)	rZr\r]r^r`rarb�contextZ
sslkeylogfilerrr�create_urllib3_context�sl'����


r�.�sock�
socket.socket�keyfile�certfile�ca_certs�server_hostname�ssl_context�ssl.SSLContext | None�ca_cert_dir�key_password�ca_cert_data�None | str | bytes�
tls_in_tls�typing.Literal[False]�
ssl.SSLSocketc

C�dSr
r�
r�r�r�r\r�r�rZr^r�r�r�r�r�rrr�ssl_wrap_socketG�r�� ssl.SSLSocket | SSLTransportTypec

Cr�r
rr�rrrr�Yr�c

Cs�|}
|
dur
t|||d�}
|s|	s|r.z	|
�||	|�Wnty-}zt|�|�d}~ww|dur;t|
d�r;|
��|rI|
durIt|�rItd��|r]|
durV|
�||�n|
�|||
�|
�t	�t
||
||�}|S)a�
    All arguments except for server_hostname, ssl_context, tls_in_tls, ca_cert_data and
    ca_cert_dir have the same meaning as they do when using
    :func:`ssl.create_default_context`, :meth:`ssl.SSLContext.load_cert_chain`,
    :meth:`ssl.SSLContext.set_ciphers` and :meth:`ssl.SSLContext.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()
    :param tls_in_tls:
        Use SSLTransport to wrap the existing socket.
    N)r^�load_default_certsz5Client private key is encrypted, password is required)r��load_verify_locations�OSErrorr�hasattrr��_is_key_file_encrypted�load_cert_chain�set_alpn_protocols�ALPN_PROTOCOLS�_ssl_wrap_socket_impl)r�r�r�r\r�r�rZr^r�r�r�r�r�r�eZssl_sockrrrr�ks*(
��
�hostname�str | bytescCs,t|t�r
|�d�}tt�|�pt�|��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)rQ�bytes�decoderr	�matchr)r�rrr�is_ipaddress�s

r��key_filecCsRt|��}|D]}d|vrWd�dSqWd�dS1s"wYdS)z*Detects if a key file is encrypted or not.Z	ENCRYPTEDNTF)�open)r��f�linerrrr��s
��
��r�cCs4|rtstd��t�|�t|||�S|j||d�S)Nz0TLS in TLS requires support for the 'ssl' module)r�)r!rZ$_validate_ssl_context_for_tls_in_tls�wrap_socket)r�r�r�r�rrrr��s�
r�)rrrr)r=r>r?rrr@)rOrPrr)rOrPrrV)NNNNNNN)rZr[r\r[r]r[r^r_r`r[rar[rbr[rrc)............)r�r�r�r_r�r_r\r[r�r_r�r_rZr[r^r_r�r�r�r_r�r_r�r�r�r�rr�)r�r�r�r_r�r_r\r[r�r_r�r_rZr[r^r_r�r�r�r_r�r_r�r�r�rrr�)NNNNNNNNNNNF)r�r�rr)r�rrrr
)
r�r�r�rcr�rr�r_rr�)A�
__future__rrrKrz�socketrtrWrn�binasciir�
exceptionsrr�urlrr	r6r!r,rvr��tuplerVrZ_TYPE_VERSION_INFOrGr�
TYPE_CHECKINGrRrr ZssltransportZSSLTransportTyper"r*r(r+r-r.r/r0r1r2r3r4r5r7�PROTOCOL_SSLv23�attrr�AttributeError�ImportError�Unionr�Z_TYPE_PEER_CERT_RETrNrUrYr��overloadr�r�r�r�rrrr�<module>s��

<����

"
����
J

�