o
    îRµiùÒ  ã                   @   sˆ  d dl Z d dlZd dlZd dlZd dlZd dlmZ d dlmZm	Z	m
Z
mZ d dlmZ d dlmZmZ d dlmZ d dlmZ d dlmZ d d	lmZmZmZ d d
lmZ d dlmZmZm Z m!Z! dede"fdd„Z#dd„ Z$G dd„ de%ƒZ&G dd„ de%ƒZ'G dd„ de j(d�Z)G dd„ de*ƒZ+G dd„ de)ƒZ,G dd„ de)ƒZ-G dd „ d e)ƒZ.G d!d"„ d"e)ƒZ/G d#d$„ d$e)ƒZ0G d%d&„ d&e*ƒZ1G d'd(„ d(e)ƒZ2G d)d*„ d*e)ƒZ3G d+d,„ d,e)ƒZ4G d-d.„ d.e)ƒZ5G d/d0„ d0e*ƒZ6G d1d2„ d2ej7ƒZ8G d3d4„ d4e)ƒZ9G d5d6„ d6e)ƒZ:G d7d8„ d8e*ƒZ;G d9d:„ d:e*ƒZ<G d;d<„ d<e*ƒZ=G d=d>„ d>e)ƒZ>G d?d@„ d@e)ƒZ?G dAdB„ dBe)ƒZ@G dCdD„ dDe)ƒZAG dEdF„ dFej7ƒZBdGdH„ eBD ƒZCG dIdJ„ dJe)ƒZDG dKdL„ dLe)ƒZEG dMdN„ dNe)ƒZFG dOdP„ dPe*ƒZGG dQdR„ dRe*ƒZHG dSdT„ dTe)ƒZIG dUdV„ dVe)ƒZJG dWdX„ dXe)ƒZKG dYdZ„ dZe)ƒZLG d[d\„ d\e)ƒZMG d]d^„ d^e)ƒZNG d_d`„ d`e)ƒZOG dadb„ dbe)ƒZPG dcdd„ dde)ƒZQG dedf„ dfe)ƒZRdS )gé    N)Úutils)Ú
BIT_STRINGÚ	DERReaderÚOBJECT_IDENTIFIERÚSEQUENCE)Ú_PUBLIC_KEY_TYPES)Úconstant_timeÚserialization)ÚEllipticCurvePublicKey)ÚRSAPublicKey)ÚSignedCertificateTimestamp)ÚGeneralNameÚ	IPAddressÚ	OtherName)ÚRelativeDistinguishedName)ÚCRLEntryExtensionOIDÚExtensionOIDÚOCSPExtensionOIDÚObjectIdentifierÚ
public_keyÚreturnc                 C   s   t | tƒr|  tjjtjj¡}nit | tƒr |  tjj	tjj
¡}nY|  tjjtjj¡}t|ƒ}| t¡�}| t¡}| t¡}W d   ƒ n1 sHw   Y  |� | t¡ | ¡ s]| ¡  W d   ƒ n1 sgw   Y  | ¡ dkrvtdƒ‚|j}t |¡ ¡ S )Nr   zInvalid public key encoding)Ú
isinstancer   Úpublic_bytesr	   ÚEncodingÚDERÚPublicFormatÚPKCS1r
   ÚX962ÚUncompressedPointÚSubjectPublicKeyInfor   Úread_single_elementr   Úread_elementr   r   Úis_emptyÚread_any_elementÚ	read_byteÚ
ValueErrorÚdataÚhashlibÚsha1Údigest)r   r&   Ú
serializedÚreaderÚpublic_key_infoÚ	algorithmÚpublic_key_data© r/   ú>/usr/lib/python3/dist-packages/cryptography/x509/extensions.pyÚ_key_identifier_from_public_key$   s:   
þ
þþ
þ
€ür1   c                    s.   ‡ fdd„}‡ fdd„}‡ fdd„}|||fS )Nc                    ó   t t| ˆ ƒƒS ©N)ÚlenÚgetattr©Úself©Ú
field_namer/   r0   Ú
len_methodM   ó   z*_make_sequence_methods.<locals>.len_methodc                    r2   r3   )Úiterr5   r6   r8   r/   r0   Úiter_methodP   r;   z+_make_sequence_methods.<locals>.iter_methodc                    s   t | ˆ ƒ| S r3   )r5   )r7   Úidxr8   r/   r0   Úgetitem_methodS   r;   z._make_sequence_methods.<locals>.getitem_methodr/   )r9   r:   r=   r?   r/   r8   r0   Ú_make_sequence_methodsL   s   
r@   c                       ó&   e Zd Zdedef‡ fdd„Z‡  ZS )ÚDuplicateExtensionÚmsgÚoidc                    ó   t t| ƒ |¡ || _d S r3   )ÚsuperrB   Ú__init__rD   ©r7   rC   rD   ©Ú	__class__r/   r0   rG   Z   ó   
zDuplicateExtension.__init__©Ú__name__Ú
__module__Ú__qualname__Ústrr   rG   Ú__classcell__r/   r/   rI   r0   rB   Y   ó    rB   c                       rA   )ÚExtensionNotFoundrC   rD   c                    rE   r3   )rF   rS   rG   rD   rH   rI   r/   r0   rG   `   rK   zExtensionNotFound.__init__rL   r/   r/   rI   r0   rS   _   rR   rS   c                   @   s    e Zd Zejdefdd„ƒZdS )ÚExtensionTyper   c                 C   ó   dS )zK
        Returns the oid associated with the given extension type.
        Nr/   r6   r/   r/   r0   rD   f   s    zExtensionType.oidN)rM   rN   rO   ÚabcÚabstractpropertyr   rD   r/   r/   r/   r0   rT   e   s    rT   )Ú	metaclassc                   @   sR   e Zd Zdejd fdd„Zdeddfdd„Zdd	d
„Ze	dƒ\Z
ZZdd„ ZdS )Ú
ExtensionsÚ
extensionsÚ	Extensionc                 C   ó
   || _ d S r3   )Ú_extensions)r7   rZ   r/   r/   r0   rG   n   ó   
zExtensions.__init__rD   r   c                 C   s,   | D ]}|j |kr|  S qtd |¡|ƒ‚)NúNo {} extension was found)rD   rS   Úformat)r7   rD   Úextr/   r/   r0   Úget_extension_for_oidq   s
   
ÿz Extensions.get_extension_for_oidc                 C   s@   |t u rtdƒ‚| D ]}t|j|ƒr|  S q
td |¡|jƒ‚)Nz|UnrecognizedExtension can't be used with get_extension_for_class because more than one instance of the class may be present.r_   )ÚUnrecognizedExtensionÚ	TypeErrorr   ÚvaluerS   r`   rD   )r7   Úextclassra   r/   r/   r0   Úget_extension_for_classx   s   ÿÿÿz"Extensions.get_extension_for_classr]   c                 C   ó   d  | j¡S )Nz<Extensions({})>)r`   r]   r6   r/   r/   r0   Ú__repr__Š   ó   zExtensions.__repr__N)r   r[   )rM   rN   rO   ÚtypingÚListrG   r   rb   rg   r@   Ú__len__Ú__iter__Ú__getitem__ri   r/   r/   r/   r0   rY   m   s    
rY   c                   @   óJ   e Zd ZejZdefdd„Zdd„ Zdd„ Z	dd	„ Z
d
d„ Ze d¡ZdS )Ú	CRLNumberÚ
crl_numberc                 C   ó   t |tƒs	tdƒ‚|| _d S ©Nzcrl_number must be an integer©r   Úintrd   Ú_crl_number©r7   rr   r/   r/   r0   rG   ‘   ó   

zCRLNumber.__init__c                 C   ó   t |tƒstS | j|jkS r3   )r   rq   ÚNotImplementedrr   ©r7   Úotherr/   r/   r0   Ú__eq__—   ó   
zCRLNumber.__eq__c                 C   ó
   | |k S r3   r/   r|   r/   r/   r0   Ú__ne__�   r^   zCRLNumber.__ne__c                 C   ó
   t | jƒS r3   ©Úhashrr   r6   r/   r/   r0   Ú__hash__    r^   zCRLNumber.__hash__c                 C   rh   )Nz<CRLNumber({})>)r`   rr   r6   r/   r/   r0   ri   £   rj   zCRLNumber.__repr__rw   N)rM   rN   rO   r   Ú
CRL_NUMBERrD   rv   rG   r~   r�   r…   ri   r   Úread_only_propertyrr   r/   r/   r/   r0   rq   Ž   ó    rq   c                   @   sª   e Zd ZejZdeje dejej	e
  deje fdd„Zededd fdd	„ƒZe	
			 ddd„ƒZdd„ Zdd„ Zdd„ Zdd„ Ze d¡Ze d¡Ze d¡ZdS )ÚAuthorityKeyIdentifierÚkey_identifierÚauthority_cert_issuerÚauthority_cert_serial_numberc                 C   sr   |d u |d u krt dƒ‚|d ur!t|ƒ}tdd„ |D ƒƒs!tdƒ‚|d ur.t|tƒs.tdƒ‚|| _|| _|| _d S )NzXauthority_cert_issuer and authority_cert_serial_number must both be present or both Nonec                 s   ó   � | ]}t |tƒV  qd S r3   ©r   r   ©Ú.0Úxr/   r/   r0   Ú	<genexpr>¼   ó   € 

ÿz2AuthorityKeyIdentifier.__init__.<locals>.<genexpr>z;authority_cert_issuer must be a list of GeneralName objectsz/authority_cert_serial_number must be an integer)	r%   ÚlistÚallrd   r   rv   Ú_key_identifierÚ_authority_cert_issuerÚ_authority_cert_serial_number)r7   rŠ   r‹   rŒ   r/   r/   r0   rG   ¬   s*   ÿÿÿÿ
ÿ
zAuthorityKeyIdentifier.__init__r   r   c                 C   s   t |ƒ}| |d d d�S ©N)rŠ   r‹   rŒ   ©r1   )Úclsr   r)   r/   r/   r0   Úfrom_issuer_public_keyÍ   s   ýz-AuthorityKeyIdentifier.from_issuer_public_keyÚskiÚSubjectKeyIdentifierc                 C   s   | |j d d d�S r™   )r)   )r›   r�   r/   r/   r0   Ú"from_issuer_subject_key_identifierØ   s
   ýz9AuthorityKeyIdentifier.from_issuer_subject_key_identifierc                 C   ó
   d  | ¡S )Nz­<AuthorityKeyIdentifier(key_identifier={0.key_identifier!r}, authority_cert_issuer={0.authority_cert_issuer}, authority_cert_serial_number={0.authority_cert_serial_number})>©r`   r6   r/   r/   r0   ri   â   s   üzAuthorityKeyIdentifier.__repr__c                 C   ó2   t |tƒstS | j|jko| j|jko| j|jkS r3   )r   r‰   r{   rŠ   r‹   rŒ   r|   r/   r/   r0   r~   ê   s   

ÿÿýzAuthorityKeyIdentifier.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   õ   r^   zAuthorityKeyIdentifier.__ne__c                 C   s,   | j d u rd }nt| j ƒ}t| j|| jfƒS r3   )r‹   Útupler„   rŠ   rŒ   )r7   Úacir/   r/   r0   r…   ø   s   

ÿzAuthorityKeyIdentifier.__hash__r–   r—   r˜   N)r�   rž   r   r‰   )rM   rN   rO   r   ÚAUTHORITY_KEY_IDENTIFIERrD   rk   ÚOptionalÚbytesÚIterabler   rv   rG   Úclassmethodr   rœ   rŸ   ri   r~   r�   r…   r   r‡   rŠ   r‹   rŒ   r/   r/   r/   r0   r‰   ©   s<    þý
ü!ÿþ
ÿþ	
	
ÿr‰   c                   @   s`   e Zd ZejZdefdd„Zede	dd fdd„ƒZ
e d¡Zd	d
„ Zdd„ Zdd„ Zdd„ ZdS )rž   r)   c                 C   r\   r3   )Ú_digest)r7   r)   r/   r/   r0   rG     r^   zSubjectKeyIdentifier.__init__r   r   c                 C   s   | t |ƒƒS r3   rš   )r›   r   r/   r/   r0   Úfrom_public_key  s   z$SubjectKeyIdentifier.from_public_keyrª   c                 C   rh   )Nz$<SubjectKeyIdentifier(digest={0!r})>)r`   r)   r6   r/   r/   r0   ri     rj   zSubjectKeyIdentifier.__repr__c                 C   s   t |tƒstS t | j|j¡S r3   )r   rž   r{   r   Úbytes_eqr)   r|   r/   r/   r0   r~     s   
zSubjectKeyIdentifier.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�     r^   zSubjectKeyIdentifier.__ne__c                 C   r‚   r3   )r„   r)   r6   r/   r/   r0   r…   "  r^   zSubjectKeyIdentifier.__hash__N)rM   rN   rO   r   ÚSUBJECT_KEY_IDENTIFIERrD   r§   rG   r©   r   r«   r   r‡   r)   ri   r~   r�   r…   r/   r/   r/   r0   rž     s    ÿþ
rž   c                   @   óT   e Zd ZejZdejd fdd„Ze	dƒ\Z
ZZdd„ Zdd	„ Zd
d„ Zdd„ ZdS )ÚAuthorityInformationAccessÚdescriptionsÚAccessDescriptionc                 C   ó,   t |ƒ}tdd„ |D ƒƒstdƒ‚|| _d S )Nc                 s   r�   r3   ©r   r±   r�   r/   r/   r0   r’   +  ó   € z6AuthorityInformationAccess.__init__.<locals>.<genexpr>ú@Every item in the descriptions list must be an AccessDescription©r”   r•   rd   Ú_descriptions©r7   r°   r/   r/   r0   rG   )  ó   ÿ
z#AuthorityInformationAccess.__init__r·   c                 C   rh   )Nz <AuthorityInformationAccess({})>©r`   r·   r6   r/   r/   r0   ri   5  rj   z#AuthorityInformationAccess.__repr__c                 C   rz   r3   )r   r¯   r{   r·   r|   r/   r/   r0   r~   8  r   z!AuthorityInformationAccess.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   >  r^   z!AuthorityInformationAccess.__ne__c                 C   ó   t t| jƒƒS r3   ©r„   r£   r·   r6   r/   r/   r0   r…   A  r;   z#AuthorityInformationAccess.__hash__N)rM   rN   rO   r   ÚAUTHORITY_INFORMATION_ACCESSrD   rk   r¨   rG   r@   rm   rn   ro   ri   r~   r�   r…   r/   r/   r/   r0   r¯   &  ó    
r¯   c                   @   r®   )ÚSubjectInformationAccessr°   r±   c                 C   r²   )Nc                 s   r�   r3   r³   r�   r/   r/   r0   r’   J  r´   z4SubjectInformationAccess.__init__.<locals>.<genexpr>rµ   r¶   r¸   r/   r/   r0   rG   H  r¹   z!SubjectInformationAccess.__init__r·   c                 C   rh   )Nz<SubjectInformationAccess({})>rº   r6   r/   r/   r0   ri   T  rj   z!SubjectInformationAccess.__repr__c                 C   rz   r3   )r   r¿   r{   r·   r|   r/   r/   r0   r~   W  r   zSubjectInformationAccess.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   ]  r^   zSubjectInformationAccess.__ne__c                 C   r»   r3   r¼   r6   r/   r/   r0   r…   `  r;   z!SubjectInformationAccess.__hash__N)rM   rN   rO   r   ÚSUBJECT_INFORMATION_ACCESSrD   rk   r¨   rG   r@   rm   rn   ro   ri   r~   r�   r…   r/   r/   r/   r0   r¿   E  r¾   r¿   c                   @   sR   e Zd Zdedefdd„Zdd„ Zdd„ Zd	d
„ Zdd„ Z	e
 d¡Ze
 d¡ZdS )r±   Úaccess_methodÚaccess_locationc                 C   s4   t |tƒs	tdƒ‚t |tƒstdƒ‚|| _|| _d S )Nz)access_method must be an ObjectIdentifierz%access_location must be a GeneralName)r   r   rd   r   Ú_access_methodÚ_access_location)r7   rÁ   rÂ   r/   r/   r0   rG   e  s   


zAccessDescription.__init__c                 C   r    )NzY<AccessDescription(access_method={0.access_method}, access_location={0.access_location})>r¡   r6   r/   r/   r0   ri   q  ó   þzAccessDescription.__repr__c                 C   ó&   t |tƒstS | j|jko| j|jkS r3   )r   r±   r{   rÁ   rÂ   r|   r/   r/   r0   r~   w  ó
   

þzAccessDescription.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   €  r^   zAccessDescription.__ne__c                 C   ó   t | j| jfƒS r3   )r„   rÁ   rÂ   r6   r/   r/   r0   r…   ƒ  ó   zAccessDescription.__hash__rÃ   rÄ   N)rM   rN   rO   r   r   rG   ri   r~   r�   r…   r   r‡   rÁ   rÂ   r/   r/   r/   r0   r±   d  s    ÿ
ÿ	
r±   c                   @   s^   e Zd ZejZdedeje	 fdd„Z
e d¡Ze d¡Zdd„ Zd	d
„ Zdd„ Zdd„ ZdS )ÚBasicConstraintsÚcaÚpath_lengthc                 C   sX   t |tƒs	tdƒ‚|d ur|stdƒ‚|d ur$t |tƒr |dk r$tdƒ‚|| _|| _d S )Nzca must be a boolean valuez)path_length must be None when ca is Falser   z2path_length must be a non-negative integer or None)r   Úboolrd   r%   rv   Ú_caÚ_path_length)r7   rË   rÌ   r/   r/   r0   rG   �  s   
ÿÿ
zBasicConstraints.__init__rÎ   rÏ   c                 C   r    )Nz:<BasicConstraints(ca={0.ca}, path_length={0.path_length})>r¡   r6   r/   r/   r0   ri   ¡  rÅ   zBasicConstraints.__repr__c                 C   rÆ   r3   )r   rÊ   r{   rË   rÌ   r|   r/   r/   r0   r~   ¦  ó   
zBasicConstraints.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   ¬  r^   zBasicConstraints.__ne__c                 C   rÈ   r3   )r„   rË   rÌ   r6   r/   r/   r0   r…   ¯  rÉ   zBasicConstraints.__hash__N)rM   rN   rO   r   ÚBASIC_CONSTRAINTSrD   rÍ   rk   r¦   rv   rG   r   r‡   rË   rÌ   ri   r~   r�   r…   r/   r/   r/   r0   rÊ   Š  s    

rÊ   c                   @   sJ   e Zd ZejZdefdd„Ze 	d¡Z
dd„ Zdd„ Zd	d
„ Zdd„ ZdS )ÚDeltaCRLIndicatorrr   c                 C   rs   rt   ru   rx   r/   r/   r0   rG   ¶  ry   zDeltaCRLIndicator.__init__rw   c                 C   rz   r3   )r   rÒ   r{   rr   r|   r/   r/   r0   r~   ¾  r   zDeltaCRLIndicator.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   Ä  r^   zDeltaCRLIndicator.__ne__c                 C   r‚   r3   rƒ   r6   r/   r/   r0   r…   Ç  r^   zDeltaCRLIndicator.__hash__c                 C   r    )Nz.<DeltaCRLIndicator(crl_number={0.crl_number})>r¡   r6   r/   r/   r0   ri   Ê  r^   zDeltaCRLIndicator.__repr__N)rM   rN   rO   r   ÚDELTA_CRL_INDICATORrD   rv   rG   r   r‡   rr   r~   r�   r…   ri   r/   r/   r/   r0   rÒ   ³  s    
rÒ   c                   @   r®   )ÚCRLDistributionPointsÚdistribution_pointsÚDistributionPointc                 C   r²   )Nc                 s   r�   r3   ©r   rÖ   r�   r/   r/   r0   r’   Õ  r“   z1CRLDistributionPoints.__init__.<locals>.<genexpr>ú?distribution_points must be a list of DistributionPoint objects©r”   r•   rd   Ú_distribution_points©r7   rÕ   r/   r/   r0   rG   Ñ  ó   ÿÿ
zCRLDistributionPoints.__init__rÚ   c                 C   rh   )Nz<CRLDistributionPoints({})>©r`   rÚ   r6   r/   r/   r0   ri   ã  rj   zCRLDistributionPoints.__repr__c                 C   rz   r3   )r   rÔ   r{   rÚ   r|   r/   r/   r0   r~   æ  r   zCRLDistributionPoints.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   ì  r^   zCRLDistributionPoints.__ne__c                 C   r»   r3   ©r„   r£   rÚ   r6   r/   r/   r0   r…   ï  r;   zCRLDistributionPoints.__hash__N)rM   rN   rO   r   ÚCRL_DISTRIBUTION_POINTSrD   rk   r¨   rG   r@   rm   rn   ro   ri   r~   r�   r…   r/   r/   r/   r0   rÔ   Î  ó    
ÿ
ÿrÔ   c                   @   r®   )ÚFreshestCRLrÕ   rÖ   c                 C   r²   )Nc                 s   r�   r3   r×   r�   r/   r/   r0   r’   ú  r“   z'FreshestCRL.__init__.<locals>.<genexpr>rØ   rÙ   rÛ   r/   r/   r0   rG   ö  rÜ   zFreshestCRL.__init__rÚ   c                 C   rh   )Nz<FreshestCRL({})>rÝ   r6   r/   r/   r0   ri     rj   zFreshestCRL.__repr__c                 C   rz   r3   )r   rá   r{   rÚ   r|   r/   r/   r0   r~     r   zFreshestCRL.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�     r^   zFreshestCRL.__ne__c                 C   r»   r3   rÞ   r6   r/   r/   r0   r…     r;   zFreshestCRL.__hash__N)rM   rN   rO   r   ÚFRESHEST_CRLrD   rk   r¨   rG   r@   rm   rn   ro   ri   r~   r�   r…   r/   r/   r/   r0   rá   ó  rà   rá   c                
   @   s˜   e Zd Zdejeje  deje dejejd  dejeje  fdd„Z	dd	„ Z
d
d„ Zdd„ Zdd„ Ze d¡Ze d¡Ze d¡Ze d¡ZdS )rÖ   Ú	full_nameÚrelative_nameÚreasonsÚReasonFlagsÚ
crl_issuerc                 C   sî   |r|rt dƒ‚|rt|ƒ}tdd„ |D ƒƒstdƒ‚|r&t|tƒs&tdƒ‚|r9t|ƒ}tdd„ |D ƒƒs9tdƒ‚|rMt|tƒrItdd„ |D ƒƒsMtd	ƒ‚|r]tj|v sYtj	|v r]t d
ƒ‚|ri|si|si|sit dƒ‚|| _
|| _|| _|| _d S )NzOYou cannot provide both full_name and relative_name, at least one must be None.c                 s   r�   r3   rŽ   r�   r/   r/   r0   r’   (  r´   z-DistributionPoint.__init__.<locals>.<genexpr>z/full_name must be a list of GeneralName objectsz1relative_name must be a RelativeDistinguishedNamec                 s   r�   r3   rŽ   r�   r/   r/   r0   r’   5  r´   z2crl_issuer must be None or a list of general namesc                 s   r�   r3   ©r   ræ   r�   r/   r/   r0   r’   <  r´   z0reasons must be None or frozenset of ReasonFlagszLunspecified and remove_from_crl are not valid reasons in a DistributionPointzPYou must supply crl_issuer, full_name, or relative_name when reasons is not None)r%   r”   r•   rd   r   r   Ú	frozensetræ   ÚunspecifiedÚremove_from_crlÚ
_full_nameÚ_relative_nameÚ_reasonsÚ_crl_issuer)r7   rã   rä   rå   rç   r/   r/   r0   rG     sR   ÿÿ
ÿÿÿþ

ÿÿ
zDistributionPoint.__init__c                 C   r    )Nz}<DistributionPoint(full_name={0.full_name}, relative_name={0.relative_name}, reasons={0.reasons}, crl_issuer={0.crl_issuer})>r¡   r6   r/   r/   r0   ri   T  ó   ýzDistributionPoint.__repr__c                 C   s>   t |tƒstS | j|jko| j|jko| j|jko| j|jkS r3   )r   rÖ   r{   rã   rä   rå   rç   r|   r/   r/   r0   r~   [  s   

ÿ
þ
üzDistributionPoint.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   f  r^   zDistributionPoint.__ne__c                 C   sH   | j d urt| j ƒ}nd }| jd urt| jƒ}nd }t|| j| j|fƒS r3   )rã   r£   rç   r„   rä   rå   )r7   Úfnrç   r/   r/   r0   r…   i  s   

zDistributionPoint.__hash__rì   rí   rî   rï   N)rM   rN   rO   rk   r¦   r¨   r   r   Ú	FrozenSetrG   ri   r~   r�   r…   r   r‡   rã   rä   rå   rç   r/   r/   r/   r0   rÖ     s$    þýü
û;


rÖ   c                   @   s4   e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdS )ræ   rê   ÚkeyCompromiseÚcACompromiseÚaffiliationChangedÚ
supersededÚcessationOfOperationÚcertificateHoldÚprivilegeWithdrawnÚaACompromiseÚremoveFromCRLN)rM   rN   rO   rê   Úkey_compromiseÚca_compromiseÚaffiliation_changedrö   Úcessation_of_operationÚcertificate_holdÚprivilege_withdrawnÚaa_compromiserë   r/   r/   r/   r0   ræ   |  s    ræ   c                   @   sd   e Zd ZejZdeje deje fdd„Z	dd„ Z
dd„ Zd	d
„ Zdd„ Ze d¡Ze d¡ZdS )ÚPolicyConstraintsÚrequire_explicit_policyÚinhibit_policy_mappingc                 C   s\   |d urt |tƒstdƒ‚|d urt |tƒstdƒ‚|d u r&|d u r&tdƒ‚|| _|| _d S )Nz>require_explicit_policy must be a non-negative integer or Nonez=inhibit_policy_mapping must be a non-negative integer or NonezSAt least one of require_explicit_policy and inhibit_policy_mapping must not be None)r   rv   rd   r%   Ú_require_explicit_policyÚ_inhibit_policy_mapping)r7   r  r  r/   r/   r0   rG   Œ  s$   
ÿÿ
ÿÿÿ
zPolicyConstraints.__init__c                 C   r    )Nz{<PolicyConstraints(require_explicit_policy={0.require_explicit_policy}, inhibit_policy_mapping={0.inhibit_policy_mapping})>r¡   r6   r/   r/   r0   ri   ©  rð   zPolicyConstraints.__repr__c                 C   rÆ   r3   )r   r  r{   r  r  r|   r/   r/   r0   r~   °  rÇ   zPolicyConstraints.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   ¹  r^   zPolicyConstraints.__ne__c                 C   rÈ   r3   )r„   r  r  r6   r/   r/   r0   r…   ¼  s   
ÿzPolicyConstraints.__hash__r  r  N)rM   rN   rO   r   ÚPOLICY_CONSTRAINTSrD   rk   r¦   rv   rG   ri   r~   r�   r…   r   r‡   r  r  r/   r/   r/   r0   r  ‰  s"    þ
ý	ÿÿr  c                   @   r®   )ÚCertificatePoliciesÚpoliciesÚPolicyInformationc                 C   r²   )Nc                 s   r�   r3   )r   r  r�   r/   r/   r0   r’   Î  r´   z/CertificatePolicies.__init__.<locals>.<genexpr>z;Every item in the policies list must be a PolicyInformation)r”   r•   rd   Ú	_policies)r7   r
  r/   r/   r0   rG   Ì  r¹   zCertificatePolicies.__init__r  c                 C   rh   )Nz<CertificatePolicies({})>)r`   r  r6   r/   r/   r0   ri   Ø  rj   zCertificatePolicies.__repr__c                 C   rz   r3   )r   r	  r{   r  r|   r/   r/   r0   r~   Û  r   zCertificatePolicies.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   á  r^   zCertificatePolicies.__ne__c                 C   r»   r3   )r„   r£   r  r6   r/   r/   r0   r…   ä  r;   zCertificatePolicies.__hash__N)rM   rN   rO   r   ÚCERTIFICATE_POLICIESrD   rk   r¨   rG   r@   rm   rn   ro   ri   r~   r�   r…   r/   r/   r/   r0   r	  É  r¾   r	  c                   @   sh   e Zd Zdedejejejedf   fdd„Z	dd„ Z
dd	„ Zd
d„ Zdd„ Ze d¡Ze d¡ZdS )r  Úpolicy_identifierÚpolicy_qualifiersÚ
UserNoticec                 C   sH   t |tƒs	tdƒ‚|| _|rt|ƒ}tdd„ |D ƒƒstdƒ‚|| _d S )Nz-policy_identifier must be an ObjectIdentifierc                 s   s   � | ]
}t |ttfƒV  qd S r3   )r   rP   r  r�   r/   r/   r0   r’   ÷  s   € 
ÿz-PolicyInformation.__init__.<locals>.<genexpr>zMpolicy_qualifiers must be a list of strings and/or UserNotice objects or None)r   r   rd   Ú_policy_identifierr”   r•   Ú_policy_qualifiers)r7   r  r  r/   r/   r0   rG   é  s   
ÿÿ
zPolicyInformation.__init__c                 C   r    )Nze<PolicyInformation(policy_identifier={0.policy_identifier}, policy_qualifiers={0.policy_qualifiers})>r¡   r6   r/   r/   r0   ri     rÅ   zPolicyInformation.__repr__c                 C   rÆ   r3   )r   r  r{   r  r  r|   r/   r/   r0   r~     rÇ   zPolicyInformation.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�     r^   zPolicyInformation.__ne__c                 C   s(   | j d urt| j ƒ}nd }t| j|fƒS r3   )r  r£   r„   r  )r7   Úpqr/   r/   r0   r…     s   
zPolicyInformation.__hash__r  r  N)rM   rN   rO   r   rk   r¦   r¨   ÚUnionrP   rG   ri   r~   r�   r…   r   r‡   r  r  r/   r/   r/   r0   r  è  s    þÿ
ý	
r  c                   @   s^   e Zd Zdejd deje fdd„Zdd„ Zdd	„ Zd
d„ Z	dd„ Z
e d¡Ze d¡ZdS )r  Únotice_referenceÚNoticeReferenceÚexplicit_textc                 C   s&   |rt |tƒstdƒ‚|| _|| _d S )Nz2notice_reference must be None or a NoticeReference)r   r  rd   Ú_notice_referenceÚ_explicit_text)r7   r  r  r/   r/   r0   rG      s   ÿÿ
zUserNotice.__init__c                 C   r    )NzV<UserNotice(notice_reference={0.notice_reference}, explicit_text={0.explicit_text!r})>r¡   r6   r/   r/   r0   ri   /  rÅ   zUserNotice.__repr__c                 C   rÆ   r3   )r   r  r{   r  r  r|   r/   r/   r0   r~   5  rÇ   zUserNotice.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   >  r^   zUserNotice.__ne__c                 C   rÈ   r3   )r„   r  r  r6   r/   r/   r0   r…   A  rÉ   zUserNotice.__hash__r  r  N)rM   rN   rO   rk   r¦   rP   rG   ri   r~   r�   r…   r   r‡   r  r  r/   r/   r/   r0   r    s    þ
ý	
r  c                   @   s^   e Zd Zdeje deje fdd„Zdd„ Z	dd„ Z
d	d
„ Zdd„ Ze d¡Ze d¡ZdS )r  ÚorganizationÚnotice_numbersc                 C   s2   || _ t|ƒ}tdd„ |D ƒƒstdƒ‚|| _d S )Nc                 s   r�   r3   )r   rv   r�   r/   r/   r0   r’   P  r´   z+NoticeReference.__init__.<locals>.<genexpr>z)notice_numbers must be a list of integers)Ú_organizationr”   r•   rd   Ú_notice_numbers)r7   r  r  r/   r/   r0   rG   I  s
   
zNoticeReference.__init__c                 C   r    )NzU<NoticeReference(organization={0.organization!r}, notice_numbers={0.notice_numbers})>r¡   r6   r/   r/   r0   ri   U  rÅ   zNoticeReference.__repr__c                 C   rÆ   r3   )r   r  r{   r  r  r|   r/   r/   r0   r~   [  rÇ   zNoticeReference.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   d  r^   zNoticeReference.__ne__c                 C   s   t | jt| jƒfƒS r3   )r„   r  r£   r  r6   r/   r/   r0   r…   g  ó   zNoticeReference.__hash__r  r  N)rM   rN   rO   rk   r¦   rP   r¨   rv   rG   ri   r~   r�   r…   r   r‡   r  r  r/   r/   r/   r0   r  H  s    þ
ý	
r  c                   @   óT   e Zd ZejZdeje fdd„Z	e
dƒ\ZZZdd„ Zdd„ Zd	d
„ Zdd„ ZdS )ÚExtendedKeyUsageÚusagesc                 C   r²   )Nc                 s   r�   r3   )r   r   r�   r/   r/   r0   r’   s  r´   z,ExtendedKeyUsage.__init__.<locals>.<genexpr>z9Every item in the usages list must be an ObjectIdentifier)r”   r•   rd   Ú_usages)r7   r!  r/   r/   r0   rG   q  s   ÿ
zExtendedKeyUsage.__init__r"  c                 C   rh   )Nz<ExtendedKeyUsage({})>)r`   r"  r6   r/   r/   r0   ri   |  rj   zExtendedKeyUsage.__repr__c                 C   rz   r3   )r   r   r{   r"  r|   r/   r/   r0   r~     r   zExtendedKeyUsage.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   …  r^   zExtendedKeyUsage.__ne__c                 C   r»   r3   )r„   r£   r"  r6   r/   r/   r0   r…   ˆ  r;   zExtendedKeyUsage.__hash__N)rM   rN   rO   r   ÚEXTENDED_KEY_USAGErD   rk   r¨   r   rG   r@   rm   rn   ro   ri   r~   r�   r…   r/   r/   r/   r0   r   n  s    	r   c                   @   ó2   e Zd ZejZdd„ Zdd„ Zdd„ Zdd„ Z	d	S )
ÚOCSPNoCheckc                 C   ó   t |tƒstS dS ©NT)r   r%  r{   r|   r/   r/   r0   r~   �  ó   
zOCSPNoCheck.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   •  r^   zOCSPNoCheck.__ne__c                 C   ó   t tƒS r3   )r„   r%  r6   r/   r/   r0   r…   ˜  ó   zOCSPNoCheck.__hash__c                 C   rU   )Nz<OCSPNoCheck()>r/   r6   r/   r/   r0   ri   ›  ó   zOCSPNoCheck.__repr__N)
rM   rN   rO   r   ÚOCSP_NO_CHECKrD   r~   r�   r…   ri   r/   r/   r/   r0   r%  Œ  ó    r%  c                   @   r$  )
ÚPrecertPoisonc                 C   r&  r'  )r   r.  r{   r|   r/   r/   r0   r~   ¢  r(  zPrecertPoison.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   ¨  r^   zPrecertPoison.__ne__c                 C   r)  r3   )r„   r.  r6   r/   r/   r0   r…   «  r*  zPrecertPoison.__hash__c                 C   rU   )Nz<PrecertPoison()>r/   r6   r/   r/   r0   ri   ®  r+  zPrecertPoison.__repr__N)
rM   rN   rO   r   ÚPRECERT_POISONrD   r~   r�   r…   ri   r/   r/   r/   r0   r.  Ÿ  r-  r.  c                   @   r®   )Ú
TLSFeatureÚfeaturesÚTLSFeatureTypec                 C   s8   t |ƒ}tdd„ |D ƒƒrt|ƒdkrtdƒ‚|| _d S )Nc                 s   r�   r3   )r   r2  r�   r/   r/   r0   r’   ¸  r´   z&TLSFeature.__init__.<locals>.<genexpr>r   z@features must be a list of elements from the TLSFeatureType enum)r”   r•   r4   rd   Ú	_features)r7   r1  r/   r/   r0   rG   µ  s   ÿÿ
zTLSFeature.__init__r3  c                 C   r    )Nz$<TLSFeature(features={0._features})>r¡   r6   r/   r/   r0   ri   Ä  r^   zTLSFeature.__repr__c                 C   rz   r3   )r   r0  r{   r3  r|   r/   r/   r0   r~   Ç  r   zTLSFeature.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   Í  r^   zTLSFeature.__ne__c                 C   r»   r3   )r„   r£   r3  r6   r/   r/   r0   r…   Ð  r;   zTLSFeature.__hash__N)rM   rN   rO   r   ÚTLS_FEATURErD   rk   r¨   rG   r@   rm   rn   ro   ri   r~   r�   r…   r/   r/   r/   r0   r0  ²  s    r0  c                   @   s   e Zd ZdZdZdS )r2  é   é   N)rM   rN   rO   Ústatus_requestÚstatus_request_v2r/   r/   r/   r0   r2  Ô  s    r2  c                 C   s   i | ]}|j |“qS r/   ©re   r�   r/   r/   r0   Ú
<dictcomp>ß  ó    r:  c                   @   rp   )ÚInhibitAnyPolicyÚ
skip_certsc                 C   s,   t |tƒs	tdƒ‚|dk rtdƒ‚|| _d S )Nzskip_certs must be an integerr   z)skip_certs must be a non-negative integer)r   rv   rd   r%   Ú_skip_certs)r7   r=  r/   r/   r0   rG   å  s
   

zInhibitAnyPolicy.__init__c                 C   r    )Nz-<InhibitAnyPolicy(skip_certs={0.skip_certs})>r¡   r6   r/   r/   r0   ri   î  r^   zInhibitAnyPolicy.__repr__c                 C   rz   r3   )r   r<  r{   r=  r|   r/   r/   r0   r~   ñ  r   zInhibitAnyPolicy.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   ÷  r^   zInhibitAnyPolicy.__ne__c                 C   r‚   r3   )r„   r=  r6   r/   r/   r0   r…   ú  r^   zInhibitAnyPolicy.__hash__r>  N)rM   rN   rO   r   ÚINHIBIT_ANY_POLICYrD   rv   rG   ri   r~   r�   r…   r   r‡   r=  r/   r/   r/   r0   r<  â  s    	r<  c                   @   s¾   e Zd ZejZdedededededededed	efd
d„Ze 	d¡Z
e 	d¡Ze 	d¡Ze 	d¡Ze 	d¡Ze 	d¡Ze 	d¡Zedd„ ƒZedd„ ƒZdd„ Zdd„ Zdd„ Zdd„ ZdS ) ÚKeyUsageÚdigital_signatureÚcontent_commitmentÚkey_enciphermentÚdata_enciphermentÚkey_agreementÚkey_cert_signÚcrl_signÚencipher_onlyÚdecipher_onlyc
           
      C   sN   |s
|s|	r
t dƒ‚|| _|| _|| _|| _|| _|| _|| _|| _|	| _	d S )NzKencipher_only and decipher_only can only be true when key_agreement is true)
r%   Ú_digital_signatureÚ_content_commitmentÚ_key_enciphermentÚ_data_enciphermentÚ_key_agreementÚ_key_cert_signÚ	_crl_signÚ_encipher_onlyÚ_decipher_only)
r7   rA  rB  rC  rD  rE  rF  rG  rH  rI  r/   r/   r0   rG     s   ÿ
zKeyUsage.__init__rJ  rK  rL  rM  rN  rO  rP  c                 C   ó   | j stdƒ‚| jS )Nz7encipher_only is undefined unless key_agreement is true)rE  r%   rQ  r6   r/   r/   r0   rH  '  ó
   ÿzKeyUsage.encipher_onlyc                 C   rS  )Nz7decipher_only is undefined unless key_agreement is true)rE  r%   rR  r6   r/   r/   r0   rI  0  rT  zKeyUsage.decipher_onlyc                 C   s:   z| j }| j}W n ty   d}d}Y nw d | ||¡S )NFa-  <KeyUsage(digital_signature={0.digital_signature}, content_commitment={0.content_commitment}, key_encipherment={0.key_encipherment}, data_encipherment={0.data_encipherment}, key_agreement={0.key_agreement}, key_cert_sign={0.key_cert_sign}, crl_sign={0.crl_sign}, encipher_only={1}, decipher_only={2})>)rH  rI  r%   r`   )r7   rH  rI  r/   r/   r0   ri   9  s   
û
øzKeyUsage.__repr__c                 C   sz   t |tƒstS | j|jko<| j|jko<| j|jko<| j|jko<| j|jko<| j|jko<| j	|j	ko<| j
|j
ko<| j|jkS r3   )r   r@  r{   rA  rB  rC  rD  rE  rF  rG  rQ  rR  r|   r/   r/   r0   r~   N  s&   

ÿ
þ
ý
ü
û
ú
ù
÷zKeyUsage.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   ^  r^   zKeyUsage.__ne__c              
   C   s,   t | j| j| j| j| j| j| j| j| j	f	ƒS r3   )
r„   rA  rB  rC  rD  rE  rF  rG  rQ  rR  r6   r/   r/   r0   r…   a  s   ÷ÿzKeyUsage.__hash__N)rM   rN   rO   r   Ú	KEY_USAGErD   rÍ   rG   r   r‡   rA  rB  rC  rD  rE  rF  rG  ÚpropertyrH  rI  ri   r~   r�   r…   r/   r/   r/   r0   r@     sH    þýüûúùø	÷

ö








r@  c                   @   sx   e Zd ZejZdejeje	  dejeje	  fdd„Z
dd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Ze d¡Ze d¡ZdS )ÚNameConstraintsÚpermitted_subtreesÚexcluded_subtreesc                 C   s�   |d urt |ƒ}tdd„ |D ƒƒstdƒ‚|  |¡ |d ur4t |ƒ}tdd„ |D ƒƒs/tdƒ‚|  |¡ |d u r@|d u r@tdƒ‚|| _|| _d S )Nc                 s   r�   r3   rŽ   r�   r/   r/   r0   r’   {  r´   z+NameConstraints.__init__.<locals>.<genexpr>z@permitted_subtrees must be a list of GeneralName objects or Nonec                 s   r�   r3   rŽ   r�   r/   r/   r0   r’   …  r´   z?excluded_subtrees must be a list of GeneralName objects or NonezIAt least one of permitted_subtrees and excluded_subtrees must not be None)r”   r•   rd   Ú_validate_ip_namer%   Ú_permitted_subtreesÚ_excluded_subtrees)r7   rX  rY  r/   r/   r0   rG   t  s(   ÿ
ÿ
ÿ
zNameConstraints.__init__c                 C   rÆ   r3   )r   rW  r{   rY  rX  r|   r/   r/   r0   r~   –  rÇ   zNameConstraints.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   Ÿ  r^   zNameConstraints.__ne__c                 C   s   t dd„ |D ƒƒrtdƒ‚d S )Nc                 s   s0   � | ]}t |tƒot |jtjtjfƒ V  qd S r3   )r   r   re   Ú	ipaddressÚIPv4NetworkÚIPv6Network)r�   Únamer/   r/   r0   r’   £  s   € 
üÿ
þz4NameConstraints._validate_ip_name.<locals>.<genexpr>zGIPAddress name constraints must be an IPv4Network or IPv6Network object)Úanyrd   )r7   Útreer/   r/   r0   rZ  ¢  s   ûÿùz!NameConstraints._validate_ip_namec                 C   r    )Nze<NameConstraints(permitted_subtrees={0.permitted_subtrees}, excluded_subtrees={0.excluded_subtrees})>r¡   r6   r/   r/   r0   ri   ¯  rÅ   zNameConstraints.__repr__c                 C   s@   | j d urt| j ƒ}nd }| jd urt| jƒ}nd }t||fƒS r3   )rX  r£   rY  r„   )r7   ÚpsÚesr/   r/   r0   r…   µ  s   

zNameConstraints.__hash__r[  r\  N)rM   rN   rO   r   ÚNAME_CONSTRAINTSrD   rk   r¦   r¨   r   rG   r~   r�   rZ  ri   r…   r   r‡   rX  rY  r/   r/   r/   r0   rW  q  s    þ
ý"	
rW  c                   @   s`   e Zd Zdededefdd„Ze d¡Z	e d¡Z
e d¡Zd	d
„ Zdd„ Zdd„ Zdd„ ZdS )r[   rD   Úcriticalre   c                 C   s:   t |tƒs	tdƒ‚t |tƒstdƒ‚|| _|| _|| _d S )Nz2oid argument must be an ObjectIdentifier instance.z critical must be a boolean value)r   r   rd   rÍ   Ú_oidÚ	_criticalÚ_value)r7   rD   rf  re   r/   r/   r0   rG   Ç  s   
ÿ

zExtension.__init__rg  rh  ri  c                 C   r    )Nz@<Extension(oid={0.oid}, critical={0.critical}, value={0.value})>r¡   r6   r/   r/   r0   ri   Ú  rð   zExtension.__repr__c                 C   r¢   r3   )r   r[   r{   rD   rf  re   r|   r/   r/   r0   r~   à  s   

ÿ
ýzExtension.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   ê  r^   zExtension.__ne__c                 C   s   t | j| j| jfƒS r3   )r„   rD   rf  re   r6   r/   r/   r0   r…   í  r  zExtension.__hash__N)rM   rN   rO   r   rÍ   rT   rG   r   r‡   rD   rf  re   ri   r~   r�   r…   r/   r/   r/   r0   r[   Æ  s    ÿÿ
ÿ



r[   c                   @   sb   e Zd Zdeje fdd„Zedƒ\ZZ	Z
deje fdd„Zdd	„ Zd
d„ Zdd„ Zdd„ ZdS )ÚGeneralNamesÚgeneral_namesc                 C   r²   )Nc                 s   r�   r3   rŽ   r�   r/   r/   r0   r’   ô  r´   z(GeneralNames.__init__.<locals>.<genexpr>z^Every item in the general_names list must be an object conforming to the GeneralName interface)r”   r•   rd   Ú_general_names©r7   rk  r/   r/   r0   rG   ò  r¹   zGeneralNames.__init__rl  Útypec                    s0   ‡ fdd„| D ƒ}ˆ t krdd„ |D ƒ}t|ƒS )Nc                 3   s   � | ]
}t |ˆ ƒr|V  qd S r3   )r   ©r�   Úi©rn  r/   r0   r’     s   € z3GeneralNames.get_values_for_type.<locals>.<genexpr>c                 s   s   � | ]}|j V  qd S r3   r9  ro  r/   r/   r0   r’     s   € )r   r”   )r7   rn  Úobjsr/   rq  r0   Úget_values_for_typeþ  s   z GeneralNames.get_values_for_typec                 C   rh   )Nz<GeneralNames({})>©r`   rl  r6   r/   r/   r0   ri     rj   zGeneralNames.__repr__c                 C   rz   r3   )r   rj  r{   rl  r|   r/   r/   r0   r~   
  r   zGeneralNames.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�     r^   zGeneralNames.__ne__c                 C   r»   r3   )r„   r£   rl  r6   r/   r/   r0   r…     r;   zGeneralNames.__hash__N)rM   rN   rO   rk   r¨   r   rG   r@   rm   rn   ro   ÚTypers  ri   r~   r�   r…   r/   r/   r/   r0   rj  ñ  s    
	rj  c                   @   ó\   e Zd ZejZdeje fdd„Z	e
dƒ\ZZZdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ ZdS )ÚSubjectAlternativeNamerk  c                 C   ó   t |ƒ| _d S r3   ©rj  rl  rm  r/   r/   r0   rG     r;   zSubjectAlternativeName.__init__rl  c                 C   ó   | j  |¡S r3   ©rl  rs  ©r7   rn  r/   r/   r0   rs    rj   z*SubjectAlternativeName.get_values_for_typec                 C   rh   )Nz<SubjectAlternativeName({})>rt  r6   r/   r/   r0   ri   "  rj   zSubjectAlternativeName.__repr__c                 C   rz   r3   )r   rw  r{   rl  r|   r/   r/   r0   r~   %  r   zSubjectAlternativeName.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   +  r^   zSubjectAlternativeName.__ne__c                 C   r‚   r3   ©r„   rl  r6   r/   r/   r0   r…   .  r^   zSubjectAlternativeName.__hash__N)rM   rN   rO   r   ÚSUBJECT_ALTERNATIVE_NAMErD   rk   r¨   r   rG   r@   rm   rn   ro   rs  ri   r~   r�   r…   r/   r/   r/   r0   rw    ó    rw  c                   @   rv  )ÚIssuerAlternativeNamerk  c                 C   rx  r3   ry  rm  r/   r/   r0   rG   5  r;   zIssuerAlternativeName.__init__rl  c                 C   rz  r3   r{  r|  r/   r/   r0   rs  :  rj   z)IssuerAlternativeName.get_values_for_typec                 C   rh   )Nz<IssuerAlternativeName({})>rt  r6   r/   r/   r0   ri   =  rj   zIssuerAlternativeName.__repr__c                 C   rz   r3   )r   r€  r{   rl  r|   r/   r/   r0   r~   @  r   zIssuerAlternativeName.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   F  r^   zIssuerAlternativeName.__ne__c                 C   r‚   r3   r}  r6   r/   r/   r0   r…   I  r^   zIssuerAlternativeName.__hash__N)rM   rN   rO   r   ÚISSUER_ALTERNATIVE_NAMErD   rk   r¨   r   rG   r@   rm   rn   ro   rs  ri   r~   r�   r…   r/   r/   r/   r0   r€  2  r  r€  c                   @   rv  )ÚCertificateIssuerrk  c                 C   rx  r3   ry  rm  r/   r/   r0   rG   P  r;   zCertificateIssuer.__init__rl  c                 C   rz  r3   r{  r|  r/   r/   r0   rs  U  rj   z%CertificateIssuer.get_values_for_typec                 C   rh   )Nz<CertificateIssuer({})>rt  r6   r/   r/   r0   ri   X  rj   zCertificateIssuer.__repr__c                 C   rz   r3   )r   r‚  r{   rl  r|   r/   r/   r0   r~   [  r   zCertificateIssuer.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   a  r^   zCertificateIssuer.__ne__c                 C   r‚   r3   r}  r6   r/   r/   r0   r…   d  r^   zCertificateIssuer.__hash__N)rM   rN   rO   r   ÚCERTIFICATE_ISSUERrD   rk   r¨   r   rG   r@   rm   rn   ro   rs  ri   r~   r�   r…   r/   r/   r/   r0   r‚  M  r  r‚  c                   @   rp   )Ú	CRLReasonÚreasonc                 C   rs   )Nz*reason must be an element from ReasonFlags)r   ræ   rd   Ú_reason)r7   r…  r/   r/   r0   rG   k  ry   zCRLReason.__init__c                 C   rh   )Nz<CRLReason(reason={})>)r`   r†  r6   r/   r/   r0   ri   q  rj   zCRLReason.__repr__c                 C   rz   r3   )r   r„  r{   r…  r|   r/   r/   r0   r~   t  r   zCRLReason.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   z  r^   zCRLReason.__ne__c                 C   r‚   r3   )r„   r…  r6   r/   r/   r0   r…   }  r^   zCRLReason.__hash__r†  N)rM   rN   rO   r   Ú
CRL_REASONrD   ræ   rG   ri   r~   r�   r…   r   r‡   r…  r/   r/   r/   r0   r„  h  s    r„  c                   @   sL   e Zd ZejZdejfdd„Zdd„ Zdd„ Z	dd	„ Z
d
d„ Ze d¡ZdS )ÚInvalidityDateÚinvalidity_datec                 C   s   t |tjƒs
tdƒ‚|| _d S )Nz+invalidity_date must be a datetime.datetime)r   Údatetimerd   Ú_invalidity_date)r7   r‰  r/   r/   r0   rG   †  s   
zInvalidityDate.__init__c                 C   rh   )Nz$<InvalidityDate(invalidity_date={})>)r`   r‹  r6   r/   r/   r0   ri   Œ  s   ÿzInvalidityDate.__repr__c                 C   rz   r3   )r   rˆ  r{   r‰  r|   r/   r/   r0   r~   ‘  r   zInvalidityDate.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   —  r^   zInvalidityDate.__ne__c                 C   r‚   r3   )r„   r‰  r6   r/   r/   r0   r…   š  r^   zInvalidityDate.__hash__r‹  N)rM   rN   rO   r   ÚINVALIDITY_DATErD   rŠ  rG   ri   r~   r�   r…   r   r‡   r‰  r/   r/   r/   r0   rˆ  ƒ  s    rˆ  c                   @   r  )Ú)PrecertificateSignedCertificateTimestampsÚsigned_certificate_timestampsc                 C   r²   )Nc                 s   r�   r3   ©r   r   ©r�   Úsctr/   r/   r0   r’   ª  ó
   € ÿ
ÿzEPrecertificateSignedCertificateTimestamps.__init__.<locals>.<genexpr>úYEvery item in the signed_certificate_timestamps list must be a SignedCertificateTimestamp©r”   r•   rd   Ú_signed_certificate_timestamps©r7   rŽ  r/   r/   r0   rG   £  ó   þÿ
z2PrecertificateSignedCertificateTimestamps.__init__r•  c                 C   ó   d  t| ƒ¡S )Nz/<PrecertificateSignedCertificateTimestamps({})>©r`   r”   r6   r/   r/   r0   ri   ¸  s   ÿz2PrecertificateSignedCertificateTimestamps.__repr__c                 C   r»   r3   ©r„   r£   r•  r6   r/   r/   r0   r…   ½  r;   z2PrecertificateSignedCertificateTimestamps.__hash__c                 C   rz   r3   )r   r�  r{   r•  r|   r/   r/   r0   r~   À  ó   
ÿÿz0PrecertificateSignedCertificateTimestamps.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   É  r^   z0PrecertificateSignedCertificateTimestamps.__ne__N)rM   rN   rO   r   Ú%PRECERT_SIGNED_CERTIFICATE_TIMESTAMPSrD   rk   r¨   r   rG   r@   rm   rn   ro   ri   r…   r~   r�   r/   r/   r/   r0   r�     s    ÿ
þ
ÿ	r�  c                   @   r  )ÚSignedCertificateTimestampsrŽ  c                 C   r²   )Nc                 s   r�   r3   r�  r�  r/   r/   r0   r’   ×  r’  z7SignedCertificateTimestamps.__init__.<locals>.<genexpr>r“  r”  r–  r/   r/   r0   rG   Ð  r—  z$SignedCertificateTimestamps.__init__r•  c                 C   r˜  )Nz!<SignedCertificateTimestamps({})>r™  r6   r/   r/   r0   ri   å  r;   z$SignedCertificateTimestamps.__repr__c                 C   r»   r3   rš  r6   r/   r/   r0   r…   è  r;   z$SignedCertificateTimestamps.__hash__c                 C   rz   r3   )r   r�  r{   r•  r|   r/   r/   r0   r~   ë  r›  z"SignedCertificateTimestamps.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   ô  r^   z"SignedCertificateTimestamps.__ne__N)rM   rN   rO   r   ÚSIGNED_CERTIFICATE_TIMESTAMPSrD   rk   r¨   r   rG   r@   rm   rn   ro   ri   r…   r~   r�   r/   r/   r/   r0   r�  Í  s    ÿ
þ
ÿ	r�  c                   @   rp   )Ú	OCSPNonceÚnoncec                 C   rs   )Nznonce must be bytes)r   r§   rd   Ú_nonce)r7   r   r/   r/   r0   rG   û  ry   zOCSPNonce.__init__c                 C   rz   r3   )r   rŸ  r{   r   r|   r/   r/   r0   r~     r   zOCSPNonce.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�     r^   zOCSPNonce.__ne__c                 C   r‚   r3   )r„   r   r6   r/   r/   r0   r…   
  r^   zOCSPNonce.__hash__c                 C   r    )Nz<OCSPNonce(nonce={0.nonce!r})>r¡   r6   r/   r/   r0   ri     r^   zOCSPNonce.__repr__r¡  N)rM   rN   rO   r   ÚNONCErD   r§   rG   r~   r�   r…   ri   r   r‡   r   r/   r/   r/   r0   rŸ  ø  rˆ   rŸ  c                   @   s€   e Zd ZejZdd„ Zdd„ Zdd„ Zdd„ Z	d	d
„ Z
e d¡Ze d¡Ze d¡Ze d¡Ze d¡Ze d¡Ze d¡ZdS )ÚIssuingDistributionPointc           	      C   sî   |rt |tƒrtdd„ |D ƒƒstdƒ‚|r$tj|v s tj|v r$tdƒ‚t |tƒr8t |tƒr8t |tƒr8t |tƒs<tdƒ‚||||g}t	dd„ |D ƒƒdkrQtd	ƒ‚t
|||||||gƒs`td
ƒ‚|| _|| _|| _|| _|| _|| _|| _d S )Nc                 s   r�   r3   rè   r�   r/   r/   r0   r’   "  r´   z4IssuingDistributionPoint.__init__.<locals>.<genexpr>z:only_some_reasons must be None or frozenset of ReasonFlagszTunspecified and remove_from_crl are not valid reasons in an IssuingDistributionPointzuonly_contains_user_certs, only_contains_ca_certs, indirect_crl and only_contains_attribute_certs must all be boolean.c                 S   s   g | ]}|r|‘qS r/   r/   r�   r/   r/   r0   Ú
<listcomp>D  r;  z5IssuingDistributionPoint.__init__.<locals>.<listcomp>é   z‹Only one of the following can be set to True: only_contains_user_certs, only_contains_ca_certs, indirect_crl, only_contains_attribute_certszàCannot create empty extension: if only_contains_user_certs, only_contains_ca_certs, indirect_crl, and only_contains_attribute_certs are all False, then either full_name, relative_name, or only_some_reasons must have a value.)r   ré   r•   rd   ræ   rê   rë   r%   rÍ   r4   ra  Ú_only_contains_user_certsÚ_only_contains_ca_certsÚ_indirect_crlÚ_only_contains_attribute_certsÚ_only_some_reasonsrì   rí   )	r7   rã   rä   Úonly_contains_user_certsÚonly_contains_ca_certsÚonly_some_reasonsÚindirect_crlÚonly_contains_attribute_certsÚcrl_constraintsr/   r/   r0   rG     sl   
ÿþÿ

ÿÿþýüÿüÿùÿÿ
z!IssuingDistributionPoint.__init__c                 C   r    )NaG  <IssuingDistributionPoint(full_name={0.full_name}, relative_name={0.relative_name}, only_contains_user_certs={0.only_contains_user_certs}, only_contains_ca_certs={0.only_contains_ca_certs}, only_some_reasons={0.only_some_reasons}, indirect_crl={0.indirect_crl}, only_contains_attribute_certs={0.only_contains_attribute_certs})>r¡   r6   r/   r/   r0   ri   f  s   øz!IssuingDistributionPoint.__repr__c                 C   sb   t |tƒstS | j|jko0| j|jko0| j|jko0| j|jko0| j|jko0| j|jko0| j	|j	kS r3   )
r   r£  r{   rã   rä   r«  r¬  r­  r®  r¯  r|   r/   r/   r0   r~   r  s"   

ÿ
þ
ý
ü
ûÿùzIssuingDistributionPoint.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   �  r^   zIssuingDistributionPoint.__ne__c                 C   s$   t | j| j| j| j| j| j| jfƒS r3   )r„   rã   rä   r«  r¬  r­  r®  r¯  r6   r/   r/   r0   r…   „  s   ùÿz!IssuingDistributionPoint.__hash__rì   rí   r¦  r§  rª  r¨  r©  N)rM   rN   rO   r   ÚISSUING_DISTRIBUTION_POINTrD   rG   ri   r~   r�   r…   r   r‡   rã   rä   r«  r¬  r­  r®  r¯  r/   r/   r/   r0   r£    s(    P

ÿÿ

ÿr£  c                   @   sR   e Zd Zdedefdd„Ze d¡Ze d¡Z	dd„ Z
d	d
„ Zdd„ Zdd„ ZdS )rc   rD   re   c                 C   s"   t |tƒs	tdƒ‚|| _|| _d S )Nzoid must be an ObjectIdentifier)r   r   rd   rg  ri  )r7   rD   re   r/   r/   r0   rG   ¡  s   

zUnrecognizedExtension.__init__rg  ri  c                 C   r    )Nz7<UnrecognizedExtension(oid={0.oid}, value={0.value!r})>r¡   r6   r/   r/   r0   ri   ª  rÅ   zUnrecognizedExtension.__repr__c                 C   rÆ   r3   )r   rc   r{   rD   re   r|   r/   r/   r0   r~   °  rÐ   zUnrecognizedExtension.__eq__c                 C   r€   r3   r/   r|   r/   r/   r0   r�   ¶  r^   zUnrecognizedExtension.__ne__c                 C   rÈ   r3   )r„   rD   re   r6   r/   r/   r0   r…   ¹  rÉ   zUnrecognizedExtension.__hash__N)rM   rN   rO   r   r§   rG   r   r‡   rD   re   ri   r~   r�   r…   r/   r/   r/   r0   rc      s    

rc   )SrV   rŠ  r'   r]  rk   Úcryptographyr   Úcryptography.hazmat._derr   r   r   r   Úcryptography.hazmat._typesr   Úcryptography.hazmat.primitivesr   r	   Ú,cryptography.hazmat.primitives.asymmetric.ecr
   Ú-cryptography.hazmat.primitives.asymmetric.rsar   Ú*cryptography.x509.certificate_transparencyr   Úcryptography.x509.general_namer   r   r   Úcryptography.x509.namer   Úcryptography.x509.oidr   r   r   r   r§   r1   r@   Ú	ExceptionrB   rS   ÚABCMetarT   ÚobjectrY   rq   r‰   rž   r¯   r¿   r±   rÊ   rÒ   rÔ   rá   rÖ   ÚEnumræ   r  r	  r  r  r  r   r%  r.  r0  r2  Ú_TLS_FEATURE_TYPE_TO_ENUMr<  r@  rW  r[   rj  rw  r€  r‚  r„  rˆ  r�  r�  rŸ  r£  rc   r/   r/   r/   r0   Ú<module>   sx   (!_&)%%d@7)&"qU+&-+ 