%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/core20/current/lib/python3/dist-packages/cryptography/x509/__pycache__/
Upload File :
Create Path :
Current File : //snap/core20/current/lib/python3/dist-packages/cryptography/x509/__pycache__/name.cpython-38.pyc

U

�e�]��@sddlmZmZmZddlmZddlZddlmZddl	m
Z
mZGdd�de�Ze
dd	�eD��Ze�Ze
jeje
jeje
jeje
jeje
jeje
jejiZe
jd
e
jde
jde
jd
e
jde
jde
jde
jde
j di	Z!dd�Z"Gdd�de�Z#Gdd�de�Z$Gdd�de�Z%dS)�)�absolute_import�division�print_function)�EnumN)�utils)�NameOID�ObjectIdentifierc@s4eZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdS)�	_ASN1Type����������N)
�__name__�
__module__�__qualname__�
UTF8StringZ
NumericString�PrintableStringZ	T61String�	IA5StringZUTCTimeZGeneralizedTimeZ
VisibleStringZUniversalStringZ	BMPString�rr�8/usr/lib/python3/dist-packages/cryptography/x509/name.pyr	sr	ccs|]}|j|fVqdS�N)�value��.0�irrr�	<genexpr>sr!ZCN�LZST�OZOU�CZSTREETZDCZUIDcCs�|�dd�}|�dd�}|�dd�}|�dd�}|�d	d
�}|�dd�}|�d
d�}|�dd�}|ddkrtd|}|ddkr�|dd�d}|S)z>Escape special characters in RFC4514 Distinguished Name value.�\z\\�"z\"�+z\+�,z\,�;z\;�<z\<�>z\>�z\00r)�#� ���r.Nz\ )�replace)�valrrr�_escape_dn_value6sr2c@sTeZdZefdd�Ze�d�Ze�d�Zdd�Z	dd�Z
d	d
�Zdd�Zd
d�Z
dS)�
NameAttributecCs�t|t�std��t|tj�s&td��|tjks:|tjkrTt|�	d��dkrTt
d��t|�dkrht
d��|tkr~t�
|tj�}t|t�s�td��||_||_||_dS)	Nz2oid argument must be an ObjectIdentifier instance.z#value argument must be a text type.�utf8�z/Country name must be a 2 character country coderzValue cannot be an empty stringz%_type must be from the _ASN1Type enum)�
isinstancer�	TypeError�sixZ	text_typer�COUNTRY_NAME�JURISDICTION_COUNTRY_NAME�len�encode�
ValueError�	_SENTINEL�_NAMEOID_DEFAULT_TYPE�getr	r�_oid�_value�_type)�self�oidrrCrrr�__init__Ls2
�����
zNameAttribute.__init__rArBcCs$t�|j|jj�}d|t|j�fS)z�
        Format as RFC4514 Distinguished Name string.

        Use short attribute name if available, otherwise fall back to OID
        dotted string.
        z%s=%s)�_NAMEOID_TO_NAMEr@rEZ
dotted_stringr2r)rD�keyrrr�rfc4514_stringvszNameAttribute.rfc4514_stringcCs&t|t�stS|j|jko$|j|jkSr)r6r3�NotImplementedrEr�rD�otherrrr�__eq__�s


�zNameAttribute.__eq__cCs
||kSrrrKrrr�__ne__�szNameAttribute.__ne__cCst|j|jf�Sr)�hashrEr�rDrrr�__hash__�szNameAttribute.__hash__cCs
d�|�S)Nz/<NameAttribute(oid={0.oid}, value={0.value!r})>)�formatrPrrr�__repr__�szNameAttribute.__repr__N)rrrr>rFrZread_only_propertyrErrIrMrNrQrSrrrrr3Ks'


	r3c@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�RelativeDistinguishedNamecCs\t|�}|std��tdd�|D��s.td��||_t|�|_t|j�t|�krXtd��dS)Nz-a relative distinguished name cannot be emptycss|]}t|t�VqdSr�r6r3�r�xrrrr!�sz5RelativeDistinguishedName.__init__.<locals>.<genexpr>z/attributes must be an iterable of NameAttributez$duplicate attributes are not allowed)�listr=�allr7�_attributes�	frozenset�_attribute_setr;�rDZ
attributesrrrrF�s
z"RelativeDistinguishedName.__init__cs�fdd�|D�S)Ncsg|]}|j�kr|�qSr�rErr^rr�
<listcomp>�s
zDRelativeDistinguishedName.get_attributes_for_oid.<locals>.<listcomp>r�rDrErr^r�get_attributes_for_oid�sz0RelativeDistinguishedName.get_attributes_for_oidcCsd�dd�|jD��S)z�
        Format as RFC4514 Distinguished Name string.

        Within each RDN, attributes are joined by '+', although that is rarely
        used in certificates.
        r'css|]}|��VqdSr�rI�r�attrrrrr!�sz;RelativeDistinguishedName.rfc4514_string.<locals>.<genexpr>��joinrZrPrrrrI�sz(RelativeDistinguishedName.rfc4514_stringcCst|t�stS|j|jkSr)r6rTrJr\rKrrrrM�s
z RelativeDistinguishedName.__eq__cCs
||kSrrrKrrrrN�sz RelativeDistinguishedName.__ne__cCs
t|j�Sr)rOr\rPrrrrQ�sz"RelativeDistinguishedName.__hash__cCs
t|j�Sr)�iterrZrPrrr�__iter__�sz"RelativeDistinguishedName.__iter__cCs
t|j�Sr)r;rZrPrrr�__len__�sz!RelativeDistinguishedName.__len__cCsd�|���S)Nz<RelativeDistinguishedName({})>)rRrIrPrrrrS�sz"RelativeDistinguishedName.__repr__N)rrrrFrarIrMrNrQrhrirSrrrrrT�s	rTc@sheZdZdd�Zdd�Zdd�Zedd��Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�ZdS)�NamecCsRt|�}tdd�|D��r,dd�|D�|_n"tdd�|D��rF||_ntd��dS)Ncss|]}t|t�VqdSrrUrVrrrr!�sz Name.__init__.<locals>.<genexpr>cSsg|]}t|g��qSr)rTrVrrrr_�sz!Name.__init__.<locals>.<listcomp>css|]}t|t�VqdSr)r6rTrVrrrr!�szNattributes must be a list of NameAttribute or a list RelativeDistinguishedName)rXrYrZr7r]rrrrF�s�
�z
Name.__init__cCsd�dd�|jD��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.
        r(css|]}|��VqdSrrbrcrrrr!�sz&Name.rfc4514_string.<locals>.<genexpr>rerPrrrrI�s
zName.rfc4514_stringcs�fdd�|D�S)Ncsg|]}|j�kr|�qSrr^rr^rrr_�s
z/Name.get_attributes_for_oid.<locals>.<listcomp>rr`rr^rra�szName.get_attributes_for_oidcCs|jSr�rZrPrrr�rdns�sz	Name.rdnscCs
|�|�Sr)Zx509_name_bytes)rDZbackendrrr�public_bytes�szName.public_bytescCst|t�stS|j|jkSr)r6rjrJrZrKrrrrM�s
zName.__eq__cCs
||kSrrrKrrrrN�szName.__ne__cCstt|j��Sr)rO�tuplerZrPrrrrQ�sz
Name.__hash__ccs |jD]}|D]
}|VqqdSrrk)rD�rdnZavarrrrh�s
z
Name.__iter__cCstdd�|jD��S)Ncss|]}t|�VqdSr)r;)rrorrrr!�szName.__len__.<locals>.<genexpr>)�sumrZrPrrrri�szName.__len__cCs,tjrd�|���d��Sd�|���SdS)Nz
<Name({})>r4)r8ZPY2rRrIr<rPrrrrS�sz
Name.__repr__N)rrrrFrIra�propertyrlrmrMrNrQrhrirSrrrrrj�s
rj)&Z
__future__rrr�enumrr8ZcryptographyrZcryptography.x509.oidrrr	�dictZ_ASN1_TYPE_TO_ENUM�objectr>r9rr:Z
SERIAL_NUMBERZDN_QUALIFIERZ
EMAIL_ADDRESSrZDOMAIN_COMPONENTr?ZCOMMON_NAMEZ
LOCALITY_NAMEZSTATE_OR_PROVINCE_NAMEZORGANIZATION_NAMEZORGANIZATIONAL_UNIT_NAMEZSTREET_ADDRESSZUSER_IDrGr2r3rTrjrrrr�<module>sV
��
H1

Zerion Mini Shell 1.0