HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //snap/certbot/5214/lib/python3.12/site-packages/certbot/_internal/__pycache__/san.cpython-312.pyc
�

Ȗ0i��	�f�dZddlZddlmZddlmZmZddlmZ	ddl
mZddlm
Z
Gd�d	�ZGd
�de�ZGd�d
e�Zdeedeefd�Zdeedeeeeeffd�Zdeedeedeefd�Zdeedefd�Zdej0dej2deeeeeffd�Zy)zFTypes for representing IP addresses and DNS names internal to Certbot.�N)�abstractmethod)�Any�Iterable)�crypto_util)�x509)�errorsc�&�eZdZdZedefd��Zy)�SANzyA domain or IP address.

    These are Certbot-internal types, independent of the acme module's messages.Identifier.
    �returnc��y)z+Return True if this is a wildcard DNS name.N���selfs ��/build/snapcraft-certbot-3159324ea1206d36e7f0992193f2ac71/parts/certbot/install/lib/python3.12/site-packages/certbot/_internal/san.py�is_wildcardzSAN.is_wildcards��N)�__name__�
__module__�__qualname__�__doc__r�boolrr
rrr
r
s"����:�T�:��:rr
c�`�eZdZdZdeddfd�Zdefd�Zdefd�Zdefd�Z	d	e
defd
�Zdefd�Z
y)�DNSNamez�An FQDN or wildcard domain name.

    Raises ConfigurationError if the domain name is syntactically invalid.

    Normalizes inputs by converting to lowercase and removing a trailing dot, if present.
    �dns_namerNc�p�t|t�std��	|jd�|j�}|jd�}dD]G}|jdj|��s�$tjdj||���	t|�tjdj|���#t$rtjd��wxYw#t$rYnwxYwd	j|�}t|�d
kDr$tjdj|���|jd�}|D][}|s$tjdj|���t|�d
kDs�8tjdj||���||_y)Nz(tried to initialize DNSName with non-str�asciizbNon-ASCII domain names not supported. To issue for an Internationalized Domain Name, use Punycode.�.)�http�httpsz{0}://z[Requested name {0} appears to be a URL, not a FQDN. Try again without the leading "{1}://".zRequested name {0} is an IP address. The Let's Encrypt certificate authority will not issue certificates for a bare IP address.z*Requested domain {0} is not a FQDN because�z{0} it is too long.z{0} it contains an empty label.�?z{0} label {1} is too long.)�
isinstance�str�	TypeError�encode�UnicodeErrorr�ConfigurationError�lower�removesuffix�
startswith�format�	IPAddress�
ValueError�len�splitr)rr�scheme�msg�labels�ls      r�__init__zDNSName.__init__s����(�C�(��F�G�G�	d��O�O�G�$��>�>�#���(�(��-��(�	�F��"�"�8�?�?�6�#:�;��/�/�@�@F�� �&�A���	�	��h���+�+�#�#)�6�(�#3�5�
5��)�	d��+�+�-c�d�
d�	d��0�	��	��;�A�A�(�K���x�=�3���+�+�,A�,H�,H��,M�N�N�����$���	]�A���/�/�0Q�0X�0X�Y\�0]�^�^��1�v��{��/�/�0L�0S�0S�TW�YZ�0[�\�\�		]�!��
s�C�/C-�C*�-	C9�8C9c��|jS�N�rrs r�__str__zDNSName.__str__Js���}�}�rc�,�t|j�Sr6)�hashrrs r�__hash__zDNSName.__hash__Ms���D�M�M�"�"rc� �d|jzS)NzDNS(%s)r7rs r�__repr__zDNSName.__repr__Ps���4�=�=�(�(r�otherc��|xtd�x�\|j|jk(Std�x�\y	tdt	|�����)Nr
Fz!DNSName SAN compared to non-SAN: )rrr,r$�type�rr>s  r�__eq__zDNSName.__eq__SsK�������}�}����6�6��������"C�D��K�=� Q�R�Rrc�8�|jjd�S)z+Return True if this DNS name is a wildcard.z*.)rr*rs rrzDNSName.is_wildcard\s���}�}�'�'��-�-r�rrrrr#r4r8�intr;r=rrrBrr
rrrrsa���-!��-!��-!�^���#�#�#�)�#�)�S�C�S�D�S�.�T�.rrc�`�eZdZdZdeddfd�Zdefd�Zdefd�Zdefd�Z	d	e
defd
�Zdefd�Z
y)r,zDAn IP address (IPv4 or IPv6).

    Validated upon construction.
    �
ip_addressrNc�8�tj|�|_yr6)�	ipaddressrG)rrGs  rr4zIPAddress.__init__es��#�.�.�z�:��rc�,�t|j�Sr6)r#rGrs rr8zIPAddress.__str__hs���4�?�?�#�#rc�,�t|j�Sr6)r:rGrs rr;zIPAddress.__hash__ks���D�O�O�$�$rc� �d|jzS)NzIP(%s))rGrs rr=zIPAddress.__repr__ns���$�/�/�)�)rr>c��|xtd�x�\|j|jk(Std�x�\y	tdt	|�����)Nr
Fz#IPAddress SAN compared to non-SAN: )r,rGrr$r@rAs  rrBzIPAddress.__eq__qsM���������%�*:�*:�:�:��������"E�d�5�k�]� S�T�Trc��y)z
Always False.Fr
rs rrzIPAddress.is_wildcardzs��rrDr
rrr,r,`s`���;�3�;�4�;�$��$�%�#�%�*�#�*�U�C�U�D�U��T�rr,�namesrc��g}|D]}	|jt|���|S#t$r|jt|��Y�GwxYw)zDTurn a list of strings in to a list of SANs based on how they parse.)�appendr,r-r)rO�sans�names   r�guessrT~sS���D��'��	'��K�K�	�$��(�'�
�K���	'��K�K���
�&�	'�s�'�#A
�A
rRc���g}g}|D]X}|xtd�x�\|j|��#td�x�\|j|��A	tdt	|�����||fS)zQSplit a list of SANs into a list of DNSNames and one of IPAddress, in that order.r
zSAN of type )r,rQrr$r@)rR�domains�ip_addresses�ss    rr/r/�st���G��L�
�:�������#�#�A�&�������q�!����,�t�A�w�i� 8�9�9�:��L� � r�	dns_namesrWc�0�t|�t|�zS)z7Combine a list of DNS names and a list of IP addresses.)�list)rYrWs  r�joinr\�s���	�?�T�,�/�/�/rc�@�djtt|��S)zEReturn the list of SANs in string form, separated by comma and space.z, )r\�mapr#)rRs r�displayr_�s���9�9�S��d�^�$�$r�subject�extsc��tj||�\}}|D�cgc]
}t|���c}|D�cgc]
}t|���c}fScc}wcc}w)a�Get all DNS names and IP addresses, plus the first Common Name from subject.

    The CN will be first in the list, if present. It will always be interpreted
    as a DNS name.

    :param subject: Name of the x509 object, which may include Common Name
    :type subject: `cryptography.x509.Name`
    :param exts: Extensions of the x509 object, which may include SANs
    :type exts: `cryptography.x509.Extensions`

    :returns: Tuple containing a list of DNSNames and a list of IPAddresses
    )�acme_crypto_util�get_identifiers_from_x509rr,)r`rarYrW�d�is      r�	from_x509rg�sK��/�H�H��RV�W��I�|� )�*�1�G�A�J�*�<�,P�a�Y�q�\�,P�P�P��*��,Ps
�A�A)rrI�abcr�typingrr�acmerrc�cryptographyr�certbotrr
rr,r#r[rT�tupler/r\r_�Name�
Extensionsrgr
rr�<module>rps���L��� �0���:�:�J.�c�J.�X���<��#���4��9��!���
�!�%��W�
�t�I��(F�"G�!�0�H�W�%�0�X�i�5H�0�T�RU�Y�0�%�(�3�-�%�C�%�Q�t�y�y�Q����Q�E�$�w�-�QU�V_�Q`�B`�<a�Qr