o
    h~)                    @  s  d dl mZ 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
 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mZ d d
lmZ d dlmZmZmZmZmZmZm Z m!Z!m"Z" d dl#m$Z$m%Z% d dl&m'Z'm(Z(m)Z)m*Z* ej+ddddZ,dddZ-dddZ.G dd de/Z0G dd de/Z1G d d dej2d!Z3G d"d# d#Z4G d$d% d%e3Z5G d&d' d'e3Z6G d(d) d)e3Z7G d*d+ d+e3Z8G d,d- d-e3Z9G d.d/ d/Z:G d0d1 d1e3Z;G d2d3 d3e3Z<G d4d5 d5e3Z=G d6d7 d7e3Z>G d8d9 d9Z?G d:d; d;ej@ZAeAjBeAjCeAjDeAjEeAjFeAjGeAjHeAjId<ZJeAjBd=eAjCd>eAjDd?eAjEd@eAjFdAeAjGdBeAjHdCeAjIdDiZKeAjLd eAjBd=eAjCd>eAjDd?eAjEd@eAjFdAeAjGdBeAjMdDeAjHdEeAjIdFi
ZNG dGdH dHe3ZOG dIdJ dJe3ZPG dKdL dLZQG dMdN dNZRG dOdP dPZSG dQdR dRe3ZTG dSdT dTe3ZUG dUdV dVe3ZVG dWdX dXe3ZWG dYdZ dZej@ZXd[d\ eXD ZYG d]d^ d^e3ZZG d_d` d`e3Z[G dadb dbe3Z\G dcdd ddej]e, Z^G dedf dfZ_G dgdh dhe3Z`G didj dje3ZaG dkdl dle3ZbG dmdn dne3ZcG dodp dpe3ZdG dqdr dre3ZeG dsdt dte3ZfG dudv dve3ZgG dwdx dxe3ZhG dydz dze3ZiG d{d| d|e3ZjG d}d~ d~ZkG dd dZlG dd dZmG dd de3ZnG dd de3ZodS )    )annotationsN)utils)asn1)x509)constant_timeserialization)EllipticCurvePublicKey)RSAPublicKey)CertificateIssuerPublicKeyTypesCertificatePublicKeyTypes)SignedCertificateTimestamp)	DirectoryNameDNSNameGeneralName	IPAddress	OtherNameRegisteredID
RFC822NameUniformResourceIdentifier_IPAddressTypes)NameRelativeDistinguishedName)CRLEntryExtensionOIDExtensionOIDObjectIdentifierOCSPExtensionOIDExtensionTypeVarExtensionTypeT)bound	covariant
public_keyr   returnbytesc                 C  sl   t | tr| tjjtjj}nt | tr | tjj	tjj
}n| tjjtjj}t|}t| S N)
isinstancer	   public_bytesr   ZEncodingZDERZPublicFormatZPKCS1r   ZX962ZUncompressedPointZSubjectPublicKeyInfor   Zparse_spki_for_datahashlibsha1digest)r    dataZ
serialized r*   O/var/www/html/venv/lib/python3.10/site-packages/cryptography/x509/extensions.py_key_identifier_from_public_key2   s    


r,   
field_namestrc                   s0   d	 fdd} fdd} fdd}|||fS )
Nr!   intc                      t t|  S r#   )lengetattrselfr-   r*   r+   
len_methodK      z*_make_sequence_methods.<locals>.len_methodc                   r0   r#   )iterr2   r3   r5   r*   r+   iter_methodN   r7   z+_make_sequence_methods.<locals>.iter_methodc                   s   t |  | S r#   )r2   )r4   idxr5   r*   r+   getitem_methodQ   r7   z._make_sequence_methods.<locals>.getitem_methodr!   r/   r*   )r-   r6   r9   r;   r*   r5   r+   _make_sequence_methodsJ   s   
r=   c                         e Zd Zd	 fddZ  ZS )
DuplicateExtensionmsgr.   oidr   r!   Nonec                      t  | || _d S r#   super__init__rA   r4   r@   rA   	__class__r*   r+   rF   X      
zDuplicateExtension.__init__r@   r.   rA   r   r!   rB   __name__
__module____qualname__rF   __classcell__r*   r*   rH   r+   r?   W       r?   c                      r>   )
ExtensionNotFoundr@   r.   rA   r   r!   rB   c                   rC   r#   rD   rG   rH   r*   r+   rF   ^   rJ   zExtensionNotFound.__init__rK   rL   r*   r*   rH   r+   rR   ]   rQ   rR   c                   @  s    e Zd ZU ded< dddZdS )	r   z!typing.ClassVar[ObjectIdentifier]rA   r!   r"   c                 C  s   t d| )z7
        Serializes the extension type to DER.
        z3public_bytes is not implemented for extension type )NotImplementedErrorr3   r*   r*   r+   r%   f   s   zExtensionType.public_bytesNr!   r"   )rM   rN   rO   __annotations__r%   r*   r*   r*   r+   r   c   s   
 )	metaclassc                   @  sB   e Zd ZdddZdd
dZdddZed\ZZZ	dddZ
dS )
Extensions
extensions)typing.Iterable[Extension[ExtensionType]]r!   rB   c                 C     t || _d S r#   )list_extensions)r4   rX   r*   r*   r+   rF   p   s   zExtensions.__init__rA   r   Extension[ExtensionType]c                 C  s.   | D ]}|j |kr|  S qtd| d|)NNo  extension was found)rA   rR   )r4   rA   extr*   r*   r+   get_extension_for_oidu   s
   
z Extensions.get_extension_for_oidextclasstype[ExtensionTypeVar]Extension[ExtensionTypeVar]c                 C  sB   |t u rtd| D ]}t|j|r|  S q
td| 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^   r_   )UnrecognizedExtension	TypeErrorr$   valuerR   rA   )r4   rb   r`   r*   r*   r+   get_extension_for_class~   s   z"Extensions.get_extension_for_classr\   r.   c                 C     d| j  dS )Nz<Extensions()>)r\   r3   r*   r*   r+   __repr__   r7   zExtensions.__repr__N)rX   rY   r!   rB   )rA   r   r!   r]   )rb   rc   r!   rd   r!   r.   )rM   rN   rO   rF   ra   rh   r=   __len____iter____getitem__rk   r*   r*   r*   r+   rW   o   s    


	rW   c                   @  sR   e Zd ZejZdddZdd
dZdddZdddZ	e
dddZdddZdS )	CRLNumber
crl_numberr/   r!   rB   c                 C     t |ts	td|| _d S Nzcrl_number must be an integerr$   r/   rf   _crl_numberr4   rq   r*   r*   r+   rF         

zCRLNumber.__init__otherobjectboolc                 C     t |tstS | j|jkS r#   )r$   rp   NotImplementedrq   r4   rx   r*   r*   r+   __eq__      
zCRLNumber.__eq__c                 C  
   t | jS r#   hashrq   r3   r*   r*   r+   __hash__      
zCRLNumber.__hash__r.   c                 C  ri   )Nz<CRLNumber(rj   rq   r3   r*   r*   r+   rk      r7   zCRLNumber.__repr__c                 C     | j S r#   ru   r3   r*   r*   r+   rq         zCRLNumber.crl_numberr"   c                 C  
   t | S r#   	rust_x509Zencode_extension_valuer3   r*   r*   r+   r%      r   zCRLNumber.public_bytesNrq   r/   r!   rB   rx   ry   r!   rz   r<   rl   rT   )rM   rN   rO   r   Z
CRL_NUMBERrA   rF   r~   r   rk   propertyrq   r%   r*   r*   r*   r+   rp          



rp   c                   @  s   e Zd ZejZd)d	d
Zed*ddZed+ddZ	d,ddZ
d-ddZd.ddZed/ddZed0d!d"Zed1d#d$Zd2d&d'Zd(S )3AuthorityKeyIdentifierkey_identifierbytes | Noneauthority_cert_issuer#typing.Iterable[GeneralName] | Noneauthority_cert_serial_number
int | Noner!   rB   c                 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 r#   r$   r   .0xr*   r*   r+   	<genexpr>       

z2AuthorityKeyIdentifier.__init__.<locals>.<genexpr>z;authority_cert_issuer must be a list of GeneralName objectsz/authority_cert_serial_number must be an integer)	
ValueErrorr[   allrf   r$   r/   _key_identifier_authority_cert_issuer_authority_cert_serial_number)r4   r   r   r   r*   r*   r+   rF      s*   

zAuthorityKeyIdentifier.__init__r    r
   c                 C  s   t |}| |d d dS Nr   r   r   r,   )clsr    r(   r*   r*   r+   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*   r+   "from_issuer_subject_key_identifier   s
   z9AuthorityKeyIdentifier.from_issuer_subject_key_identifierr.   c                 C  s   d| j d| j d| j dS )Nz'<AuthorityKeyIdentifier(key_identifier=z, authority_cert_issuer=z, authority_cert_serial_number=rj   r   r3   r*   r*   r+   rk         
zAuthorityKeyIdentifier.__repr__rx   ry   rz   c                 C  2   t |tstS | j|jko| j|jko| j|jkS r#   )r$   r   r|   r   r   r   r}   r*   r*   r+   r~      s   

zAuthorityKeyIdentifier.__eq__r/   c                 C  s,   | j d u rd }nt| j }t| j|| jfS r#   )r   tupler   r   r   )r4   Zacir*   r*   r+   r     s   

zAuthorityKeyIdentifier.__hash__c                 C  r   r#   )r   r3   r*   r*   r+   r     r   z%AuthorityKeyIdentifier.key_identifierlist[GeneralName] | Nonec                 C  r   r#   )r   r3   r*   r*   r+   r        z,AuthorityKeyIdentifier.authority_cert_issuerc                 C  r   r#   )r   r3   r*   r*   r+   r     r   z3AuthorityKeyIdentifier.authority_cert_serial_numberr"   c                 C  r   r#   r   r3   r*   r*   r+   r%     r   z#AuthorityKeyIdentifier.public_bytesN)r   r   r   r   r   r   r!   rB   )r    r
   r!   r   )r   r   r!   r   rl   r   r<   r!   r   r!   r   r!   r   rT   )rM   rN   rO   r   ZAUTHORITY_KEY_IDENTIFIERrA   rF   classmethodr   r   rk   r~   r   r   r   r   r   r%   r*   r*   r*   r+   r      s"    
&

	

	r   c                   @  sn   e Zd ZejZdddZedd	d
Ze	dddZ
e	dddZd ddZd!ddZd"ddZdddZdS )#r   r(   r"   r!   rB   c                 C  s
   || _ d S r#   Z_digest)r4   r(   r*   r*   r+   rF   "  r   zSubjectKeyIdentifier.__init__r    r   c                 C  s   | t |S r#   r   )r   r    r*   r*   r+   from_public_key%  s   z$SubjectKeyIdentifier.from_public_keyc                 C  r   r#   r   r3   r*   r*   r+   r(   +  r   zSubjectKeyIdentifier.digestc                 C  r   r#   r   r3   r*   r*   r+   r   /  r   z#SubjectKeyIdentifier.key_identifierr.   c                 C     d| j dS )Nz<SubjectKeyIdentifier(digest=rj   r   r3   r*   r*   r+   rk   3  r7   zSubjectKeyIdentifier.__repr__rx   ry   rz   c                 C  s   t |tstS t| j|jS r#   )r$   r   r|   r   Zbytes_eqr(   r}   r*   r*   r+   r~   6  s   
zSubjectKeyIdentifier.__eq__r/   c                 C  r   r#   )r   r(   r3   r*   r*   r+   r   <  r   zSubjectKeyIdentifier.__hash__c                 C  r   r#   r   r3   r*   r*   r+   r%   ?  r   z!SubjectKeyIdentifier.public_bytesN)r(   r"   r!   rB   )r    r   r!   r   rT   rl   r   r<   )rM   rN   rO   r   ZSUBJECT_KEY_IDENTIFIERrA   rF   r   r   r   r(   r   rk   r~   r   r%   r*   r*   r*   r+   r     s    



r   c                   @  R   e Zd ZejZdddZed\ZZ	Z
dd	d
ZdddZdddZdddZdS )AuthorityInformationAccessdescriptions"typing.Iterable[AccessDescription]r!   rB   c                 C  ,   t |}tdd |D std|| _d S )Nc                 s  r   r#   r$   AccessDescriptionr   r*   r*   r+   r   J      z6AuthorityInformationAccess.__init__.<locals>.<genexpr>@Every item in the descriptions list must be an AccessDescriptionr[   r   rf   _descriptionsr4   r   r*   r*   r+   rF   F     
z#AuthorityInformationAccess.__init__r   r.   c                 C  ri   )Nz<AuthorityInformationAccess(rj   r   r3   r*   r*   r+   rk   T  r7   z#AuthorityInformationAccess.__repr__rx   ry   rz   c                 C  r{   r#   )r$   r   r|   r   r}   r*   r*   r+   r~   W  r   z!AuthorityInformationAccess.__eq__r/   c                 C     t t| jS r#   r   r   r   r3   r*   r*   r+   r   ]  r7   z#AuthorityInformationAccess.__hash__r"   c                 C  r   r#   r   r3   r*   r*   r+   r%   `  r   z'AuthorityInformationAccess.public_bytesNr   r   r!   rB   rl   r   r<   rT   )rM   rN   rO   r   ZAUTHORITY_INFORMATION_ACCESSrA   rF   r=   rm   rn   ro   rk   r~   r   r%   r*   r*   r*   r+   r   C      



r   c                   @  r   )SubjectInformationAccessr   r   r!   rB   c                 C  r   )Nc                 s  r   r#   r   r   r*   r*   r+   r   k  r   z4SubjectInformationAccess.__init__.<locals>.<genexpr>r   r   r   r*   r*   r+   rF   g  r   z!SubjectInformationAccess.__init__r   r.   c                 C  ri   )Nz<SubjectInformationAccess(rj   r   r3   r*   r*   r+   rk   u  r7   z!SubjectInformationAccess.__repr__rx   ry   rz   c                 C  r{   r#   )r$   r   r|   r   r}   r*   r*   r+   r~   x  r   zSubjectInformationAccess.__eq__r/   c                 C  r   r#   r   r3   r*   r*   r+   r   ~  r7   z!SubjectInformationAccess.__hash__r"   c                 C  r   r#   r   r3   r*   r*   r+   r%     r   z%SubjectInformationAccess.public_bytesNr   rl   r   r<   rT   )rM   rN   rO   r   ZSUBJECT_INFORMATION_ACCESSrA   rF   r=   rm   rn   ro   rk   r~   r   r%   r*   r*   r*   r+   r   d  r   r   c                   @  P   e Zd ZdddZdd
dZdddZdddZedddZedddZ	dS )r   access_methodr   access_locationr   r!   rB   c                 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   rf   r   _access_method_access_location)r4   r   r   r*   r*   r+   rF     s   


zAccessDescription.__init__r.   c                 C     d| j  d| j dS )Nz!<AccessDescription(access_method=z, access_location=rj   )r   r   r3   r*   r*   r+   rk        
zAccessDescription.__repr__rx   ry   rz   c                 C  &   t |tstS | j|jko| j|jkS r#   )r$   r   r|   r   r   r}   r*   r*   r+   r~     
   

zAccessDescription.__eq__r/   c                 C     t | j| jfS r#   )r   r   r   r3   r*   r*   r+   r        zAccessDescription.__hash__c                 C  r   r#   )r   r3   r*   r*   r+   r     r   zAccessDescription.access_methodc                 C  r   r#   )r   r3   r*   r*   r+   r     r   z!AccessDescription.access_locationN)r   r   r   r   r!   rB   rl   r   r<   r!   r   )r!   r   )
rM   rN   rO   rF   rk   r~   r   r   r   r   r*   r*   r*   r+   r         



	r   c                   @  s`   e Zd ZejZdddZedd	d
ZedddZ	dddZ
dddZd ddZd!ddZdS )"BasicConstraintscarz   path_lengthr   r!   rB   c                 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$   rz   rf   r   r/   _ca_path_length)r4   r   r   r*   r*   r+   rF     s   

zBasicConstraints.__init__c                 C  r   r#   )r   r3   r*   r*   r+   r     r   zBasicConstraints.cac                 C  r   r#   )r   r3   r*   r*   r+   r     r   zBasicConstraints.path_lengthr.   c                 C  r   )Nz<BasicConstraints(ca=z, path_length=rj   )r   r   r3   r*   r*   r+   rk     r   zBasicConstraints.__repr__rx   ry   c                 C  r   r#   )r$   r   r|   r   r   r}   r*   r*   r+   r~        
zBasicConstraints.__eq__r/   c                 C  r   r#   )r   r   r   r3   r*   r*   r+   r     r   zBasicConstraints.__hash__r"   c                 C  r   r#   r   r3   r*   r*   r+   r%     r   zBasicConstraints.public_bytesN)r   rz   r   r   r!   rB   r!   rz   r   rl   r   r<   rT   )rM   rN   rO   r   ZBASIC_CONSTRAINTSrA   rF   r   r   r   rk   r~   r   r%   r*   r*   r*   r+   r     s    



r   c                   @  sR   e Zd ZejZdddZedddZdddZ	dddZ
dddZdddZdS )DeltaCRLIndicatorrq   r/   r!   rB   c                 C  rr   rs   rt   rv   r*   r*   r+   rF     rw   zDeltaCRLIndicator.__init__c                 C  r   r#   r   r3   r*   r*   r+   rq     r   zDeltaCRLIndicator.crl_numberrx   ry   rz   c                 C  r{   r#   )r$   r   r|   rq   r}   r*   r*   r+   r~     r   zDeltaCRLIndicator.__eq__c                 C  r   r#   r   r3   r*   r*   r+   r     r   zDeltaCRLIndicator.__hash__r.   c                 C  ri   )Nz<DeltaCRLIndicator(crl_number=rj   r   r3   r*   r*   r+   rk     r7   zDeltaCRLIndicator.__repr__r"   c                 C  r   r#   r   r3   r*   r*   r+   r%     r   zDeltaCRLIndicator.public_bytesNr   r<   r   rl   rT   )rM   rN   rO   r   ZDELTA_CRL_INDICATORrA   rF   r   rq   r~   r   rk   r%   r*   r*   r*   r+   r     s    



r   c                   @  r   )CRLDistributionPointsdistribution_points"typing.Iterable[DistributionPoint]r!   rB   c                 C  r   )Nc                 s  r   r#   r$   DistributionPointr   r*   r*   r+   r      r   z1CRLDistributionPoints.__init__.<locals>.<genexpr>?distribution_points must be a list of DistributionPoint objectsr[   r   rf   _distribution_pointsr4   r   r*   r*   r+   rF        
zCRLDistributionPoints.__init__r   r.   c                 C  ri   )Nz<CRLDistributionPoints(rj   r   r3   r*   r*   r+   rk     r7   zCRLDistributionPoints.__repr__rx   ry   rz   c                 C  r{   r#   )r$   r   r|   r   r}   r*   r*   r+   r~     r   zCRLDistributionPoints.__eq__r/   c                 C  r   r#   r   r   r   r3   r*   r*   r+   r     r7   zCRLDistributionPoints.__hash__r"   c                 C  r   r#   r   r3   r*   r*   r+   r%     r   z"CRLDistributionPoints.public_bytesNr   r   r!   rB   rl   r   r<   rT   )rM   rN   rO   r   ZCRL_DISTRIBUTION_POINTSrA   rF   r=   rm   rn   ro   rk   r~   r   r%   r*   r*   r*   r+   r         




r   c                   @  r   )FreshestCRLr   r   r!   rB   c                 C  r   )Nc                 s  r   r#   r   r   r*   r*   r+   r   %  r   z'FreshestCRL.__init__.<locals>.<genexpr>r   r   r   r*   r*   r+   rF   !  r   zFreshestCRL.__init__r   r.   c                 C  ri   )Nz<FreshestCRL(rj   r   r3   r*   r*   r+   rk   3  r7   zFreshestCRL.__repr__rx   ry   rz   c                 C  r{   r#   )r$   r   r|   r   r}   r*   r*   r+   r~   6  r   zFreshestCRL.__eq__r/   c                 C  r   r#   r   r3   r*   r*   r+   r   <  r7   zFreshestCRL.__hash__r"   c                 C  r   r#   r   r3   r*   r*   r+   r%   ?  r   zFreshestCRL.public_bytesNr   rl   r   r<   rT   )rM   rN   rO   r   ZFRESHEST_CRLrA   rF   r=   rm   rn   ro   rk   r~   r   r%   r*   r*   r*   r+   r     r   r   c                   @  sl   e Zd Zd!d
dZd"ddZd#ddZd$ddZed%ddZed&ddZ	ed'ddZ
ed%ddZd S )(r   	full_namer   relative_name RelativeDistinguishedName | Nonereasonsfrozenset[ReasonFlags] | None
crl_issuerr!   rB   c                 C  s   |r|rt d|s|s|st d|d ur't|}tdd |D s'td|r2t|ts2td|d urGt|}tdd |D sGtd|r[t|trWtd	d |D s[td
|rktj|v sgtj	|v rkt d|| _
|| _|| _|| _d S )NzOYou cannot provide both full_name and relative_name, at least one must be None.z?Either full_name, relative_name or crl_issuer must be provided.c                 s  r   r#   r   r   r*   r*   r+   r   X  r   z-DistributionPoint.__init__.<locals>.<genexpr>z/full_name must be a list of GeneralName objectsz1relative_name must be a RelativeDistinguishedNamec                 s  r   r#   r   r   r*   r*   r+   r   e  r   z2crl_issuer must be None or a list of general namesc                 s  r   r#   r$   ReasonFlagsr   r*   r*   r+   r   l  r   z0reasons must be None or frozenset of ReasonFlagszLunspecified and remove_from_crl are not valid reasons in a DistributionPoint)r   r[   r   rf   r$   r   	frozensetr   unspecifiedremove_from_crl
_full_name_relative_name_reasons_crl_issuer)r4   r   r   r   r   r*   r*   r+   rF   D  sR   



zDistributionPoint.__init__r.   c                 C  
   d | S )Nz}<DistributionPoint(full_name={0.full_name}, relative_name={0.relative_name}, reasons={0.reasons}, crl_issuer={0.crl_issuer})>formatr3   r*   r*   r+   rk   ~     zDistributionPoint.__repr__rx   ry   rz   c                 C  s>   t |tstS | j|jko| j|jko| j|jko| j|jkS r#   )r$   r   r|   r   r   r   r   r}   r*   r*   r+   r~     s   



zDistributionPoint.__eq__r/   c                 C  sH   | j d urt| j }nd }| jd urt| j}nd }t|| j| j|fS r#   )r   r   r   r   r   r   )r4   fnr   r*   r*   r+   r     s   

zDistributionPoint.__hash__r   c                 C  r   r#   r   r3   r*   r*   r+   r     r   zDistributionPoint.full_namec                 C  r   r#   r   r3   r*   r*   r+   r     r   zDistributionPoint.relative_namec                 C  r   r#   )r   r3   r*   r*   r+   r     r   zDistributionPoint.reasonsc                 C  r   r#   )r   r3   r*   r*   r+   r     r   zDistributionPoint.crl_issuerN)
r   r   r   r   r   r   r   r   r!   rB   rl   r   r<   r   r!   r   r!   r   )rM   rN   rO   rF   rk   r~   r   r   r   r   r   r   r*   r*   r*   r+   r   C  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   ZkeyCompromiseZcACompromiseZaffiliationChanged
supersededZcessationOfOperationZcertificateHoldZprivilegeWithdrawnZaACompromiseZremoveFromCRLN)rM   rN   rO   r   key_compromiseca_compromiseaffiliation_changedr  cessation_of_operationcertificate_holdprivilege_withdrawnaa_compromiser   r*   r*   r*   r+   r     s    r   )                        r  r  r  r  r  r  r  r  	   
   c                   @  s`   e Zd ZejZdddZdd	d
ZdddZdddZ	e
dddZe
dddZd ddZdS )!PolicyConstraintsrequire_explicit_policyr   inhibit_policy_mappingr!   rB   c                 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$   r/   rf   r   _require_explicit_policy_inhibit_policy_mapping)r4   r  r  r*   r*   r+   rF     s$   


zPolicyConstraints.__init__r.   c                 C  r   )Nz{<PolicyConstraints(require_explicit_policy={0.require_explicit_policy}, inhibit_policy_mapping={0.inhibit_policy_mapping})>r   r3   r*   r*   r+   rk     r  zPolicyConstraints.__repr__rx   ry   rz   c                 C  r   r#   )r$   r  r|   r  r  r}   r*   r*   r+   r~     r   zPolicyConstraints.__eq__r/   c                 C  r   r#   )r   r  r  r3   r*   r*   r+   r   '  s   
zPolicyConstraints.__hash__c                 C  r   r#   )r  r3   r*   r*   r+   r  ,  r   z)PolicyConstraints.require_explicit_policyc                 C  r   r#   )r  r3   r*   r*   r+   r  0  r   z(PolicyConstraints.inhibit_policy_mappingr"   c                 C  r   r#   r   r3   r*   r*   r+   r%   4  r   zPolicyConstraints.public_bytesN)r  r   r  r   r!   rB   rl   r   r<   r   rT   )rM   rN   rO   r   ZPOLICY_CONSTRAINTSrA   rF   rk   r~   r   r   r  r  r%   r*   r*   r*   r+   r    s    



	r  c                   @  r   )CertificatePoliciespolicies"typing.Iterable[PolicyInformation]r!   rB   c                 C  r   )Nc                 s  r   r#   )r$   PolicyInformationr   r*   r*   r+   r   =  r   z/CertificatePolicies.__init__.<locals>.<genexpr>z;Every item in the policies list must be a PolicyInformation)r[   r   rf   	_policies)r4   r  r*   r*   r+   rF   ;     
zCertificatePolicies.__init__r"  r.   c                 C  ri   )Nz<CertificatePolicies(rj   )r"  r3   r*   r*   r+   rk   G  r7   zCertificatePolicies.__repr__rx   ry   rz   c                 C  r{   r#   )r$   r  r|   r"  r}   r*   r*   r+   r~   J  r   zCertificatePolicies.__eq__r/   c                 C  r   r#   )r   r   r"  r3   r*   r*   r+   r   P  r7   zCertificatePolicies.__hash__r"   c                 C  r   r#   r   r3   r*   r*   r+   r%   S  r   z CertificatePolicies.public_bytesN)r  r   r!   rB   rl   r   r<   rT   )rM   rN   rO   r   ZCERTIFICATE_POLICIESrA   rF   r=   rm   rn   ro   rk   r~   r   r%   r*   r*   r*   r+   r  8  s    




r  c                   @  P   e Zd ZdddZdd
dZdddZdddZedddZedddZ	dS ) r!  policy_identifierr   policy_qualifiers(typing.Iterable[str | UserNotice] | Noner!   rB   c                 C  sL   t |ts	td|| _|d u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 r#   )r$   r.   
UserNoticer   r*   r*   r+   r   d  s    
z-PolicyInformation.__init__.<locals>.<genexpr>zMpolicy_qualifiers must be a list of strings and/or UserNotice objects or None)r$   r   rf   _policy_identifierr[   r   _policy_qualifiers)r4   r%  r&  r*   r*   r+   rF   X  s   

zPolicyInformation.__init__r.   c                 C  r   )Nz%<PolicyInformation(policy_identifier=z, policy_qualifiers=rj   )r%  r&  r3   r*   r*   r+   rk   n  r   zPolicyInformation.__repr__rx   ry   rz   c                 C  r   r#   )r$   r!  r|   r%  r&  r}   r*   r*   r+   r~   t  r   zPolicyInformation.__eq__r/   c                 C  s(   | j d urt| j }nd }t| j|fS r#   )r&  r   r   r%  )r4   Zpqr*   r*   r+   r   }  s   
zPolicyInformation.__hash__c                 C  r   r#   )r)  r3   r*   r*   r+   r%    r   z#PolicyInformation.policy_identifierlist[str | UserNotice] | Nonec                 C  r   r#   )r*  r3   r*   r*   r+   r&    r   z#PolicyInformation.policy_qualifiersN)r%  r   r&  r'  r!   rB   rl   r   r<   r   )r!   r+  )
rM   rN   rO   rF   rk   r~   r   r   r%  r&  r*   r*   r*   r+   r!  W  s    



	r!  c                   @  r   )r(  notice_referenceNoticeReference | Noneexplicit_text
str | Noner!   rB   c                 C  s&   |rt |tstd|| _|| _d S )Nz2notice_reference must be None or a NoticeReference)r$   NoticeReferencerf   _notice_reference_explicit_text)r4   r,  r.  r*   r*   r+   rF     s   
zUserNotice.__init__r.   c                 C     d| j  d| jdS )Nz<UserNotice(notice_reference=z, explicit_text=rj   )r,  r.  r3   r*   r*   r+   rk     r   zUserNotice.__repr__rx   ry   rz   c                 C  r   r#   )r$   r(  r|   r,  r.  r}   r*   r*   r+   r~     r   zUserNotice.__eq__r/   c                 C  r   r#   )r   r,  r.  r3   r*   r*   r+   r     r   zUserNotice.__hash__c                 C  r   r#   )r1  r3   r*   r*   r+   r,    r   zUserNotice.notice_referencec                 C  r   r#   )r2  r3   r*   r*   r+   r.    r   zUserNotice.explicit_textN)r,  r-  r.  r/  r!   rB   rl   r   r<   )r!   r-  r!   r/  )
rM   rN   rO   rF   rk   r~   r   r   r,  r.  r*   r*   r*   r+   r(    s    



	r(  c                   @  r$  ) r0  organizationr/  notice_numberstyping.Iterable[int]r!   rB   c                 C  s2   || _ t|}tdd |D std|| _d S )Nc                 s  r   r#   )r$   r/   r   r*   r*   r+   r     r   z+NoticeReference.__init__.<locals>.<genexpr>z)notice_numbers must be a list of integers)_organizationr[   r   rf   _notice_numbers)r4   r5  r6  r*   r*   r+   rF     s
   
zNoticeReference.__init__r.   c                 C  s   d| j d| j dS )Nz<NoticeReference(organization=z, notice_numbers=rj   )r5  r6  r3   r*   r*   r+   rk     r   zNoticeReference.__repr__rx   ry   rz   c                 C  r   r#   )r$   r0  r|   r5  r6  r}   r*   r*   r+   r~     r   zNoticeReference.__eq__r/   c                 C     t | jt| jfS r#   )r   r5  r   r6  r3   r*   r*   r+   r        zNoticeReference.__hash__c                 C  r   r#   )r8  r3   r*   r*   r+   r5    r   zNoticeReference.organization	list[int]c                 C  r   r#   )r9  r3   r*   r*   r+   r6    r   zNoticeReference.notice_numbersN)r5  r/  r6  r7  r!   rB   rl   r   r<   r4  )r!   r<  )
rM   rN   rO   rF   rk   r~   r   r   r5  r6  r*   r*   r*   r+   r0    r   r0  c                   @  r   )ExtendedKeyUsageusages!typing.Iterable[ObjectIdentifier]r!   rB   c                 C  r   )Nc                 s  r   r#   r$   r   r   r*   r*   r+   r     r   z,ExtendedKeyUsage.__init__.<locals>.<genexpr>z9Every item in the usages list must be an ObjectIdentifier)r[   r   rf   _usages)r4   r>  r*   r*   r+   rF     s   
zExtendedKeyUsage.__init__rA  r.   c                 C  ri   )Nz<ExtendedKeyUsage(rj   )rA  r3   r*   r*   r+   rk     r7   zExtendedKeyUsage.__repr__rx   ry   rz   c                 C  r{   r#   )r$   r=  r|   rA  r}   r*   r*   r+   r~     r   zExtendedKeyUsage.__eq__r/   c                 C  r   r#   )r   r   rA  r3   r*   r*   r+   r     r7   zExtendedKeyUsage.__hash__r"   c                 C  r   r#   r   r3   r*   r*   r+   r%     r   zExtendedKeyUsage.public_bytesN)r>  r?  r!   rB   rl   r   r<   rT   )rM   rN   rO   r   ZEXTENDED_KEY_USAGErA   rF   r=   rm   rn   ro   rk   r~   r   r%   r*   r*   r*   r+   r=    s    
	


r=  c                   @  :   e Zd ZejZdddZddd	ZdddZdddZ	dS )OCSPNoCheckrx   ry   r!   rz   c                 C     t |tstS dS NT)r$   rC  r|   r}   r*   r*   r+   r~        
zOCSPNoCheck.__eq__r/   c                 C     t tS r#   )r   rC  r3   r*   r*   r+   r   
     zOCSPNoCheck.__hash__r.   c                 C     dS )Nz<OCSPNoCheck()>r*   r3   r*   r*   r+   rk        zOCSPNoCheck.__repr__r"   c                 C  r   r#   r   r3   r*   r*   r+   r%     r   zOCSPNoCheck.public_bytesNr   r<   rl   rT   )
rM   rN   rO   r   ZOCSP_NO_CHECKrA   r~   r   rk   r%   r*   r*   r*   r+   rC        


rC  c                   @  rB  )PrecertPoisonrx   ry   r!   rz   c                 C  rD  rE  )r$   rL  r|   r}   r*   r*   r+   r~     rF  zPrecertPoison.__eq__r/   c                 C  rG  r#   )r   rL  r3   r*   r*   r+   r     rH  zPrecertPoison.__hash__r.   c                 C  rI  )Nz<PrecertPoison()>r*   r3   r*   r*   r+   rk      rJ  zPrecertPoison.__repr__r"   c                 C  r   r#   r   r3   r*   r*   r+   r%   #  r   zPrecertPoison.public_bytesNr   r<   rl   rT   )
rM   rN   rO   r   ZPRECERT_POISONrA   r~   r   rk   r%   r*   r*   r*   r+   rL    rK  rL  c                   @  r   )
TLSFeaturefeaturestyping.Iterable[TLSFeatureType]r!   rB   c                 C  s8   t |}tdd |D rt|dkrtd|| _d S )Nc                 s  r   r#   )r$   TLSFeatureTyper   r*   r*   r+   r   -  r   z&TLSFeature.__init__.<locals>.<genexpr>r   z@features must be a list of elements from the TLSFeatureType enum)r[   r   r1   rf   	_features)r4   rN  r*   r*   r+   rF   *  s   
zTLSFeature.__init__rQ  r.   c                 C  ri   )Nz<TLSFeature(features=rj   )rQ  r3   r*   r*   r+   rk   9  r7   zTLSFeature.__repr__rx   ry   rz   c                 C  r{   r#   )r$   rM  r|   rQ  r}   r*   r*   r+   r~   <  r   zTLSFeature.__eq__r/   c                 C  r   r#   )r   r   rQ  r3   r*   r*   r+   r   B  r7   zTLSFeature.__hash__r"   c                 C  r   r#   r   r3   r*   r*   r+   r%   E  r   zTLSFeature.public_bytesN)rN  rO  r!   rB   rl   r   r<   rT   )rM   rN   rO   r   ZTLS_FEATURErA   rF   r=   rm   rn   ro   rk   r~   r   r%   r*   r*   r*   r+   rM  '  s    



rM  c                   @  s   e Zd ZdZdZdS )rP  r     N)rM   rN   rO   Zstatus_requestZstatus_request_v2r*   r*   r*   r+   rP  I  s    rP  c                 C  s   i | ]}|j |qS r*   rg   r   r*   r*   r+   
<dictcomp>T      rT  c                   @  sR   e Zd ZejZdddZddd	ZdddZdddZ	e
dddZdddZdS )InhibitAnyPolicy
skip_certsr/   r!   rB   c                 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$   r/   rf   r   _skip_certs)r4   rW  r*   r*   r+   rF   Z  s
   

zInhibitAnyPolicy.__init__r.   c                 C  ri   )Nz<InhibitAnyPolicy(skip_certs=rj   )rW  r3   r*   r*   r+   rk   c  r7   zInhibitAnyPolicy.__repr__rx   ry   rz   c                 C  r{   r#   )r$   rV  r|   rW  r}   r*   r*   r+   r~   f  r   zInhibitAnyPolicy.__eq__c                 C  r   r#   )r   rW  r3   r*   r*   r+   r   l  r   zInhibitAnyPolicy.__hash__c                 C  r   r#   )rX  r3   r*   r*   r+   rW  o  r   zInhibitAnyPolicy.skip_certsr"   c                 C  r   r#   r   r3   r*   r*   r+   r%   s  r   zInhibitAnyPolicy.public_bytesN)rW  r/   r!   rB   rl   r   r<   rT   )rM   rN   rO   r   ZINHIBIT_ANY_POLICYrA   rF   rk   r~   r   r   rW  r%   r*   r*   r*   r+   rV  W  s    

	

rV  c                   @  s   e Zd ZejZd/ddZed0ddZed0ddZ	ed0ddZ
ed0ddZed0ddZed0ddZed0ddZed0ddZed0dd Zd1d"d#Zd2d&d'Zd3d)d*Zd4d,d-Zd.S )5KeyUsagedigital_signaturerz   content_commitmentkey_enciphermentdata_enciphermentkey_agreementkey_cert_signcrl_signencipher_onlydecipher_onlyr!   rB   c
           
      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)
r4   rZ  r[  r\  r]  r^  r_  r`  ra  rb  r*   r*   r+   rF   z  s   
zKeyUsage.__init__c                 C  r   r#   )rc  r3   r*   r*   r+   rZ    r   zKeyUsage.digital_signaturec                 C  r   r#   )rd  r3   r*   r*   r+   r[    r   zKeyUsage.content_commitmentc                 C  r   r#   )re  r3   r*   r*   r+   r\    r   zKeyUsage.key_enciphermentc                 C  r   r#   )rf  r3   r*   r*   r+   r]    r   zKeyUsage.data_enciphermentc                 C  r   r#   )rg  r3   r*   r*   r+   r^    r   zKeyUsage.key_agreementc                 C  r   r#   )rh  r3   r*   r*   r+   r_    r   zKeyUsage.key_cert_signc                 C  r   r#   )ri  r3   r*   r*   r+   r`    r   zKeyUsage.crl_signc                 C     | j std| jS )Nz7encipher_only is undefined unless key_agreement is true)r^  r   rj  r3   r*   r*   r+   ra    
   zKeyUsage.encipher_onlyc                 C  rl  )Nz7decipher_only is undefined unless key_agreement is true)r^  r   rk  r3   r*   r*   r+   rb    rm  zKeyUsage.decipher_onlyr.   c                 C  sv   z| j }| j}W n ty   d}d}Y nw d| j d| j d| j d| j d| j d| j d| j	 d	| d
| dS )NFz<KeyUsage(digital_signature=z, content_commitment=z, key_encipherment=z, data_encipherment=z, key_agreement=z, key_cert_sign=z, crl_sign=z, encipher_only=z, decipher_only=rj   )
ra  rb  r   rZ  r[  r\  r]  r^  r_  r`  )r4   ra  rb  r*   r*   r+   rk     s2   

zKeyUsage.__repr__rx   ry   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 r#   )r$   rY  r|   rZ  r[  r\  r]  r^  r_  r`  rj  rk  r}   r*   r*   r+   r~     s&   








zKeyUsage.__eq__r/   c              
   C  s,   t | j| j| j| j| j| j| j| j| j	f	S r#   )
r   rZ  r[  r\  r]  r^  r_  r`  rj  rk  r3   r*   r*   r+   r     s   zKeyUsage.__hash__r"   c                 C  r   r#   r   r3   r*   r*   r+   r%     r   zKeyUsage.public_bytesN)rZ  rz   r[  rz   r\  rz   r]  rz   r^  rz   r_  rz   r`  rz   ra  rz   rb  rz   r!   rB   r   rl   r   r<   rT   )rM   rN   rO   r   Z	KEY_USAGErA   rF   r   rZ  r[  r\  r]  r^  r_  r`  ra  rb  rk   r~   r   r%   r*   r*   r*   r+   rY  w  s2    



rY  c                   @  s~   e Zd ZejZd$ddZd%ddZd&ddZd&ddZ	d&ddZ
d'ddZd(ddZed)ddZed)ddZd*d!d"Zd#S )+NameConstraintspermitted_subtreesr   excluded_subtreesr!   rB   c                 C  s   |d ur t |}|stdtdd |D std| | |d ur@t |}|s.tdtdd |D s;td| | |d u rL|d u rLtd|| _|| _d S )	Nz3permitted_subtrees must be a non-empty list or Nonec                 s  r   r#   r   r   r*   r*   r+   r   
  r   z+NameConstraints.__init__.<locals>.<genexpr>z@permitted_subtrees must be a list of GeneralName objects or Nonez2excluded_subtrees must be a non-empty list or Nonec                 s  r   r#   r   r   r*   r*   r+   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   r   rf   _validate_tree_permitted_subtrees_excluded_subtrees)r4   ro  rp  r*   r*   r+   rF     s8   


zNameConstraints.__init__rx   ry   rz   c                 C  r   r#   )r$   rn  r|   rp  ro  r}   r*   r*   r+   r~   )  r   zNameConstraints.__eq__treetyping.Iterable[GeneralName]c                 C  s   |  | | | d S r#   )_validate_ip_name_validate_dns_namer4   rt  r*   r*   r+   rq  2  s   
zNameConstraints._validate_treec                 C     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 r#   )r$   r   rg   	ipaddressIPv4NetworkIPv6Networkr   namer*   r*   r+   r   7  s    

z4NameConstraints._validate_ip_name.<locals>.<genexpr>zGIPAddress name constraints must be an IPv4Network or IPv6Network object)anyrf   rx  r*   r*   r+   rv  6  s   z!NameConstraints._validate_ip_namec                 C  ry  )Nc                 s  s$    | ]}t |tod |jv V  qdS )*N)r$   r   rg   r}  r*   r*   r+   r   D  s    
z5NameConstraints._validate_dns_name.<locals>.<genexpr>zDDNSName name constraints must not contain the '*' wildcard character)r  r   rx  r*   r*   r+   rw  C  s   z"NameConstraints._validate_dns_namer.   c                 C  r   )Nz$<NameConstraints(permitted_subtrees=z, excluded_subtrees=rj   )ro  rp  r3   r*   r*   r+   rk   L  r   zNameConstraints.__repr__r/   c                 C  s@   | j d urt| j }nd }| jd urt| j}nd }t||fS r#   )ro  r   rp  r   )r4   Zpsesr*   r*   r+   r   R  s   

zNameConstraints.__hash__r   c                 C  r   r#   )rr  r3   r*   r*   r+   ro  _  r   z"NameConstraints.permitted_subtreesc                 C  r   r#   )rs  r3   r*   r*   r+   rp  e  r   z!NameConstraints.excluded_subtreesr"   c                 C  r   r#   r   r3   r*   r*   r+   r%   k  r   zNameConstraints.public_bytesN)ro  r   rp  r   r!   rB   r   )rt  ru  r!   rB   rl   r<   r   rT   )rM   rN   rO   r   ZNAME_CONSTRAINTSrA   rF   r~   rq  rv  rw  rk   r   r   ro  rp  r%   r*   r*   r*   r+   rn    s    

*
	


	
rn  c                   @  s^   e Zd Zdd	d
ZedddZedddZedddZd ddZd!ddZ	d"ddZ
dS )#	ExtensionrA   r   criticalrz   rg   r   r!   rB   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   rf   rz   _oid	_critical_value)r4   rA   r  rg   r*   r*   r+   rF   p  s   


zExtension.__init__c                 C  r   r#   r  r3   r*   r*   r+   rA     r   zExtension.oidc                 C  r   r#   )r  r3   r*   r*   r+   r    r   zExtension.criticalc                 C  r   r#   r  r3   r*   r*   r+   rg     r   zExtension.valuer.   c                 C     d| j  d| j d| j dS )Nz<Extension(oid=z, critical=, value=rj   )rA   r  rg   r3   r*   r*   r+   rk     s   zExtension.__repr__rx   ry   c                 C  r   r#   )r$   r  r|   rA   r  rg   r}   r*   r*   r+   r~        


zExtension.__eq__r/   c                 C     t | j| j| jfS r#   )r   rA   r  rg   r3   r*   r*   r+   r     r;  zExtension.__hash__N)rA   r   r  rz   rg   r   r!   rB   r   r   )r!   r   rl   r   r<   )rM   rN   rO   rF   r   rA   r  rg   rk   r~   r   r*   r*   r*   r+   r  o  s    



r  c                   @  s   e Zd Zd(ddZed\ZZZej	d)ddZ
ej	d*ddZ
ej	d+ddZ
ej	d,ddZ
ej	d-ddZ
d.ddZ
d/ddZd0d"d#Zd1d%d&Zd'S )2GeneralNamesgeneral_namesru  r!   rB   c                 C  r   )Nc                 s  r   r#   r   r   r*   r*   r+   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   rf   _general_namesr4   r  r*   r*   r+   rF     r#  zGeneralNames.__init__r  typeBtype[DNSName] | type[UniformResourceIdentifier] | type[RFC822Name]	list[str]c                 C     d S r#   r*   r4   r  r*   r*   r+   get_values_for_type     z GeneralNames.get_values_for_typetype[DirectoryName]
list[Name]c                 C  r  r#   r*   r  r*   r*   r+   r       type[RegisteredID]list[ObjectIdentifier]c                 C  r  r#   r*   r  r*   r*   r+   r    r  type[IPAddress]list[_IPAddressTypes]c                 C  r  r#   r*   r  r*   r*   r+   r       type[OtherName]list[OtherName]c                 C  r  r#   r*   r  r*   r*   r+   r    r  type[DNSName] | type[DirectoryName] | type[IPAddress] | type[OtherName] | type[RFC822Name] | type[RegisteredID] | type[UniformResourceIdentifier]Ylist[_IPAddressTypes] | list[str] | list[OtherName] | list[Name] | list[ObjectIdentifier]c                   s0    fdd| D } t krdd |D S t|S )Nc                 3  s    | ]
}t | r|V  qd S r#   )r$   r   ir  r*   r+   r     s    z3GeneralNames.get_values_for_type.<locals>.<genexpr>c                 S  s   g | ]}|j qS r*   rS  r  r*   r*   r+   
<listcomp>  s    z4GeneralNames.get_values_for_type.<locals>.<listcomp>)r   r[   )r4   r  Zobjsr*   r  r+   r    s   r.   c                 C  ri   )Nz<GeneralNames(rj   r  r3   r*   r*   r+   rk     r7   zGeneralNames.__repr__rx   ry   rz   c                 C  r{   r#   )r$   r  r|   r  r}   r*   r*   r+   r~     r   zGeneralNames.__eq__r/   c                 C  r   r#   )r   r   r  r3   r*   r*   r+   r     r7   zGeneralNames.__hash__Nr  ru  r!   rB   r  r  r!   r  r  r  r!   r  r  r  r!   r  r  r  r!   r  r  r  r!   r  r  r  r!   r  rl   r   r<   )rM   rN   rO   rF   r=   rm   rn   ro   typingoverloadr  rk   r~   r   r*   r*   r*   r+   r    s"    




r  c                   @     e Zd ZejZd+ddZed\ZZ	Z
ejd,ddZejd-ddZejd.ddZejd/ddZejd0ddZd1ddZd2ddZd3d"d#Zd4d%d&Zd5d(d)Zd*S )6SubjectAlternativeNamer  ru  r!   rB   c                 C  rZ   r#   r  r  r  r*   r*   r+   rF     r7   zSubjectAlternativeName.__init__r  r  r  r  c                 C  r  r#   r*   r  r*   r*   r+   r    r  z*SubjectAlternativeName.get_values_for_typer  r  c                 C  r  r#   r*   r  r*   r*   r+   r    r  r  r  c                 C  r  r#   r*   r  r*   r*   r+   r    r  r  r  c                 C  r  r#   r*   r  r*   r*   r+   r    r  r  r  c                 C  r  r#   r*   r  r*   r*   r+   r    r  r  r  c                 C     | j |S r#   r  r  r  r*   r*   r+   r       r.   c                 C  ri   )Nz<SubjectAlternativeName(rj   r  r3   r*   r*   r+   rk   '  r7   zSubjectAlternativeName.__repr__rx   ry   rz   c                 C  r{   r#   )r$   r  r|   r  r}   r*   r*   r+   r~   *  r   zSubjectAlternativeName.__eq__r/   c                 C  r   r#   r   r  r3   r*   r*   r+   r   0  r   zSubjectAlternativeName.__hash__r"   c                 C  r   r#   r   r3   r*   r*   r+   r%   3  r   z#SubjectAlternativeName.public_bytesNr  r  r  r  r  r  r  rl   r   r<   rT   )rM   rN   rO   r   ZSUBJECT_ALTERNATIVE_NAMErA   rF   r=   rm   rn   ro   r  r  r  rk   r~   r   r%   r*   r*   r*   r+   r    &    




r  c                   @  r  )6IssuerAlternativeNamer  ru  r!   rB   c                 C  rZ   r#   r  r  r*   r*   r+   rF   :  r7   zIssuerAlternativeName.__init__r  r  r  r  c                 C  r  r#   r*   r  r*   r*   r+   r  ?  r  z)IssuerAlternativeName.get_values_for_typer  r  c                 C  r  r#   r*   r  r*   r*   r+   r  G  r  r  r  c                 C  r  r#   r*   r  r*   r*   r+   r  M  r  r  r  c                 C  r  r#   r*   r  r*   r*   r+   r  S  r  r  r  c                 C  r  r#   r*   r  r*   r*   r+   r  X  r  r  r  c                 C  r  r#   r  r  r*   r*   r+   r  ]  r  r.   c                 C  ri   )Nz<IssuerAlternativeName(rj   r  r3   r*   r*   r+   rk   o  r7   zIssuerAlternativeName.__repr__rx   ry   rz   c                 C  r{   r#   )r$   r  r|   r  r}   r*   r*   r+   r~   r  r   zIssuerAlternativeName.__eq__r/   c                 C  r   r#   r  r3   r*   r*   r+   r   x  r   zIssuerAlternativeName.__hash__r"   c                 C  r   r#   r   r3   r*   r*   r+   r%   {  r   z"IssuerAlternativeName.public_bytesNr  r  r  r  r  r  r  rl   r   r<   rT   )rM   rN   rO   r   ZISSUER_ALTERNATIVE_NAMErA   rF   r=   rm   rn   ro   r  r  r  rk   r~   r   r%   r*   r*   r*   r+   r  7  r  r  c                   @  r  )6CertificateIssuerr  ru  r!   rB   c                 C  rZ   r#   r  r  r*   r*   r+   rF     r7   zCertificateIssuer.__init__r  r  r  r  c                 C  r  r#   r*   r  r*   r*   r+   r    r  z%CertificateIssuer.get_values_for_typer  r  c                 C  r  r#   r*   r  r*   r*   r+   r    r  r  r  c                 C  r  r#   r*   r  r*   r*   r+   r    r  r  r  c                 C  r  r#   r*   r  r*   r*   r+   r    r  r  r  c                 C  r  r#   r*   r  r*   r*   r+   r    r  r  r  c                 C  r  r#   r  r  r*   r*   r+   r    r  r.   c                 C  ri   )Nz<CertificateIssuer(rj   r  r3   r*   r*   r+   rk     r7   zCertificateIssuer.__repr__rx   ry   rz   c                 C  r{   r#   )r$   r  r|   r  r}   r*   r*   r+   r~     r   zCertificateIssuer.__eq__r/   c                 C  r   r#   r  r3   r*   r*   r+   r     r   zCertificateIssuer.__hash__r"   c                 C  r   r#   r   r3   r*   r*   r+   r%     r   zCertificateIssuer.public_bytesNr  r  r  r  r  r  r  rl   r   r<   rT   )rM   rN   rO   r   ZCERTIFICATE_ISSUERrA   rF   r=   rm   rn   ro   r  r  r  rk   r~   r   r%   r*   r*   r*   r+   r    r  r  c                   @  sR   e Zd ZejZdddZddd	ZdddZdddZ	e
dddZdddZdS )	CRLReasonreasonr   r!   rB   c                 C  rr   )Nz*reason must be an element from ReasonFlags)r$   r   rf   _reason)r4   r  r*   r*   r+   rF     rw   zCRLReason.__init__r.   c                 C  ri   )Nz<CRLReason(reason=rj   r  r3   r*   r*   r+   rk     r7   zCRLReason.__repr__rx   ry   rz   c                 C  r{   r#   )r$   r  r|   r  r}   r*   r*   r+   r~     r   zCRLReason.__eq__r/   c                 C  r   r#   )r   r  r3   r*   r*   r+   r     r   zCRLReason.__hash__c                 C  r   r#   r  r3   r*   r*   r+   r    r   zCRLReason.reasonr"   c                 C  r   r#   r   r3   r*   r*   r+   r%     r   zCRLReason.public_bytesN)r  r   r!   rB   rl   r   r<   )r!   r   rT   )rM   rN   rO   r   Z
CRL_REASONrA   rF   rk   r~   r   r   r  r%   r*   r*   r*   r+   r    s    



r  c                   @  s`   e Zd ZejZdddZddd	ZdddZdddZ	e
dddZe
dddZdddZdS ) InvalidityDateinvalidity_datedatetime.datetimer!   rB   c                 C  s   t |tjs
td|| _d S )Nz+invalidity_date must be a datetime.datetime)r$   datetimerf   _invalidity_date)r4   r  r*   r*   r+   rF     s   
zInvalidityDate.__init__r.   c                 C  ri   )Nz <InvalidityDate(invalidity_date=rj   r  r3   r*   r*   r+   rk     r7   zInvalidityDate.__repr__rx   ry   rz   c                 C  r{   r#   )r$   r  r|   r  r}   r*   r*   r+   r~     r   zInvalidityDate.__eq__r/   c                 C  r   r#   )r   r  r3   r*   r*   r+   r     r   zInvalidityDate.__hash__c                 C  r   r#   r  r3   r*   r*   r+   r    r   zInvalidityDate.invalidity_datec                 C  s0   | j jd u r| j jtjjdS | j jtjjdS )N)tzinfo)tz)r  r  replacer  timezoneutc
astimezoner3   r*   r*   r+   invalidity_date_utc  s   z"InvalidityDate.invalidity_date_utcr"   c                 C  r   r#   r   r3   r*   r*   r+   r%     r   zInvalidityDate.public_bytesN)r  r  r!   rB   rl   r   r<   )r!   r  rT   )rM   rN   rO   r   ZINVALIDITY_DATErA   rF   rk   r~   r   r   r  r  r%   r*   r*   r*   r+   r    s    



r  c                   @  R   e Zd ZejZdddZed\ZZ	Z
dd	d
ZdddZdddZdddZdS ))PrecertificateSignedCertificateTimestampssigned_certificate_timestamps+typing.Iterable[SignedCertificateTimestamp]r!   rB   c                 C  r   )Nc                 s  r   r#   r$   r   r   Zsctr*   r*   r+   r     
    
zEPrecertificateSignedCertificateTimestamps.__init__.<locals>.<genexpr>YEvery item in the signed_certificate_timestamps list must be a SignedCertificateTimestampr[   r   rf   _signed_certificate_timestampsr4   r  r*   r*   r+   rF        
z2PrecertificateSignedCertificateTimestamps.__init__r  r.   c                 C     dt |  dS )Nz+<PrecertificateSignedCertificateTimestamps(rj   r[   r3   r*   r*   r+   rk      r   z2PrecertificateSignedCertificateTimestamps.__repr__r/   c                 C  r   r#   r   r   r  r3   r*   r*   r+   r   #  r7   z2PrecertificateSignedCertificateTimestamps.__hash__rx   ry   rz   c                 C  r{   r#   )r$   r  r|   r  r}   r*   r*   r+   r~   &     
z0PrecertificateSignedCertificateTimestamps.__eq__r"   c                 C  r   r#   r   r3   r*   r*   r+   r%   /  r   z6PrecertificateSignedCertificateTimestamps.public_bytesNr  r  r!   rB   rl   r<   r   rT   )rM   rN   rO   r   Z%PRECERT_SIGNED_CERTIFICATE_TIMESTAMPSrA   rF   r=   rm   rn   ro   rk   r   r~   r%   r*   r*   r*   r+   r        




	r  c                   @  r  )SignedCertificateTimestampsr  r  r!   rB   c                 C  r   )Nc                 s  r   r#   r  r  r*   r*   r+   r   =  r  z7SignedCertificateTimestamps.__init__.<locals>.<genexpr>r  r  r  r*   r*   r+   rF   6  r  z$SignedCertificateTimestamps.__init__r  r.   c                 C  r  )Nz<SignedCertificateTimestamps(rj   r  r3   r*   r*   r+   rk   K  r   z$SignedCertificateTimestamps.__repr__r/   c                 C  r   r#   r  r3   r*   r*   r+   r   N  r7   z$SignedCertificateTimestamps.__hash__rx   ry   rz   c                 C  r{   r#   )r$   r  r|   r  r}   r*   r*   r+   r~   Q  r  z"SignedCertificateTimestamps.__eq__r"   c                 C  r   r#   r   r3   r*   r*   r+   r%   Z  r   z(SignedCertificateTimestamps.public_bytesNr  rl   r<   r   rT   )rM   rN   rO   r   ZSIGNED_CERTIFICATE_TIMESTAMPSrA   rF   r=   rm   rn   ro   rk   r   r~   r%   r*   r*   r*   r+   r  3  r  r  c                   @  sR   e Zd ZejZdddZdd
dZdddZdddZ	e
dddZdddZdS )	OCSPNoncenoncer"   r!   rB   c                 C  rr   )Nznonce must be bytes)r$   r"   rf   _nonce)r4   r  r*   r*   r+   rF   a  rw   zOCSPNonce.__init__rx   ry   rz   c                 C  r{   r#   )r$   r  r|   r  r}   r*   r*   r+   r~   g  r   zOCSPNonce.__eq__r/   c                 C  r   r#   )r   r  r3   r*   r*   r+   r   m  r   zOCSPNonce.__hash__r.   c                 C  r   )Nz<OCSPNonce(nonce=rj   )r  r3   r*   r*   r+   rk   p  r7   zOCSPNonce.__repr__c                 C  r   r#   )r  r3   r*   r*   r+   r  s  r   zOCSPNonce.noncec                 C  r   r#   r   r3   r*   r*   r+   r%   w  r   zOCSPNonce.public_bytesN)r  r"   r!   rB   r   r<   rl   rT   )rM   rN   rO   r   ZNONCErA   rF   r~   r   rk   r   r  r%   r*   r*   r*   r+   r  ^  r   r  c                   @  sN   e Zd ZejZdddZdd
dZdddZdddZ	dddZ
dddZdS )OCSPAcceptableResponses	responsesr?  r!   rB   c                 C  s,   t |}tdd |D rtd|| _d S )Nc                 s  s    | ]	}t |t V  qd S r#   r@  )r   rr*   r*   r+   r     s    z3OCSPAcceptableResponses.__init__.<locals>.<genexpr>z'All responses must be ObjectIdentifiers)r[   r  rf   
_responses)r4   r  r*   r*   r+   rF   ~  s   
z OCSPAcceptableResponses.__init__rx   ry   rz   c                 C  r{   r#   )r$   r  r|   r  r}   r*   r*   r+   r~     r   zOCSPAcceptableResponses.__eq__r/   c                 C  r   r#   )r   r   r  r3   r*   r*   r+   r     r7   z OCSPAcceptableResponses.__hash__r.   c                 C  ri   )Nz#<OCSPAcceptableResponses(responses=rj   )r  r3   r*   r*   r+   rk     r7   z OCSPAcceptableResponses.__repr__!typing.Iterator[ObjectIdentifier]c                 C  r   r#   )r8   r  r3   r*   r*   r+   rn     r   z OCSPAcceptableResponses.__iter__r"   c                 C  r   r#   r   r3   r*   r*   r+   r%     r   z$OCSPAcceptableResponses.public_bytesN)r  r?  r!   rB   r   r<   rl   )r!   r  rT   )rM   rN   rO   r   ZACCEPTABLE_RESPONSESrA   rF   r~   r   rk   rn   r%   r*   r*   r*   r+   r  {  s    




r  c                   @  s   e Zd ZejZd-ddZd.ddZd/ddZd0ddZ	e
d1ddZe
d2ddZe
d3dd Ze
d3d!d"Ze
d4d#d$Ze
d3d%d&Ze
d3d'd(Zd5d*d+Zd,S )6IssuingDistributionPointr   r   r   r   only_contains_user_certsrz   only_contains_ca_certsonly_some_reasonsr   indirect_crlonly_contains_attribute_certsr!   rB   c           	      C  s   |d urt |}|rt|trtdd |D std|r,tj|v s(tj|v r,tdt|t	r@t|t	r@t|t	r@t|t	sDtd|||g}t
dd |D dkrXtd	t|||||||gsgtd
|| _|| _|| _|| _|| _|| _|| _d S )Nc                 s  r   r#   r   r   r*   r*   r+   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*   r+   r    rU  z5IssuingDistributionPoint.__init__.<locals>.<listcomp>r  z}Only one of the following can be set to True: only_contains_user_certs, only_contains_ca_certs, only_contains_attribute_certszCannot 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   r   rf   r   r   r   r   rz   r1   r  _only_contains_user_certs_only_contains_ca_certs_indirect_crl_only_contains_attribute_certs_only_some_reasonsr   r   )	r4   r   r   r  r  r  r  r  Zcrl_constraintsr*   r*   r+   rF     sn   




z!IssuingDistributionPoint.__init__r.   c                 C  s>   d| j  d| j d| j d| j d| j d| j d| j dS )	Nz$<IssuingDistributionPoint(full_name=z, relative_name=z, only_contains_user_certs=z, only_contains_ca_certs=z, only_some_reasons=z, indirect_crl=z , only_contains_attribute_certs=rj   )r   r   r  r  r  r  r  r3   r*   r*   r+   rk     s   
z!IssuingDistributionPoint.__repr__rx   ry   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 r#   )
r$   r  r|   r   r   r  r  r  r  r  r}   r*   r*   r+   r~     s"   





zIssuingDistributionPoint.__eq__r/   c                 C  s$   t | j| j| j| j| j| j| jfS r#   )r   r   r   r  r  r  r  r  r3   r*   r*   r+   r     s   z!IssuingDistributionPoint.__hash__r   c                 C  r   r#   r  r3   r*   r*   r+   r     r   z"IssuingDistributionPoint.full_namec                 C  r   r#   r  r3   r*   r*   r+   r     r   z&IssuingDistributionPoint.relative_namec                 C  r   r#   )r  r3   r*   r*   r+   r     r   z1IssuingDistributionPoint.only_contains_user_certsc                 C  r   r#   )r  r3   r*   r*   r+   r  $  r   z/IssuingDistributionPoint.only_contains_ca_certsc                 C  r   r#   )r  r3   r*   r*   r+   r  (  r   z*IssuingDistributionPoint.only_some_reasonsc                 C  r   r#   )r  r3   r*   r*   r+   r  .  r   z%IssuingDistributionPoint.indirect_crlc                 C  r   r#   )r  r3   r*   r*   r+   r  2  r   z6IssuingDistributionPoint.only_contains_attribute_certsr"   c                 C  r   r#   r   r3   r*   r*   r+   r%   6  r   z%IssuingDistributionPoint.public_bytesN)r   r   r   r   r  rz   r  rz   r  r   r  rz   r  rz   r!   rB   rl   r   r<   r   r  r   r  rT   )rM   rN   rO   r   ZISSUING_DISTRIBUTION_POINTrA   rF   rk   r~   r   r   r   r   r  r  r  r  r  r%   r*   r*   r*   r+   r    s*    

U

r  c                   @  sn   e Zd ZejZddd	Zed d
dZed!ddZ	ed!ddZ
d"ddZd#ddZd$ddZd%ddZdS )&MSCertificateTemplatetemplate_idr   major_versionr   minor_versionr!   rB   c                 C  sT   t |ts	td|| _|d urt |tr|d ur"t |ts"td|| _|| _d S )Noid must be an ObjectIdentifierz8major_version and minor_version must be integers or None)r$   r   rf   _template_idr/   _major_version_minor_version)r4   r  r  r  r*   r*   r+   rF   =  s   

zMSCertificateTemplate.__init__c                 C  r   r#   )r  r3   r*   r*   r+   r  Q  r   z!MSCertificateTemplate.template_idc                 C  r   r#   )r  r3   r*   r*   r+   r  U  r   z#MSCertificateTemplate.major_versionc                 C  r   r#   )r  r3   r*   r*   r+   r  Y  r   z#MSCertificateTemplate.minor_versionr.   c                 C  r  )Nz#<MSCertificateTemplate(template_id=z, major_version=z, minor_version=rj   )r  r  r  r3   r*   r*   r+   rk   ]  r   zMSCertificateTemplate.__repr__rx   ry   rz   c                 C  r   r#   )r$   r  r|   r  r  r  r}   r*   r*   r+   r~   d  r  zMSCertificateTemplate.__eq__r/   c                 C  r  r#   )r   r  r  r  r3   r*   r*   r+   r   n  r;  zMSCertificateTemplate.__hash__r"   c                 C  r   r#   r   r3   r*   r*   r+   r%   q  r   z"MSCertificateTemplate.public_bytesN)r  r   r  r   r  r   r!   rB   r   r   rl   r   r<   rT   )rM   rN   rO   r   ZMS_CERTIFICATE_TEMPLATErA   rF   r   r  r  r  rk   r~   r   r%   r*   r*   r*   r+   r  :  s    




r  c                   @  s^   e Zd Zddd	Zedd
dZedddZedddZdddZd ddZ	d!ddZ
dS )"NamingAuthorityidObjectIdentifier | Noneurlr/  textr!   rB   c                 C  sd   |d urt |tstd|d urt |tstd|d ur't |ts'td|| _|| _|| _d S )Nzid must be an ObjectIdentifierzurl must be a strztext must be a str)r$   r   rf   r.   _id_url_text)r4   r  r  r  r*   r*   r+   rF   v  s   
zNamingAuthority.__init__c                 C  r   r#   )r   r3   r*   r*   r+   r    r   zNamingAuthority.idc                 C  r   r#   )r  r3   r*   r*   r+   r    r   zNamingAuthority.urlc                 C  r   r#   )r  r3   r*   r*   r+   r    r   zNamingAuthority.textr.   c                 C  r  )Nz<NamingAuthority(id=z, url=z, text=rj   )r  r  r  r3   r*   r*   r+   rk     s   zNamingAuthority.__repr__rx   ry   rz   c                 C  r   r#   )r$   r  r|   r  r  r  r}   r*   r*   r+   r~     r  zNamingAuthority.__eq__r/   c                 C  r  r#   )r   r  r  r  r3   r*   r*   r+   r     s   zNamingAuthority.__hash__N)r  r  r  r/  r  r/  r!   rB   )r!   r  r4  rl   r   r<   )rM   rN   rO   rF   r   r  r  r  rk   r~   r   r*   r*   r*   r+   r  u  s    



r  c                   @  sz   e Zd Zd'ddZed(ddZed)ddZed*ddZed+ddZed,ddZ	d-ddZ
d.d!d"Zd/d$d%Zd&S )0ProfessionInfonaming_authorityNamingAuthority | Noneprofession_itemstyping.Iterable[str]profession_oids(typing.Iterable[ObjectIdentifier] | Noneregistration_numberr/  add_profession_infor   r!   rB   c                 C  s   |d urt |tstdt|}tdd |D std|d ur3t|}tdd |D s3td|d ur@t |ts@td|d urMt |tsMtd|| _|| _|| _	|| _
|| _d S )	N*naming_authority must be a NamingAuthorityc                 s  r   r#   )r$   r.   )r   itemr*   r*   r+   r     r   z*ProfessionInfo.__init__.<locals>.<genexpr>z5Every item in the profession_items list must be a strc                 s  r   r#   r@  )r   rA   r*   r*   r+   r     r   zBEvery item in the profession_oids list must be an ObjectIdentifierz!registration_number must be a strz!add_profession_info must be bytes)r$   r  rf   r[   r   r.   r"   _naming_authority_profession_items_profession_oids_registration_number_add_profession_info)r4   r  r  r  r
  r  r*   r*   r+   rF     s<   



zProfessionInfo.__init__c                 C  r   r#   r  r3   r*   r*   r+   r    r   zProfessionInfo.naming_authorityr  c                 C  r   r#   )r  r3   r*   r*   r+   r    r   zProfessionInfo.profession_itemslist[ObjectIdentifier] | Nonec                 C  r   r#   )r  r3   r*   r*   r+   r    r   zProfessionInfo.profession_oidsc                 C  r   r#   )r  r3   r*   r*   r+   r
    r   z"ProfessionInfo.registration_numberc                 C  r   r#   )r  r3   r*   r*   r+   r    r   z"ProfessionInfo.add_profession_infor.   c                 C  s.   d| j  d| j d| j d| j d| jdS )Nz!<ProfessionInfo(naming_authority=z, profession_items=z, profession_oids=z, registration_number=z, add_profession_info=rj   )r  r  r  r
  r  r3   r*   r*   r+   rk     s   
zProfessionInfo.__repr__rx   ry   rz   c                 C  sJ   t |tstS | j|jko$| j|jko$| j|jko$| j|jko$| j|jkS r#   )r$   r  r|   r  r  r  r
  r  r}   r*   r*   r+   r~     s   




zProfessionInfo.__eq__r/   c                 C  s8   | j d urt| j }nd }t| jt| j|| j| jfS r#   )r  r   r   r  r  r
  r  )r4   r  r*   r*   r+   r   	  s   
zProfessionInfo.__hash__N)r  r  r  r  r  r	  r
  r/  r  r   r!   rB   r!   r  )r!   r  )r!   r  r4  r   rl   r   r<   )rM   rN   rO   rF   r   r  r  r  r
  r  rk   r~   r   r*   r*   r*   r+   r    s    
-

	r  c                   @  s^   e Zd Zdd	d
ZedddZed ddZed!ddZd"ddZd#ddZ	d$ddZ
dS )%	Admissionadmission_authorityGeneralName | Noner  r  profession_infostyping.Iterable[ProfessionInfo]r!   rB   c                 C  sl   |d urt |tstd|d urt |tstdt|}tdd |D s+td|| _|| _|| _d S )Nz)admission_authority must be a GeneralNamer  c                 s  r   r#   )r$   r  )r   infor*   r*   r+   r   (	  r   z%Admission.__init__.<locals>.<genexpr>z@Every item in the profession_infos list must be a ProfessionInfo)	r$   r   rf   r  r[   r   _admission_authorityr  _profession_infos)r4   r  r  r  r*   r*   r+   rF   	  s$   


zAdmission.__init__c                 C  r   r#   )r  r3   r*   r*   r+   r  4	  r   zAdmission.admission_authorityc                 C  r   r#   r  r3   r*   r*   r+   r  8	  r   zAdmission.naming_authoritylist[ProfessionInfo]c                 C  r   r#   )r  r3   r*   r*   r+   r  <	  r   zAdmission.profession_infosr.   c                 C  r  )Nz<Admission(admission_authority=z, naming_authority=z, profession_infos=rj   )r  r  r  r3   r*   r*   r+   rk   @	  r   zAdmission.__repr__rx   ry   rz   c                 C  r   r#   )r$   r  r|   r  r  r  r}   r*   r*   r+   r~   G	  r  zAdmission.__eq__r/   c                 C  s   t | j| jt| jfS r#   )r   r  r  r   r  r3   r*   r*   r+   r   Q	  s   zAdmission.__hash__N)r  r  r  r  r  r  r!   rB   r!   r  r  )r!   r  rl   r   r<   )rM   rN   rO   rF   r   r  r  r  rk   r~   r   r*   r*   r*   r+   r  	  s    



r  c                   @  s`   e Zd ZejZdddZed	\ZZ	Z
edd
dZdddZdddZdddZd ddZdS )!
Admissions	authorityr  
admissionstyping.Iterable[Admission]r!   rB   c                 C  sL   |d urt |tstdt|}tdd |D std|| _|| _d S )Nzauthority must be a GeneralNamec                 s  r   r#   )r$   r  )r   Z	admissionr*   r*   r+   r   g	  r   z&Admissions.__init__.<locals>.<genexpr>zBEvery item in the contents_of_admissions list must be an Admission)r$   r   rf   r[   r   
_authority_admissions)r4   r!  r"  r*   r*   r+   rF   ^	  s   
zAdmissions.__init__r%  c                 C  r   r#   )r$  r3   r*   r*   r+   r!  t	  r   zAdmissions.authorityr.   c                 C  r   )Nz<Admissions(authority=z, admissions=rj   )r$  r%  r3   r*   r*   r+   rk   x	  r   zAdmissions.__repr__rx   ry   rz   c                 C  r   r#   )r$   r   r|   r!  r%  r}   r*   r*   r+   r~   ~	  r   zAdmissions.__eq__r/   c                 C  r:  r#   )r   r!  r   r%  r3   r*   r*   r+   r   	  r;  zAdmissions.__hash__r"   c                 C  r   r#   r   r3   r*   r*   r+   r%   	  r   zAdmissions.public_bytesN)r!  r  r"  r#  r!   rB   r  rl   r   r<   rT   )rM   rN   rO   r   Z
ADMISSIONSrA   rF   r=   rm   rn   ro   r   r!  rk   r~   r   r%   r*   r*   r*   r+   r   [	  s    



	r   c                   @  sZ   e Zd ZdddZedd	d
ZedddZdddZdddZd ddZ	dddZ
dS )!re   rA   r   rg   r"   r!   rB   c                 C  s"   t |ts	td|| _|| _d S )Nr  )r$   r   rf   r  r  )r4   rA   rg   r*   r*   r+   rF   	  s   

zUnrecognizedExtension.__init__c                 C  r   r#   r  r3   r*   r*   r+   rA   	  r   zUnrecognizedExtension.oidc                 C  r   r#   r  r3   r*   r*   r+   rg   	  r   zUnrecognizedExtension.valuer.   c                 C  r3  )Nz<UnrecognizedExtension(oid=r  rj   )rA   rg   r3   r*   r*   r+   rk   	  r   zUnrecognizedExtension.__repr__rx   ry   rz   c                 C  r   r#   )r$   re   r|   rA   rg   r}   r*   r*   r+   r~   	  r   zUnrecognizedExtension.__eq__r/   c                 C  r   r#   )r   rA   rg   r3   r*   r*   r+   r   	  r   zUnrecognizedExtension.__hash__c                 C  r   r#   rS  r3   r*   r*   r+   r%   	  s   z"UnrecognizedExtension.public_bytesN)rA   r   rg   r"   r!   rB   r   rT   rl   r   r<   )rM   rN   rO   rF   r   rA   rg   rk   r~   r   r%   r*   r*   r*   r+   re   	  s    



re   )r    r   r!   r"   )r-   r.   )p
__future__r   abcr  r&   rz  r  Zcryptographyr   Z"cryptography.hazmat.bindings._rustr   r   r   Zcryptography.hazmat.primitivesr   r   Z,cryptography.hazmat.primitives.asymmetric.ecr   Z-cryptography.hazmat.primitives.asymmetric.rsar	   Z/cryptography.hazmat.primitives.asymmetric.typesr
   r   Z*cryptography.x509.certificate_transparencyr   Zcryptography.x509.general_namer   r   r   r   r   r   r   r   r   Zcryptography.x509.namer   r   Zcryptography.x509.oidr   r   r   r   TypeVarr   r,   r=   	Exceptionr?   rR   ABCMetar   rW   rp   r   r   r   r   r   r   r   r   r   r   Enumr   r  r	  r
  r  r  r  r  r  Z_REASON_BIT_MAPPINGZ_CRLREASONFLAGSr   r   Z_CRL_ENTRY_REASON_ENUM_TO_CODEr  r  r!  r(  r0  r=  rC  rL  rM  rP  Z_TLS_FEATURE_TYPE_TO_ENUMrV  rY  rn  Genericr  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   re   r*   r*   r*   r+   <module>   s   ,

'l$!!(/%%kA9+("  s0PHHH$++ #;:gE3