File: //opt/alt/python311/lib/python3.11/site-packages/setuptools/__pycache__/ssl_support.cpython-311.pyc
�
��;f-! � �* � d dl Z d dlZd dlZd dlZd dlZd dlmZmZmZm Z d dl
mZmZ d dl
Z
n
# e$ r dZ
Y nw xY wg d�Zd� � � � � � Z ej j Zej Zn# e$ r exZZY nw xY we
duoeeefvZ d dl
mZmZ n(# e$ r d dlmZ d dlmZ n# e$ r dZdZY nw xY wY nw xY wes G d � d
e� � Zesdd�Zd
� Z G d� de� � Z G d� de� � Zdd�Z d� Z!e!d� � � Z"d� Z#d� Z$dS )� N)�urllib�http_client�map�filter)�ResolutionError�ExtractionError)�VerifyingHTTPSHandler�find_ca_bundle�is_available�
cert_paths�
opener_fora
/etc/pki/tls/certs/ca-bundle.crt
/etc/ssl/certs/ca-certificates.crt
/usr/share/ssl/certs/ca-bundle.crt
/usr/local/share/certs/ca-root.crt
/etc/ssl/cert.pem
/System/Library/OpenSSL/certs/cert.pem
/usr/local/share/certs/ca-root-nss.crt
/etc/ssl/ca-bundle.pem
)�CertificateError�match_hostname)r )r c � � e Zd ZdS )r N)�__name__�
__module__�__qualname__� � �I/opt/alt/python311/lib/python3.11/site-packages/setuptools/ssl_support.pyr r 5 s � � � � � ��r r � c �l � g }| sdS | � d� � }|d }|dd� }|� d� � }||k rt dt | � � z � � �|s*| � � � |� � � k S |dk r|� d� � n�|� d � � s|� d � � r(|� t j |� � � � n;|� t j |� � � d
d� � � � |D ])}|� t j |� � � � �*t j
dd
� |� � z dz t j � � } | �
|� � S )zqMatching according to RFC 6125, section 6.4.3
https://tools.ietf.org/html/rfc6125#section-6.4.3
F�.r r N�*z,too many wildcards in certificate DNS name: z[^.]+zxn--z\*z[^.]*z\Az\.z\Z)�split�countr �repr�lower�append�
startswith�re�escape�replace�compile�join�
IGNORECASE�match)
�dn�hostname�
max_wildcards�pats�parts�leftmost� remainder� wildcards�frag�pats
r �_dnsname_matchr2 ; s� � �
��� ��5� ���������8���!�"�"�I� ��N�N�3�'�'� ��}�$�$�
#�>��b���I�K� K�
K� � 2��8�8�:�:����!1�!1�1�1�
�s�?�?�
�K�K�� � � � �
�
�
��
(�
(� E�H�,?�,?��,G�,G� E�
�K�K�� �(�+�+�,�,�,�,�
�K�K�� �(�+�+�3�3�E�7�C�C�D�D�D� � )� )�D��K�K�� �$���(�(�(�(��j�����D�!1�!1�1�E�9�2�=�I�I���y�y��"�"�"r c �z � | st d� � �g }| � dd� � }|D ]3\ }}|dk r(t ||� � r dS |� |� � �4|sP| � dd� � D ]9}|D ]4\ }}|dk r)t ||� � r dS |� |� � �5�:t |� � dk r;t d |�d
d� t t |� � � � ��� � �t |� � dk rt d |�d|d
��� � �t d� � �)a= Verify that *cert* (in decoded format as returned by
SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125
rules are followed, but IP addresses are not accepted for *hostname*.
CertificateError is raised on failure. On success, the function
returns nothing.
zempty or no certificate�subjectAltNamer �DNSN�subject�
commonNamer z hostname z doesn't match either of z, z doesn't match r z=no appropriate commonName or subjectAltName fields were found) �
ValueError�getr2 r �lenr r% r r )�certr) �dnsnames�san�key�value�subs r r r o s� � � � 8��6�7�7�7����h�h�'��,�,��� '� '�J�C���e�|�|�!�%��2�2� ��F�F�����&�&�&���
/� �x�x� �2�.�.�
/�
/��"%� /� /�J�C�� �l�*�*�)�%��:�:� #�"�F�F�F� ����.�.�.��
/� �x�=�=�1���"�"��8�8�T�Y�Y�s�4��':�':�;�;�;�$=� >� >�
>� ��]�]�a�
�
�"�"��8�8�X�a�[�[�$*� +� +�
+� #� $3� 4� 4�
4r c � � e Zd ZdZd� Zd� ZdS )r z=Simple verifying handler: no auth, subclasses, timeouts, etc.c �H � || _ t � | � � d S �N)� ca_bundle�HTTPSHandler�__init__)�selfrD s r rF zVerifyingHTTPSHandler.__init__� s# � �"������d�#�#�#�#�#r c �6 � � � � � fd�|� � S )Nc �* �� t | �j fi |��S rC )�VerifyingHTTPSConnrD )�host�kwrG s �r �<lambda>z2VerifyingHTTPSHandler.https_open.<locals>.<lambda>� s �� �1�$���M�M�"�M�M� r )�do_open)rG �reqs ` r �
https_openz VerifyingHTTPSHandler.https_open� s'