Your IP : 52.14.176.111


Current Path : /usr/lib64/python3.6/site-packages/cryptography/x509/__pycache__/
Upload File :
Current File : //usr/lib64/python3.6/site-packages/cryptography/x509/__pycache__/general_name.cpython-36.pyc

3

l�_�
@sZddlmZmZmZddlZddlZddlmZddlZddl	m
Z
ddlmZddl
mZddd	d
ddd
ddd�	ZGdd�de�Zejej�Gdd�de��Ze
je�Gdd�de��Ze
je�Gdd�de��Ze
je�Gdd�de��Ze
je�Gdd�de��Ze
je�Gdd�de��Ze
je�Gdd �d e��Ze
je�Gd!d"�d"e��ZdS)#�)�absolute_import�division�print_functionN)�	parseaddr)�utils)�Name)�ObjectIdentifierZ	otherNameZ
rfc822NameZdNSNameZx400AddressZ
directoryNameZediPartyNameZuniformResourceIdentifierZ	iPAddressZregisteredID)	r��������cseZdZ�fdd�Z�ZS)�UnsupportedGeneralNameTypecstt|�j|�||_dS)N)�superr�__init__�type)�self�msgr)�	__class__��$/usr/lib64/python3.6/general_name.pyr sz#UnsupportedGeneralNameType.__init__)�__name__�
__module__�__qualname__r�
__classcell__rr)rrrsrc@seZdZejdd��ZdS)�GeneralNamecCsdS)z0
        Return the value of the object
        Nr)rrrr�value'szGeneralName.valueN)rrr�abc�abstractpropertyrrrrrr%src@sJeZdZdd�Zejd�Zedd��Zdd�Z	dd	�Z
d
d�Zdd
�ZdS)�
RFC822NamecCsjt|tj�r:y|jd�WqBtk
r6td��YqBXntd��t|�\}}|sX|r`td��||_dS)N�asciiz�RFC822Name values should be passed as an A-label string. This means unicode characters should be encoded via a library like idna.zvalue must be stringzInvalid rfc822name value)	�
isinstance�six�	text_type�encode�UnicodeEncodeError�
ValueError�	TypeErrorr�_value)rr�nameZaddressrrrr0s
zRFC822Name.__init__r+cCs|j|�}||_|S)N)�__new__r+)�clsr�instancerrr�_init_without_validationGs
z#RFC822Name._init_without_validationcCsdj|j�S)Nz<RFC822Name(value={0!r})>)�formatr)rrrr�__repr__MszRFC822Name.__repr__cCst|t�stS|j|jkS)N)r$r"�NotImplementedr)r�otherrrr�__eq__Ps
zRFC822Name.__eq__cCs
||kS)Nr)rr4rrr�__ne__VszRFC822Name.__ne__cCs
t|j�S)N)�hashr)rrrr�__hash__YszRFC822Name.__hash__N)
rrrrr�read_only_propertyr�classmethodr0r2r5r6r8rrrrr".s
r"c@sJeZdZdd�Zejd�Zedd��Zdd�Z	dd	�Z
d
d�Zdd
�ZdS)�DNSNamecCsLt|tj�r:y|jd�WqBtk
r6td��YqBXntd��||_dS)Nr#z~DNSName values should be passed as an A-label string. This means unicode characters should be encoded via a library like idna.zvalue must be string)r$r%r&r'r(r)r*r+)rrrrrr_szDNSName.__init__r+cCs|j|�}||_|S)N)r-r+)r.rr/rrrr0ps
z DNSName._init_without_validationcCsdj|j�S)Nz<DNSName(value={0!r})>)r1r)rrrrr2vszDNSName.__repr__cCst|t�stS|j|jkS)N)r$r;r3r)rr4rrrr5ys
zDNSName.__eq__cCs
||kS)Nr)rr4rrrr6szDNSName.__ne__cCs
t|j�S)N)r7r)rrrrr8�szDNSName.__hash__N)
rrrrrr9rr:r0r2r5r6r8rrrrr;]s
r;c@sJeZdZdd�Zejd�Zedd��Zdd�Z	dd	�Z
d
d�Zdd
�ZdS)�UniformResourceIdentifiercCsLt|tj�r:y|jd�WqBtk
r6td��YqBXntd��||_dS)Nr#zzURI values should be passed as an A-label string. This means unicode characters should be encoded via a library like idna.zvalue must be string)r$r%r&r'r(r)r*r+)rrrrrr�sz"UniformResourceIdentifier.__init__r+cCs|j|�}||_|S)N)r-r+)r.rr/rrrr0�s
z2UniformResourceIdentifier._init_without_validationcCsdj|j�S)Nz(<UniformResourceIdentifier(value={0!r})>)r1r)rrrrr2�sz"UniformResourceIdentifier.__repr__cCst|t�stS|j|jkS)N)r$r<r3r)rr4rrrr5�s
z UniformResourceIdentifier.__eq__cCs
||kS)Nr)rr4rrrr6�sz UniformResourceIdentifier.__ne__cCs
t|j�S)N)r7r)rrrrr8�sz"UniformResourceIdentifier.__hash__N)
rrrrrr9rr:r0r2r5r6r8rrrrr<�s
r<c@s>eZdZdd�Zejd�Zdd�Zdd�Zdd	�Z	d
d�Z
dS)
�
DirectoryNamecCst|t�std��||_dS)Nzvalue must be a Name)r$rr*r+)rrrrrr�s
zDirectoryName.__init__r+cCsdj|j�S)Nz<DirectoryName(value={})>)r1r)rrrrr2�szDirectoryName.__repr__cCst|t�stS|j|jkS)N)r$r=r3r)rr4rrrr5�s
zDirectoryName.__eq__cCs
||kS)Nr)rr4rrrr6�szDirectoryName.__ne__cCs
t|j�S)N)r7r)rrrrr8�szDirectoryName.__hash__N)rrrrrr9rr2r5r6r8rrrrr=�s
r=c@s>eZdZdd�Zejd�Zdd�Zdd�Zdd	�Z	d
d�Z
dS)
�RegisteredIDcCst|t�std��||_dS)Nz!value must be an ObjectIdentifier)r$rr*r+)rrrrrr�s
zRegisteredID.__init__r+cCsdj|j�S)Nz<RegisteredID(value={})>)r1r)rrrrr2�szRegisteredID.__repr__cCst|t�stS|j|jkS)N)r$r>r3r)rr4rrrr5�s
zRegisteredID.__eq__cCs
||kS)Nr)rr4rrrr6�szRegisteredID.__ne__cCs
t|j�S)N)r7r)rrrrr8�szRegisteredID.__hash__N)rrrrrr9rr2r5r6r8rrrrr>�s
r>c@s>eZdZdd�Zejd�Zdd�Zdd�Zdd	�Z	d
d�Z
dS)
�	IPAddresscCs,t|tjtjtjtjf�s"td��||_dS)Nzzvalue must be an instance of ipaddress.IPv4Address, ipaddress.IPv6Address, ipaddress.IPv4Network, or ipaddress.IPv6Network)r$�	ipaddressZIPv4AddressZIPv6AddressZIPv4NetworkZIPv6Networkr*r+)rrrrrr�s
zIPAddress.__init__r+cCsdj|j�S)Nz<IPAddress(value={})>)r1r)rrrrr2�szIPAddress.__repr__cCst|t�stS|j|jkS)N)r$r?r3r)rr4rrrr5�s
zIPAddress.__eq__cCs
||kS)Nr)rr4rrrr6szIPAddress.__ne__cCs
t|j�S)N)r7r)rrrrr8szIPAddress.__hash__N)rrrrrr9rr2r5r6r8rrrrr?�s
r?c@sHeZdZdd�Zejd�Zejd�Zdd�Zdd�Z	d	d
�Z
dd�Zd
S)�	OtherNamecCs4t|t�std��t|t�s$td��||_||_dS)Nz#type_id must be an ObjectIdentifierzvalue must be a binary string)r$rr*�bytes�_type_idr+)r�type_idrrrrrs

zOtherName.__init__rCr+cCsdj|j|j�S)Nz#<OtherName(type_id={}, value={!r})>)r1rDr)rrrrr2szOtherName.__repr__cCs&t|t�stS|j|jko$|j|jkS)N)r$rAr3rDr)rr4rrrr5s
zOtherName.__eq__cCs
||kS)Nr)rr4rrrr6"szOtherName.__ne__cCst|j|jf�S)N)r7rDr)rrrrr8%szOtherName.__hash__N)rrrrrr9rDrr2r5r6r8rrrrrA	s	

rA)Z
__future__rrrr r@Zemail.utilsrr%ZcryptographyrZcryptography.x509.namerZcryptography.x509.oidrZ_GENERAL_NAMES�	ExceptionrZ
add_metaclass�ABCMeta�objectrZregister_interfacer"r;r<r=r>r?rArrrr�<module>sB.((%

?>