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/5057/lib/python3.12/site-packages/cryptography/x509/__pycache__/name.cpython-312.pyc
�

�F�h;���UddlmZddlZddlZddlZddlZddlZddlmZm	Z	ddl
mZddlm
ZddlmZmZGd�dej$�ZeD�cic]}|j(|��c}Zej,ej.ej0ej.ej2ej.ej4ej.ej6ej8ej:ej8iZd	ed
<ej@ee!fZ"ej@e!efZ#ejHdejJdejLd
ejNdejPdej,dejRdej:dejTdi	Z+ded<e+jY�D��cic]\}}||��
c}}Z-ej,dej0dejHdiZ.d%d�Z/d&d�Z0ejbdejde!e3fe!e3d��Z4Gd�dejje4�Z6Gd�d �Z7Gd!�d"�Z8Gd#�d$�Z9ycc}wcc}}w)'�)�annotationsN)�Iterable�Iterator)�utils)�x509)�NameOID�ObjectIdentifierc�<�eZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZy
)�	_ASN1Type������������N)�__name__�
__module__�__qualname__�	BitString�OctetString�
UTF8String�
NumericString�PrintableString�	T61String�	IA5String�UTCTime�GeneralizedTime�
VisibleString�UniversalString�	BMPString����/build/snapcraft-certbot-c9aaebe726f8beb59a0eb2d8e1671bc4/parts/certbot/install/lib/python3.12/site-packages/cryptography/x509/name.pyrrs>���I��K��J��M��O��I��I��G��O��M��O��Ir(rz!dict[ObjectIdentifier, _ASN1Type]�_NAMEOID_DEFAULT_TYPE�CN�L�ST�O�OU�C�STREET�DC�UID�_OidNameMap�_NAMEOID_TO_NAME)�r6)��@c���|syt|t�r'dtj|�j	d�zS|jdd�}|jdd�}|jdd	�}|jd
d�}|jdd
�}|jdd�}|jdd�}|jdd�}|ddvrd|z}|ddk(r|dddz}|S)z>Escape special characters in RFC4514 Distinguished Name value.��#�utf8�\z\\�"z\"�+z\+�,z\,�;z\;�<z\<�>z\>�z\00r)r;� ���rENz\ )�
isinstance�bytes�binascii�hexlify�decode�replace)�vals r)�_escape_dn_valuerNFs������#�u���X�%�%�c�*�1�1�&�9�9�9��+�+�d�F�
#�C�

�+�+�c�5�
!�C�

�+�+�c�5�
!�C�

�+�+�c�5�
!�C�

�+�+�c�5�
!�C�

�+�+�c�5�
!�C�

�+�+�c�5�
!�C�

�+�+�d�F�
#�C�
�1�v����S�j��
�2�w�#�~��#�2�h�����Jr(c�N�|syd�}tjj||�S)Nr:c�n�|jd�}t|�dk(r|Stt|d��S)Nr7�)�group�len�chr�int)�mrMs  r)�subz_unescape_dn_value.<locals>.subks0���g�g�a�j���s�8�q�=��J��3�s�B�<� � r()�_RFC4514NameParser�_PAIR_RErW)rMrWs  r)�_unescape_dn_valuerZcs(����!��&�&�*�*�3��4�4r(�NameAttributeValueTypeT)�	covariantc��eZdZ	ddd�									d
d�Zedd��Zedd��Zedd��Z	d			dd�Zdd	�Z	dd
�Z
dd�Zy)�
NameAttributeNT)�	_validatec��t|t�std��|tjk(r9|t
jk7rtd��t|t�s&td��t|t�std��tj|�}|�l|\}}t|t�sJ�t|jd��}||ks||kDr1d|�d|�d|��}	|d	urt|	��tj|	d
��|�$t j|tj"�}t|t�std��||_||_||_y)
Nz2oid argument must be an ObjectIdentifier instance.z6oid must be X500_UNIQUE_IDENTIFIER for BitString type.z!value must be bytes for BitStringzvalue argument must be a strr<zAttribute's length must be >= z and <= z
, but it was Tr6)�
stacklevelz%_type must be from the _ASN1Type enum)rGr	�	TypeErrorrrr�X500_UNIQUE_IDENTIFIERrH�str�_NAMEOID_LENGTH_LIMIT�getrS�encode�
ValueError�warnings�warnr*r�_oid�_value�_type)
�self�oid�valuermr_�
length_limits�
min_length�
max_length�c_len�msgs
          r)�__init__zNameAttribute.__init__�s[���#�/�0��D��
��I�'�'�'��g�4�4�4��L����e�U�+�� C�D�D��e�S�)�� >�?�?�-�1�1�#�6�
��$�%2�"�J�
��e�S�)�)�)�����V�,�-�E��z�!�U�Z�%7�4�Z�L�A�$��]�5�'�;����$�$�S�/�)��M�M�#�!�4��=�)�-�-�c�9�3G�3G�H�E��%��+��C�D�D���	�.3��� %��
r(c��|jS�N)rk�rns r)rozNameAttribute.oid�s���y�y�r(c��|jSrx)rlrys r)rpzNameAttribute.value�s���{�{�r(c�j�tj|j|jj�S)zt
        The short attribute name (for example "CN") if available,
        otherwise the OID dotted string.
        )r5rfro�
dotted_stringrys r)�rfc4514_attribute_namez$NameAttribute.rfc4514_attribute_name�s%�� �#�#�D�H�H�d�h�h�.D�.D�E�Er(c��|r|j|j�nd}|�|j}|�dt|j���S)z�
        Format as RFC4514 Distinguished Name string.

        Use short attribute name if available, otherwise fall back to OID
        dotted string.
        N�=)rfror}rNrp)rn�attr_name_overrides�	attr_names   r)�rfc4514_stringzNameAttribute.rfc4514_string�sP��2E��#�#�D�H�H�-�$�	����3�3�I���A�.�t�z�z�:�;�<�<r(c��t|t�stS|j|jk(xr|j|jk(Srx)rGr^�NotImplementedrorp�rn�others  r)�__eq__zNameAttribute.__eq__�s7���%��/�!�!��x�x�5�9�9�$�B����u�{�{�)B�Br(c�D�t|j|jf�Srx)�hashrorprys r)�__hash__zNameAttribute.__hash__�s���T�X�X�t�z�z�*�+�+r(c�<�d|j�d|j�d�S)Nz<NameAttribute(oid=z, value=�)>)rorprys r)�__repr__zNameAttribute.__repr__�s��$�T�X�X�J�h�t�z�z�n�B�G�Gr(rx)
ror	rpr[rmz_ASN1Type | Noner_�bool�return�None)r�r	)r�r[�r�rd�r�z_OidNameMap | Noner�rd�r��objectr�r��r�rU)rrrrv�propertyrorpr}r�r�r�r�r'r(r)r^r^s���
#'�	4&��
4&�
�4&�&�4&� �	4&��
4&�
�4&�l���������F��F�9=�=�#5�=�	�=�"C�,�Hr(r^c�^�eZdZd
d�Z				dd�Z	d			d
d�Zdd�Zdd�Zdd�Zdd�Z	dd	�Z
y)�RelativeDistinguishedNamec���t|�}|std��td�|D��std��||_t|�|_t|j�t|�k7rtd��y)Nz-a relative distinguished name cannot be emptyc3�<K�|]}t|t����y�wrx�rGr^��.0�xs  r)�	<genexpr>z5RelativeDistinguishedName.__init__.<locals>.<genexpr>�s����D�A�:�a��/�D���z/attributes must be an iterable of NameAttributez$duplicate attributes are not allowed)�listrh�allrb�_attributes�	frozenset�_attribute_setrS�rn�
attributess  r)rvz"RelativeDistinguishedName.__init__�st���*�%�
���L�M�M��D��D�D��M�N�N�&���'�
�3����t�"�"�#�s�:��6��C�D�D�7r(c�L�|D�cgc]}|j|k(s�|��c}Scc}wrx�ro�rnro�is   r)�get_attributes_for_oidz0RelativeDistinguishedName.get_attributes_for_oid��"�� �0�a�1�5�5�C�<��0�0��0��!�!Nc�L��dj�fd�|jD��S)z�
        Format as RFC4514 Distinguished Name string.

        Within each RDN, attributes are joined by '+', although that is rarely
        used in certificates.
        r?c3�@�K�|]}|j�����y�wrx�r��r��attrr�s  �r)r�z;RelativeDistinguishedName.rfc4514_string.<locals>.<genexpr>�%�����
��
��� 3�4�
�����joinr��rnr�s `r)r�z(RelativeDistinguishedName.rfc4514_string�s)����x�x�
��(�(�
�
�	
r(c�`�t|t�stS|j|jk(Srx)rGr�r�r�r�s  r)r�z RelativeDistinguishedName.__eq__s*���%�!:�;�!�!��"�"�e�&:�&:�:�:r(c�,�t|j�Srx)r�r�rys r)r�z"RelativeDistinguishedName.__hash__
s���D�'�'�(�(r(c�,�t|j�Srx)�iterr�rys r)�__iter__z"RelativeDistinguishedName.__iter__s���D�$�$�%�%r(c�,�t|j�Srx)rSr�rys r)�__len__z!RelativeDistinguishedName.__len__s���4�#�#�$�$r(c�*�d|j��d�S)Nz<RelativeDistinguishedName(r�r�rys r)r�z"RelativeDistinguishedName.__repr__s��,�T�-@�-@�-B�,C�2�F�Fr()r��Iterable[NameAttribute]�ror	r�z list[NameAttribute[str | bytes]]rxr�r�r��r�zIterator[NameAttribute]r�)rrrrvr�r�r�r�r�r�r�r'r(r)r�r��sS��E�1�
�1�
*�1�9=�
�#5�
�	�
�;�)�&�%�Gr(r�c��eZdZejdd��Zej				dd��Z				dd�Ze	d					dd��Z	d			dd�Z				dd�Z	e
dd��Zddd	�Zdd
�Z
dd�Zdd�Zdd
�Zdd�Zy)�Namec��yrxr'r�s  r)rvz
Name.__init__s��EHr(c��yrxr'r�s  r)rvz
Name.__init__s��r(c	�R�t|�}td�|D��r8|D�cgc]&}ttjt
|�g���(c}|_ytd�|D��r1tjtjt|�|_ytd��cc}w)Nc3�<K�|]}t|t����y�wrxr�r�s  r)r�z Name.__init__.<locals>.<genexpr>(s����@��z�!�]�+�@�r�c3�<K�|]}t|t����y�wrx)rGr�r�s  r)r�z Name.__init__.<locals>.<genexpr>-s����N�a��A�8�9�N�r�zNattributes must be a list of NameAttribute or a list RelativeDistinguishedName)	r�r�r��typing�castr^r��Listrb)rnr�r�s   r)rvz
Name.__init__#s����*�%�
��@�Z�@�@�$� ��*�6�;�;�}�a�+H�*I�J� �D���N�:�N�
N�%�{�{����5�6�
� �D���7��
�� s�+B$Nc�>�t||xsi�j�Srx)rX�parse)�cls�datar�s   r)�from_rfc4514_stringzName.from_rfc4514_string7s ��"�$�(;�(A�r�B�H�H�J�Jr(c�^��dj�fd�t|j�D��S)a�
        Format as RFC4514 Distinguished Name string.
        For example 'CN=foobar.com,O=Foo Corp,C=US'

        An X.509 name is a two-level structure: a list of sets of attributes.
        Each list element is separated by ',' and within each list element, set
        elements are separated by '+'. The latter is almost never used in
        real world certificates. According to RFC4514 section 2.1 the
        RDNSequence must be reversed when converting to string representation.
        r@c3�@�K�|]}|j�����y�wrxr�r�s  �r)r�z&Name.rfc4514_string.<locals>.<genexpr>Lr�r�)r��reversedr�r�s `r)r�zName.rfc4514_string?s.����x�x�
� ��!1�!1�2�
�
�	
r(c�L�|D�cgc]}|j|k(s�|��c}Scc}wrxr�r�s   r)r�zName.get_attributes_for_oidQr�r�c��|jSrx�r�rys r)�rdnsz	Name.rdnsWs�����r(c�,�tj|�Srx)�	rust_x509�encode_name_bytes)rn�backends  r)�public_byteszName.public_bytes[s���*�*�4�0�0r(c�`�t|t�stS|j|jk(Srx)rGr�r�r�r�s  r)r�zName.__eq__^s)���%��&�!�!����5�#4�#4�4�4r(c�>�tt|j��Srx)r��tupler�rys r)r�z
Name.__hash__ds���E�$�*�*�+�,�,r(c#�FK�|jD]}|Ed{����y7��wrxr�)rn�rdns  r)r�z
Name.__iter__is%�����#�#�	�C��N�N�	��s�!��!c�:�td�|jD��S)Nc3�2K�|]}t|����y�wrx)rS)r�r�s  r)r�zName.__len__.<locals>.<genexpr>ns����8��3�s�8�8�s�)�sumr�rys r)r�zName.__len__ms���8�t�'7�'7�8�8�8r(c�R�djd�|jD��}d|�d�S)Nr@c3�<K�|]}|j����y�wrxr�)r�r�s  r)r�z Name.__repr__.<locals>.<genexpr>qs����K�$��+�+�-�K�r�z<Name(r�r��rnr�s  r)r�z
Name.__repr__ps+���x�x�K�$�:J�:J�K�K����v�R� � r()r�r�r�r�)r�z#Iterable[RelativeDistinguishedName]r�r�)r�z3Iterable[NameAttribute | RelativeDistinguishedName]r�r�rx)r�rdr�z_NameOidMap | Noner�r�r�r�)r�zlist[RelativeDistinguishedName])r�z
typing.Anyr�rHr�r�r�r�)rrrr��overloadrv�classmethodr�r�r�r�r�r�r�r�r�r�r�r'r(r)r�r�s����_�_�H��H��_�_��=��	
�����G��
��(�37�K��K�0�K�
�	K��K�9=�
�#5�
�	�
�$1�
�1�
*�1�� �� �1�5�-�
�9�!r(r�c��eZdZejd�Zejd�ZdZeje�ZdZ	dZ
dZdee
j��d�Ze	�d	e��Ze
�d	e��Ze�d	e��Zejd
e�d	e�de�d	e�de�d	e�d
�
ej&�Zejd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zy) rXz!(0|([1-9]\d*))(\.(0|([1-9]\d*)))+z[a-zA-Z][a-zA-Z\d-]*z!\\([\\ #=\"\+,;<>]|[\da-zA-Z]{2})z7[\x01-\x1f\x21\x24-\x2A\x2D-\x3A\x3D\x3F-\x5B\x5D-\x7F]z3[\x01-\x21\x23-\x2A\x2D-\x3A\x3D\x3F-\x5B\x5D-\x7F]z7[\x01-\x1F\x21\x23-\x2A\x2D-\x3A\x3D\x3F-\x5B\x5D-\x7F]z[\x80-�]�|z
        (
            (z!)
            (
                (z)*
                (z$)
            )?
        )?
        z#([\da-zA-Z]{2})+c�.�||_d|_||_y)Nr)�_data�_idx�_attr_name_overrides)rnr�r�s   r)rvz_RFC4514NameParser.__init__�s����
���	�$7��!r(c�F�|jt|j�kSrx)r�rSr�rys r)�	_has_dataz_RFC4514NameParser._has_data�s���y�y�3�t�z�z�?�*�*r(c�V�|j�r|j|jSyrx)r�r�r�rys r)�_peekz_RFC4514NameParser._peek�s"���>�>���:�:�d�i�i�(�(�r(c�`�|j�|k7rt�|xjdz
c_y)Nr7)r�rhr�)rn�chs  r)�
_read_charz_RFC4514NameParser._read_char�s#���:�:�<�2�����	�	�Q��	r(c��|j|j|j��}|�t�|j	�}|xjt|�z
c_|S)N)�pos)�matchr�r�rhrRrS)rn�patr�rMs    r)�_read_rez_RFC4514NameParser._read_re�sI���	�	�$�*�*�$�)�)�	�4���=����k�k�m���	�	�S��X��	��
r(c�$�|j�stg�S|j�g}|j�rA|jd�|j	|j��|j�r�Att|��S)a'
        Parses the `data` string and converts it to a Name.

        According to RFC4514 section 2.1 the RDNSequence must be
        reversed when converting to string representation. So, when
        we parse it, we need to reverse again to get the RDNs on the
        correct order.
        r@)r�r��
_parse_rdnr��appendr�r�s  r)r�z_RFC4514NameParser.parse�sl���~�~����8�O����!�"���n�n���O�O�C� ��K�K����)�*��n�n���H�T�N�#�#r(c���|j�g}|j�dk(rD|jd�|j|j��|j�dk(r�Dt	|�S)Nr?)�	_parse_nar�r�rr�)rn�nass  r)rz_RFC4514NameParser._parse_rdn�s[���~�~�� ���j�j�l�c�!��O�O�C� ��J�J�t�~�~�'�(��j�j�l�c�!�)��-�-r(c�B�	|j|j�}t|�}|jd�|j�dk(rB|j|j�}tj|dd�j�}n&|j|j�}t|�}t!||�S#t$rU|j|j�}|j
j
|tj
|��}|�t�Y��wxYw)Nrr;r7)r��_OID_REr	rh�	_DESCR_REr�rf�_NAME_TO_NAMEOIDr�r��
_HEXSTRING_RErI�	unhexlifyrK�
_STRING_RErZr^)rn�	oid_valuero�namerp�	raw_values      r)rz_RFC4514NameParser._parse_na�s���
	.��
�
�d�l�l�3�I�#�9�-�C�������:�:�<�3���M�M�$�"4�"4�5�E��&�&�u�Q�R�y�1�8�8�:�E��
�
�d�o�o�6�I�&�y�1�E��S�%�(�(��%�	!��=�=����0�D��+�+�/�/��&�*�*�4�0��C��{� � ��	!�s�C�AD�DN)r�rdr��_NameOidMapr�r�)r�r�)r�z
str | None)r�rdr�r�r�)r�r�)r�r�)r�r^)rrr�re�compilerr�_PAIRrY�_LUTF1�_SUTF1�_TUTF1rT�sys�
maxunicode�_UTFMB�	_LEADCHAR�_STRINGCHAR�
_TRAILCHAR�VERBOSErr	rvr�r�r�r�r�rrr'r(r)rXrXus���b�j�j�=�>�G���
�
�2�3�I�0�E��r�z�z�%� �H�
G�F�
C�F�
G�F��s�3�>�>�*�+�1�
-�F��8�1�V�H�%�I��X�Q�v�h�'�K��H�A�f�X�&�J�������[��%��!���a��w�'���Q�u�g�&	�	�	�
�
��J��B�J�J�3�4�M�8�+��
�
�$�*.�)r(rX)rMzstr | bytesr�rd)rMrdr�rd):�
__future__rrIrrr�ri�collections.abcrr�cryptographyr�"cryptography.hazmat.bindings._rustrr��cryptography.x509.oidrr	�Enumrrp�_ASN1_TYPE_TO_ENUM�COUNTRY_NAMEr�JURISDICTION_COUNTRY_NAME�
SERIAL_NUMBER�DN_QUALIFIER�
EMAIL_ADDRESSr!�DOMAIN_COMPONENTr*�__annotations__�Mappingrdr4r�COMMON_NAME�
LOCALITY_NAME�STATE_OR_PROVINCE_NAME�ORGANIZATION_NAME�ORGANIZATIONAL_UNIT_NAME�STREET_ADDRESS�USER_IDr5�itemsrrerNrZ�TypeVar�UnionrHr[�Genericr^r�r�rX)r��k�vs000r)�<module>r9s6��
#��	�
�
��.��@�;���
�
��+4�4�Q�a�g�g�q�j�4�����)�3�3��%�%�y�'@�'@����9�4�4����)�3�3����9�.�.����i�1�1�
<��8���n�n�-�s�2�3���n�n�S�"2�2�3��
�������3��"�"�D����s��$�$�d����#����H����d��O�O�U�
!��+�
�&6�%;�%;�%=�>�T�Q��A�q�D�>�����&��%�%�v��������:5�&(�����
�L�L��e����	����bH�F�N�N�#9�:�bH�J3G�3G�lX!�X!�vh)�h)��g
5��6?s�H7�
H<