OwlCyberSecurity - MANAGER
Edit File: ssl_.cpython-311.pyc
� �������h C���������������������������d�dl�mZ�d�dlZd�dlZd�dlZd�dlZd�dlmZmZ�d�dl m Z mZmZ�ddl mZmZmZmZ�ddlmZ�dd lmZmZ�dZdZd Zd Zd ZdgZe eed�Zd ��Z�eede������������Z �d�dl!Z!d�dl!m"Z"m#Z#�n#�e$$�r�Y�nw�xY�w �d�dl!mZ�n#�e$$�r�Y�nw�xY�w �ddl%mZ�n#�e$$�r�Y�nw�xY�w �d�dl!m&Z&�e&Z'n$#�e$$�r� �d�dl!m'Z&�e&Z'n#�e$$�r�dxZ'Z&Y�nw�xY�wY�nw�xY�w �d�dl!m(Z(�n #�e$$�r�e&Z(Y�nw�xY�w �d�dl!m)Z)m*Z*m+Z+�n#�e$$�r �d\��Z*Z+dZ)Y�nw�xY�w �d�dl!m,Z,�n #�e$$�r�dZ,Y�nw�xY�wd�-��������������������g�d�������������Z. �d�dl!mZ�n#�e$$�r��G�d��de/������������ZY�nw�xY�wd��Z0d ��Z1d!��Z2 �d'd"�Z3 � � � � � � � � � � � �d(d#�Z4d$��Z5d%��Z6d)d&�Z7dS�)*�����)�absolute_importN)�hexlify� unhexlify)�md5�sha1�sha256����)�InsecurePlatformWarning�ProxySchemeUnsupported�SNIMissingWarning�SSLError)�six����)�BRACELESS_IPV6_ADDRZ_RE�IPV4_REFzhttp/1.1)� ����(����@���c������������������������t����������t����������|�������������t����������|������������z ��������������}t����������t����������|�������������t����������|������������������������D�] \��}}|||z��z��}�|dk����S�)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�left�rights��� �H/opt/imunify360/venv/lib64/python3.11/site-packages/urllib3/util/ssl_.py�_const_compare_digest_backportr ������sd���������Q���#�a�&�&�� !� !�F��9�Q�<�<��1���6�6�������e��$��,�����Q�;�������compare_digest)� CERT_REQUIRED�wrap_socket)�HAS_SNI)�SSLTransport)�PROTOCOL_TLS)�PROTOCOL_SSLv23)�PROTOCOL_TLS_CLIENT)�OP_NO_COMPRESSION�OP_NO_SSLv2�OP_NO_SSLv3)i���i���i���)�OP_NO_TICKETi�@���:)zECDHE+AESGCMzECDHE+CHACHA20z DHE+AESGCMzDHE+CHACHA20zECDH+AESGCMz DH+AESGCMzECDH+AESzDH+AESz RSA+AESGCMzRSA+AESz!aNULLz!eNULLz!MD5z!DSS)� SSLContextc��������������������0�����e�Zd�Zd��Zd��Zdd�Zd��Zd d�ZdS�) r/���c�����������������������||�_���������d|�_��������t����������j��������|�_��������d�|�_��������d|�_��������d�|�_��������d�|�_��������d�|�_ ��������d�S�)NFr���) �protocol�check_hostname�ssl� CERT_NONE�verify_mode�ca_certs�options�certfile�keyfile�ciphers)�self�protocol_versions��� r����__init__zSSLContext.__init__����sB������,�D�M�"'�D��"�}�D�� �D�M��D�L� �D�M��D�L��D�L�L�Lr!���c������������������"�����||�_���������||�_��������d�S��N)r9���r:���)r<���r9���r:���s��� r����load_cert_chainzSSLContext.load_cert_chain����s������$�D�M�"�D�L�L�Lr!���Nc������������������X�����||�_���������|�t����������d�������������|�t����������d�������������d�S�)Nz-CA directories not supported in older Pythonsz&CA data not supported in older Pythons)r7���r ���)r<����cafile�capath�cadatas��� r����load_verify_locationsz SSLContext.load_verify_locations����s;������"�D�M��!��N�O�O�O��!��G�H�H�H��"�!r!���c�����������������������||�_���������d�S�r@����r;���)r<����cipher_suites��� r����set_cipherszSSLContext.set_ciphers����s ������'�D�L�L�Lr!���Fc�����������������������t����������j��������dt�����������������������|�j��������|�j��������|�j��������|�j��������|�j��������|d�}t����������|fd|�j ��������i|��S�)Na2��A 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/1.26.x/advanced-usage.html#ssl-warnings)r:���r9���r7���� cert_reqs�ssl_version�server_sider;���) �warnings�warnr ���r:���r9���r7���r6���r2���r$���r;���)r<����socket�server_hostnamerN����kwargss��� r���r$���zSSLContext.wrap_socket����sj�������M� ��(� �� �� �� �<� �M� �M�!�-�#�}�*� ���F���v�F�F�t�|�F�v�F�F�Fr!���)NNN)NF)�__name__� __module__�__qualname__r>���rA���rF���rJ���r$�����r!���r���r/���r/�������ss�������������� �� �� � #�� #�� #� I�� I�� I�� I� (�� (�� (� G�� G�� G�� G�� G�� Gr!���r/���c�����������������������|����������������������dd�����������������������������������������������}t����������|������������}t�������������������������������|������������}|s"t����������d���������������������|�������������������������t����������|�����������������������������������������������}�||�������������� ����������������������������������}t����������||������������s0t����������d���������������������|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_digests��� r����assert_fingerprintrh�������s���������%�%�c�2�.�.�4�4�6�6�K���$�$�M���� �.�.�H���Q��;�B�B�;�O�O�P�P�P��"�+�"4�"4�"6�"6�7�7���(�4�.�.�'�'�)�)�K� ��.?�@�@�� ��D�K�K��W�[�1�1� �� � �� �� � �� r!���c�����������������������|��t�����������S�t����������|�t����������������������r2t����������t����������|�d������������}|�t����������t����������d|�z���������������}|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. N�CERT_)r#���� isinstance�str�getattrr4����� candidate�ress��� r����resolve_cert_reqsrq�������sW������������)�S�!�!����c�9�d�+�+���;��#�w��2�3�3�C�� ��r!���c�����������������������|��t�����������S�t����������|�t����������������������r2t����������t����������|�d������������}|�t����������t����������d|�z���������������}|S�|�S�)z like resolve_cert_reqs N� PROTOCOL_)r'���rk���rl���rm���r4���rn���s��� r����resolve_ssl_versionrt�������sW������������)�S�!�!����c�9�d�+�+���;��#�{�Y�6�7�7�C�� ��r!���c������������������p�����|�r|�t�����������k����rt����������}�t����������|������������������������������������|pt�����������������������|�t ����������j��������n|}|�*d}|t����������z��}|t����������z��}|t����������z��}|t����������z��}�xj��������|z��c_��������|t ����������j��������k����st����������j ��������dk����rt�����������dd������������ ��d�_���������fd�}|t ����������j��������k����r|�_���������|���������������n�|���������������|�_��������t#�����������d������������r(t$����������j�����������������������������d������������}|r|�_���������S�) a��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``, and ``ssl.OP_NO_TICKET``. :param ciphers: Which cipher suites to allow the server to select. :returns: Constructed SSLContext object with specified options :rtype: SSLContext Nr���)�������������post_handshake_authTc�������������������<������t������������dd�������������� d��_��������d�S�d�S�)Nr3���F)rm���r3���)�contexts����r����disable_check_hostnamez6create_urllib3_context.<locals>.disable_check_hostnameE��s/��������G�-�t�4�4�@��&+�G�"�"�"� � A�@r!����keylog_filename� SSLKEYLOGFILE)r'���r)���r/���rJ����DEFAULT_CIPHERSr4���r#���r+���r,���r*���r-���r8����sys�version_inform���ry���r6����hasattr�os�environr]���r}���)rM���rL���r8���r;���r|���� sslkeylogfiler{���s��� @r����create_urllib3_contextr��������s{������J���*�+��5�5�)����%�%�G�����2�?�3�3�3��&/�%6��!�!�I�I������;����;���� �$�$�� � �<����O�O�w��O�O�� �S�&�&�&�#�*:�i�*G�*G�W��&��N��N� �N��'+��#�+��+��+��+��+���C�%�%�%�'����� � � � ��� � � �'�����w�)�*�*��4�� ����7�7� ��� 4�&3�G�#��Nr!���c ����������������������|} | �t����������|||�������������} |s| s|rA �| ���������������������|| |�������������nN#�t����������t����������f$�r}t ����������|�������������d}~ww�xY�w|�$t����������| d������������r| ������������������������������������|r | �t����������|������������rt ����������d�������������|r0| �| ���������������������||�������������n| ���������������������||| ������������� �t����������| d������������r| � ��������������������t�����������������������n#�t����������$�r�Y�nw�xY�w|ot����������|�������������}|rt����������pt����������o|}t����������s|rt����������j��������dt"�����������������������|rt%����������|�| ||�������������}nt%����������|�| |������������}|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() :param tls_in_tls: Use SSLTransport to wrap the existing socket. NrH����load_default_certsz5Client private key is encrypted, password is required�set_alpn_protocolsa���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/1.26.x/advanced-usage.html#ssl-warnings�rR���)r����rF����IOError�OSErrorr ���r����r�����_is_key_file_encryptedrA���r�����ALPN_PROTOCOLS�NotImplementedError�is_ipaddressr%����IS_SECURETRANSPORTrO���rP���r����_ssl_wrap_socket_impl)�sockr:���r9���rL���r7���rR���rM���r;����ssl_context�ca_cert_dir�key_password�ca_cert_data� tls_in_tlsr{����e�use_sni_hostname�send_sni�ssl_socks��� r����ssl_wrap_socketr����c��s�����L��G����)��i��Q�Q�Q����%�;��%�,��%� ��)�)�(�K��N�N�N�N����!�� �� �� ��1�+�+������ ����� � ���2F�!G�!G� ��"�"�$�$�$� ���P�<�'�,B�7�,K�,K�'��N�O�O�O���E����#�#�H�g�6�6�6�6��#�#�H�g�|�D�D�D� ��7�0�1�1�� 7��&�&�~�6�6�6����� �� �� ��� ���� �'�L�|�O�/L�/L�+L�� �,�W����.��� ���� �'�� �� � �� � �� �� ����D�(��'�:�� �� �� ����)��w� �C�C���Os'����6��A�A�A�*D�� D�Dc������������������������t�����������j��������s*t����������|�t����������������������r|����������������������d������������}�t����������t ����������j��������|�������������pt����������j��������|�������������������������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����PY2rk����bytes�decode�boolr����matchr���)�hostnames��� r���r����r�������sY��������7��,�z�(�E�2�2��,��?�?�7�+�+���� �h�'�'�R�+B�+H��+R�+R�S�S�Sr!���c�����������������������t����������|�d������������5�}|D�]}d|v�r�ddd�������������dS�� �ddd�������������n#�1�swxY�w�Y���dS�)z*Detects if a key file is encrypted or not.�r� ENCRYPTEDNTF)�open)�key_file�f�lines��� r���r����r�������s������� �h�� � ������ �� �D��d�"�"�� ����������������#� �����������������������������������5s���� 6�6�:�:c������������������������|r;t�����������st����������d�������������t����������j��������|�������������t����������|�||������������S�|r|���������������������|�|�������������S�|���������������������|�������������S�)Nz0TLS in TLS requires support for the 'ssl' moduler����)r&���r����$_validate_ssl_context_for_tls_in_tlsr$���)r����r����r����rR���s��� r���r����r�������s���������@��� �(�B����� �� �9�+�F�F�F��D�+��?�?�?���-��&�&�t�_�&�M�M�M��&�&�t�,�,�,r!���)NNNN)NNNNNNNNNNNFr@���)8� __future__r����hmacr����r����rO����binasciir���r����hashlibr���r���r���� exceptionsr ���r���r���r ����packagesr����urlr���r���r/���r&���r%����IS_PYOPENSSLr����r����r\���r ���rm���ra���r4���r#���r$����ImportError�ssltransportr'���r(���r)���r*���r+���r,���r-����joinr����objectrh���rq���rt���r����r����r����r����r����rW���r!���r����<module>r�������s������&��&��&��&��&��&������� � � � �� � � � �������'��'��'��'��'��'��'��'��%��%��%��%��%��%��%��%��%��%�������������������������������������1��1��1��1��1��1��1��1� � ��� ������������T�v�.�.�� �� �� �� ���&6�8V�W�W��� ��J�J�J�.�.�.�.�.�.�.�.�.���� �� �� ��D� ���� ����������� �� �� ��D� ���� �*�*�*�*�*�*�*���� �� �� ��D� ���� +� � � � � � �"�O�O����+��+��+�+�7�7�7�7�7�7�&������+��+��+�)*�*��,�,�,�+������+����'�'�'�'�'�'�'�'����'��'��'�&����'���� �?�?�?�?�?�?�?�?�?�?�?���� �� �� �3��K������ ���� � � � � � � � ����������L�L�L�����*��(�(����������&2G�����������0G��0G��0G�.G��.G��.G��.G��.G�V��.G��.G��.G��.G��.G�0G����f �� �� �:�����. �� �� �"�=A�f��f��f��f�V� � �� ���������c��c��c��c�L T�� T�� T������-��-��-��-��-��-s�����'A4��4A<�;A<��B��B�B�B��B"�!B"�&B/��/C�5B>�=C�> C �C� C � C�C�C��C%�$C%�) C4��4D�D�D��D�D�3D:��:E�E