o
    bi/                    @  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m	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Z0dddZ1G dd de2Z3G dd  d e2Z4G d!d dej5d"Z6G d#d$ d$Z7G d%d& d&e6Z8G d'd( d(e6Z9G d)d* d*e6Z:G d+d, d,e6Z;G d-d. d.e6Z<G d/d0 d0Z=G d1d2 d2e6Z>G d3d4 d4e6Z?G d5d6 d6e6Z@G d7d8 d8e6ZAG d9d: d:ZBG d;d< d<ejCZDeDjEeDjFeDjGeDjHeDjIeDjJeDjKeDjLd=ZMeDjEd>eDjFd?eDjGd@eDjHdAeDjIdBeDjJdCeDjKdDeDjLdEiZNeDjOd eDjEd>eDjFd?eDjGd@eDjHdAeDjIdBeDjJdCeDjPdEeDjKdFeDjLdGi
ZQG dHdI dIe6ZRG dJdK dKe6ZSG dLdM dMZTG dNdO dOZUG dPdQ dQZVG dRdS dSe6ZWG dTdU dUe6ZXG dVdW dWe6ZYG dXdY dYe6ZZG dZd[ d[ejCZ[d\d] e[D Z\G d^d_ d_e6Z]G d`da dae6Z^G dbdc dce6Z_G ddde dee6Z`G dfdg dgejae/ ZbG dhdi diZcG djdk dke6ZdG dldm dme6ZeG dndo doe6ZfG dpdq dqe6ZgG drds dse6ZhG dtdu due6ZiG dvdw dwe6ZjG dxdy dye6ZkG dzd{ d{e6ZlG d|d} d}e6ZmG d~d de6ZnG dd dZoG dd dZpG dd dZqG dd de6ZrG dd de6ZsdS )    )annotationsN)IterableIterator)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,   V/home/kim/smarthome/.venv/lib/python3.10/site-packages/cryptography/x509/extensions.py_key_identifier_from_public_key3   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_methodL      z*_make_sequence_methods.<locals>.len_methodc                   r2   r%   )iterr4   r5   r7   r,   r-   iter_methodO   r9   z+_make_sequence_methods.<locals>.iter_methodc                   s   t |  | S r%   )r4   )r6   idxr7   r,   r-   getitem_methodR   r9   z._make_sequence_methods.<locals>.getitem_methodr#   r1   r,   )r/   r8   r;   r=   r,   r7   r-   _make_sequence_methodsK   s   
r?   c                         e Zd Zd	 fddZ  ZS )
DuplicateExtensionmsgr0   oidr   r#   Nonec                      t  | || _d S r%   super__init__rC   r6   rB   rC   	__class__r,   r-   rH   Y      
zDuplicateExtension.__init__rB   r0   rC   r   r#   rD   __name__
__module____qualname__rH   __classcell__r,   r,   rJ   r-   rA   X       rA   c                      r@   )
ExtensionNotFoundrB   r0   rC   r   r#   rD   c                   rE   r%   rF   rI   rJ   r,   r-   rH   _   rL   zExtensionNotFound.__init__rM   rN   r,   r,   rJ   r-   rT   ^   rS   rT   c                   @  s    e Zd ZU ded< dddZdS )	r   z!typing.ClassVar[ObjectIdentifier]rC   r#   r$   c                 C  s   t d| )z7
        Serializes the extension type to DER.
        z3public_bytes is not implemented for extension type )NotImplementedErrorr5   r,   r,   r-   r'   g   s   zExtensionType.public_bytesNr#   r$   )rO   rP   rQ   __annotations__r'   r,   r,   r,   r-   r   d   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"Iterable[Extension[ExtensionType]]r#   rD   c                 C     t || _d S r%   )list_extensions)r6   rZ   r,   r,   r-   rH   q   r9   zExtensions.__init__rC   r   Extension[ExtensionType]c                 C  s.   | D ]}|j |kr|  S qtd| d|)NNo  extension was found)rC   rT   )r6   rC   extr,   r,   r-   get_extension_for_oidt   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`   ra   )UnrecognizedExtension	TypeErrorr&   valuerT   rC   )r6   rd   rb   r,   r,   r-   get_extension_for_class}   s   z"Extensions.get_extension_for_classr^   r0   c                 C     d| j  dS )Nz<Extensions()>)r^   r5   r,   r,   r-   __repr__   r9   zExtensions.__repr__N)rZ   r[   r#   rD   )rC   r   r#   r_   )rd   re   r#   rf   r#   r0   )rO   rP   rQ   rH   rc   rj   r?   __len____iter____getitem__rm   r,   r,   r,   r-   rY   p   s    


	rY   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_numberr1   r#   rD   c                 C     t |ts	td|| _d S Nzcrl_number must be an integerr&   r1   rh   _crl_numberr6   rs   r,   r,   r-   rH         

zCRLNumber.__init__otherobjectboolc                 C     t |tstS | j|jkS r%   )r&   rr   NotImplementedrs   r6   rz   r,   r,   r-   __eq__      
zCRLNumber.__eq__c                 C  
   t | jS r%   hashrs   r5   r,   r,   r-   __hash__      
zCRLNumber.__hash__r0   c                 C  rk   )Nz<CRLNumber(rl   rs   r5   r,   r,   r-   rm      r9   zCRLNumber.__repr__c                 C     | j S r%   rw   r5   r,   r,   r-   rs         zCRLNumber.crl_numberr$   c                 C  
   t | S r%   	rust_x509Zencode_extension_valuer5   r,   r,   r-   r'      r   zCRLNumber.public_bytesNrs   r1   r#   rD   rz   r{   r#   r|   r>   rn   rV   )rO   rP   rQ   r   Z
CRL_NUMBERrC   rH   r   r   rm   propertyrs   r'   r,   r,   r,   r-   rr          



rr   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Iterable[GeneralName] | Noneauthority_cert_serial_number
int | Noner#   rD   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]   allrh   r&   r1   _key_identifier_authority_cert_issuer_authority_cert_serial_number)r6   r   r   r   r,   r,   r-   rH      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_identifierr0   c                 C  s   d| j d| j d| j dS )Nz'<AuthorityKeyIdentifier(key_identifier=z, authority_cert_issuer=z, authority_cert_serial_number=rl   r   r5   r,   r,   r-   rm         
zAuthorityKeyIdentifier.__repr__rz   r{   r|   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__r1   c                 C  s,   | j d u rd }nt| j }t| j|| jfS r%   )r   tupler   r   r   )r6   Zacir,   r,   r-   r     s   

zAuthorityKeyIdentifier.__hash__c                 C  r   r%   )r   r5   r,   r,   r-   r     r   z%AuthorityKeyIdentifier.key_identifierlist[GeneralName] | Nonec                 C  r   r%   )r   r5   r,   r,   r-   r        z,AuthorityKeyIdentifier.authority_cert_issuerc                 C  r   r%   )r   r5   r,   r,   r-   r     r   z3AuthorityKeyIdentifier.authority_cert_serial_numberr$   c                 C  r   r%   r   r5   r,   r,   r-   r'     r   z#AuthorityKeyIdentifier.public_bytesN)r   r   r   r   r   r   r#   rD   )r"   r   r#   r   )r   r   r#   r   rn   r   r>   r#   r   r#   r   r#   r   rV   )rO   rP   rQ   r   ZAUTHORITY_KEY_IDENTIFIERrC   rH   classmethodr   r   rm   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#   rD   c                 C  s
   || _ d S r%   Z_digest)r6   r*   r,   r,   r-   rH   !  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   r5   r,   r,   r-   r*   *  r   zSubjectKeyIdentifier.digestc                 C  r   r%   r   r5   r,   r,   r-   r   .  r   z#SubjectKeyIdentifier.key_identifierr0   c                 C     d| j dS )Nz<SubjectKeyIdentifier(digest=rl   r   r5   r,   r,   r-   rm   2  r9   zSubjectKeyIdentifier.__repr__rz   r{   r|   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   5  s   
zSubjectKeyIdentifier.__eq__r1   c                 C  r   r%   )r   r*   r5   r,   r,   r-   r   ;  r   zSubjectKeyIdentifier.__hash__c                 C  r   r%   r   r5   r,   r,   r-   r'   >  r   z!SubjectKeyIdentifier.public_bytesN)r*   r$   r#   rD   )r"   r   r#   r   rV   rn   r   r>   )rO   rP   rQ   r   ZSUBJECT_KEY_IDENTIFIERrC   rH   r   r   r   r*   r   rm   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Iterable[AccessDescription]r#   rD   c                 C  ,   t |}tdd |D std|| _d S )Nc                 s  r   r%   r&   AccessDescriptionr   r,   r,   r-   r   G      z6AuthorityInformationAccess.__init__.<locals>.<genexpr>@Every item in the descriptions list must be an AccessDescriptionr]   r   rh   _descriptionsr6   r   r,   r,   r-   rH   E     
z#AuthorityInformationAccess.__init__r   r0   c                 C  rk   )Nz<AuthorityInformationAccess(rl   r   r5   r,   r,   r-   rm   Q  r9   z#AuthorityInformationAccess.__repr__rz   r{   r|   c                 C  r}   r%   )r&   r   r~   r   r   r,   r,   r-   r   T  r   z!AuthorityInformationAccess.__eq__r1   c                 C     t t| jS r%   r   r   r   r5   r,   r,   r-   r   Z  r9   z#AuthorityInformationAccess.__hash__r$   c                 C  r   r%   r   r5   r,   r,   r-   r'   ]  r   z'AuthorityInformationAccess.public_bytesNr   r   r#   rD   rn   r   r>   rV   )rO   rP   rQ   r   ZAUTHORITY_INFORMATION_ACCESSrC   rH   r?   ro   rp   rq   rm   r   r   r'   r,   r,   r,   r-   r   B      




r   c                   @  r   )SubjectInformationAccessr   r   r#   rD   c                 C  r   )Nc                 s  r   r%   r   r   r,   r,   r-   r   f  r   z4SubjectInformationAccess.__init__.<locals>.<genexpr>r   r   r   r,   r,   r-   rH   d  r   z!SubjectInformationAccess.__init__r   r0   c                 C  rk   )Nz<SubjectInformationAccess(rl   r   r5   r,   r,   r-   rm   p  r9   z!SubjectInformationAccess.__repr__rz   r{   r|   c                 C  r}   r%   )r&   r   r~   r   r   r,   r,   r-   r   s  r   zSubjectInformationAccess.__eq__r1   c                 C  r   r%   r   r5   r,   r,   r-   r   y  r9   z!SubjectInformationAccess.__hash__r$   c                 C  r   r%   r   r5   r,   r,   r-   r'   |  r   z%SubjectInformationAccess.public_bytesNr   rn   r   r>   rV   )rO   rP   rQ   r   ZSUBJECT_INFORMATION_ACCESSrC   rH   r?   ro   rp   rq   rm   r   r   r'   r,   r,   r,   r-   r   a  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#   rD   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   rh   r   _access_method_access_location)r6   r   r   r,   r,   r-   rH     s   


zAccessDescription.__init__r0   c                 C     d| j  d| j dS )Nz!<AccessDescription(access_method=z, access_location=rl   )r   r   r5   r,   r,   r-   rm        
zAccessDescription.__repr__rz   r{   r|   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__r1   c                 C     t | j| jfS r%   )r   r   r   r5   r,   r,   r-   r        zAccessDescription.__hash__c                 C  r   r%   )r   r5   r,   r,   r-   r     r   zAccessDescription.access_methodc                 C  r   r%   )r   r5   r,   r,   r-   r     r   z!AccessDescription.access_locationN)r   r   r   r   r#   rD   rn   r   r>   r#   r   )r#   r   )
rO   rP   rQ   rH   rm   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car|   path_lengthr   r#   rD   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&   r|   rh   r   r1   _ca_path_length)r6   r   r   r,   r,   r-   rH     s   

zBasicConstraints.__init__c                 C  r   r%   )r   r5   r,   r,   r-   r     r   zBasicConstraints.cac                 C  r   r%   )r   r5   r,   r,   r-   r     r   zBasicConstraints.path_lengthr0   c                 C  r   )Nz<BasicConstraints(ca=z, path_length=rl   )r   r   r5   r,   r,   r-   rm     s   zBasicConstraints.__repr__rz   r{   c                 C  r   r%   )r&   r   r~   r   r   r   r,   r,   r-   r        
zBasicConstraints.__eq__r1   c                 C  r   r%   )r   r   r   r5   r,   r,   r-   r     r   zBasicConstraints.__hash__r$   c                 C  r   r%   r   r5   r,   r,   r-   r'     r   zBasicConstraints.public_bytesN)r   r|   r   r   r#   rD   r#   r|   r   rn   r   r>   rV   )rO   rP   rQ   r   ZBASIC_CONSTRAINTSrC   rH   r   r   r   rm   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 )DeltaCRLIndicatorrs   r1   r#   rD   c                 C  rt   ru   rv   rx   r,   r,   r-   rH     ry   zDeltaCRLIndicator.__init__c                 C  r   r%   r   r5   r,   r,   r-   rs     r   zDeltaCRLIndicator.crl_numberrz   r{   r|   c                 C  r}   r%   )r&   r   r~   rs   r   r,   r,   r-   r     r   zDeltaCRLIndicator.__eq__c                 C  r   r%   r   r5   r,   r,   r-   r     r   zDeltaCRLIndicator.__hash__r0   c                 C  rk   )Nz<DeltaCRLIndicator(crl_number=rl   r   r5   r,   r,   r-   rm     r9   zDeltaCRLIndicator.__repr__r$   c                 C  r   r%   r   r5   r,   r,   r-   r'     r   zDeltaCRLIndicator.public_bytesNr   r>   r   rn   rV   )rO   rP   rQ   r   ZDELTA_CRL_INDICATORrC   rH   r   rs   r   r   rm   r'   r,   r,   r,   r-   r     s    



r   c                   @  r   )CRLDistributionPointsdistribution_pointsIterable[DistributionPoint]r#   rD   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   rh   _distribution_pointsr6   r   r,   r,   r-   rH        
zCRLDistributionPoints.__init__r   r0   c                 C  rk   )Nz<CRLDistributionPoints(rl   r   r5   r,   r,   r-   rm     r9   zCRLDistributionPoints.__repr__rz   r{   r|   c                 C  r}   r%   )r&   r   r~   r   r   r,   r,   r-   r     r   zCRLDistributionPoints.__eq__r1   c                 C  r   r%   r   r   r   r5   r,   r,   r-   r     r9   zCRLDistributionPoints.__hash__r$   c                 C  r   r%   r   r5   r,   r,   r-   r'     r   z"CRLDistributionPoints.public_bytesNr   r   r#   rD   rn   r   r>   rV   )rO   rP   rQ   r   ZCRL_DISTRIBUTION_POINTSrC   rH   r?   ro   rp   rq   rm   r   r   r'   r,   r,   r,   r-   r         




r   c                   @  r   )FreshestCRLr   r   r#   rD   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-   rH     r   zFreshestCRL.__init__r   r0   c                 C  rk   )Nz<FreshestCRL(rl   r   r5   r,   r,   r-   rm   -  r9   zFreshestCRL.__repr__rz   r{   r|   c                 C  r}   r%   )r&   r   r~   r   r   r,   r,   r-   r   0  r   zFreshestCRL.__eq__r1   c                 C  r   r%   r   r5   r,   r,   r-   r   6  r9   zFreshestCRL.__hash__r$   c                 C  r   r%   r   r5   r,   r,   r-   r'   9  r   zFreshestCRL.public_bytesNr   rn   r   r>   rV   )rO   rP   rQ   r   ZFRESHEST_CRLrC   rH   r?   ro   rp   rq   rm   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#   rD   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   R  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   _  r   z2crl_issuer must be None or a list of general namesc                 s  r   r%   r&   ReasonFlagsr   r,   r,   r-   r   f  r   z0reasons must be None or frozenset of ReasonFlagszLunspecified and remove_from_crl are not valid reasons in a DistributionPoint)r   r]   r   rh   r&   r   	frozensetr   unspecifiedremove_from_crl
_full_name_relative_name_reasons_crl_issuer)r6   r   r   r   r   r,   r,   r-   rH   >  sR   



zDistributionPoint.__init__r0   c                 C  
   d | S )Nz}<DistributionPoint(full_name={0.full_name}, relative_name={0.relative_name}, reasons={0.reasons}, crl_issuer={0.crl_issuer})>formatr5   r,   r,   r-   rm   x     zDistributionPoint.__repr__rz   r{   r|   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__r1   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   )r6   fnr   r,   r,   r-   r     s   

zDistributionPoint.__hash__r   c                 C  r   r%   r   r5   r,   r,   r-   r     r   zDistributionPoint.full_namec                 C  r   r%   r   r5   r,   r,   r-   r     r   zDistributionPoint.relative_namec                 C  r   r%   )r   r5   r,   r,   r-   r     r   zDistributionPoint.reasonsc                 C  r   r%   )r   r5   r,   r,   r-   r     r   zDistributionPoint.crl_issuerN)
r   r   r   r   r   r   r   r   r#   rD   rn   r   r>   r   r#   r   r#   r   )rO   rP   rQ   rH   rm   r   r   r   r   r   r   r   r,   r,   r,   r-   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   ZkeyCompromiseZcACompromiseZaffiliationChanged
supersededZcessationOfOperationZcertificateHoldZprivilegeWithdrawnZaACompromiseZremoveFromCRLN)rO   rP   rQ   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#   rD   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&   r1   rh   r   _require_explicit_policy_inhibit_policy_mapping)r6   r  r  r,   r,   r-   rH     s$   


zPolicyConstraints.__init__r0   c                 C  r   )Nz{<PolicyConstraints(require_explicit_policy={0.require_explicit_policy}, inhibit_policy_mapping={0.inhibit_policy_mapping})>r  r5   r,   r,   r-   rm     r  zPolicyConstraints.__repr__rz   r{   r|   c                 C  r   r%   )r&   r  r~   r  r  r   r,   r,   r-   r     r   zPolicyConstraints.__eq__r1   c                 C  r   r%   )r   r  r  r5   r,   r,   r-   r   !  s   
zPolicyConstraints.__hash__c                 C  r   r%   )r  r5   r,   r,   r-   r  &  r   z)PolicyConstraints.require_explicit_policyc                 C  r   r%   )r  r5   r,   r,   r-   r  *  r   z(PolicyConstraints.inhibit_policy_mappingr$   c                 C  r   r%   r   r5   r,   r,   r-   r'   .  r   zPolicyConstraints.public_bytesN)r  r   r  r   r#   rD   rn   r   r>   r   rV   )rO   rP   rQ   r   ZPOLICY_CONSTRAINTSrC   rH   rm   r   r   r   r  r  r'   r,   r,   r,   r-   r    s    



	r  c                   @  r   )CertificatePoliciespoliciesIterable[PolicyInformation]r#   rD   c                 C  r   )Nc                 s  r   r%   )r&   PolicyInformationr   r,   r,   r-   r   7  r   z/CertificatePolicies.__init__.<locals>.<genexpr>z;Every item in the policies list must be a PolicyInformation)r]   r   rh   	_policies)r6   r!  r,   r,   r-   rH   5     
zCertificatePolicies.__init__r$  r0   c                 C  rk   )Nz<CertificatePolicies(rl   )r$  r5   r,   r,   r-   rm   @  r9   zCertificatePolicies.__repr__rz   r{   r|   c                 C  r}   r%   )r&   r   r~   r$  r   r,   r,   r-   r   C  r   zCertificatePolicies.__eq__r1   c                 C  r   r%   )r   r   r$  r5   r,   r,   r-   r   I  r9   zCertificatePolicies.__hash__r$   c                 C  r   r%   r   r5   r,   r,   r-   r'   L  r   z CertificatePolicies.public_bytesN)r!  r"  r#   rD   rn   r   r>   rV   )rO   rP   rQ   r   ZCERTIFICATE_POLICIESrC   rH   r?   ro   rp   rq   rm   r   r   r'   r,   r,   r,   r-   r   2      
	


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!Iterable[str | UserNotice] | Noner#   rD   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&   r0   
UserNoticer   r,   r,   r-   r   ]  s    
z-PolicyInformation.__init__.<locals>.<genexpr>zMpolicy_qualifiers must be a list of strings and/or UserNotice objects or None)r&   r   rh   _policy_identifierr]   r   _policy_qualifiers)r6   r(  r)  r,   r,   r-   rH   Q  s   

zPolicyInformation.__init__r0   c                 C  r   )Nz%<PolicyInformation(policy_identifier=z, policy_qualifiers=rl   )r(  r)  r5   r,   r,   r-   rm   g  r   zPolicyInformation.__repr__rz   r{   r|   c                 C  r   r%   )r&   r#  r~   r(  r)  r   r,   r,   r-   r   m  r   zPolicyInformation.__eq__r1   c                 C  s(   | j d urt| j }nd }t| j|fS r%   )r)  r   r   r(  )r6   Zpqr,   r,   r-   r   v  s   
zPolicyInformation.__hash__c                 C  r   r%   )r,  r5   r,   r,   r-   r(  ~  r   z#PolicyInformation.policy_identifierlist[str | UserNotice] | Nonec                 C  r   r%   )r-  r5   r,   r,   r-   r)    r   z#PolicyInformation.policy_qualifiersN)r(  r   r)  r*  r#   rD   rn   r   r>   r   )r#   r.  )
rO   rP   rQ   rH   rm   r   r   r   r(  r)  r,   r,   r,   r-   r#  P  s    



	r#  c                   @  r   )r+  notice_referenceNoticeReference | Noneexplicit_text
str | Noner#   rD   c                 C  s&   |rt |tstd|| _|| _d S )Nz2notice_reference must be None or a NoticeReference)r&   NoticeReferencerh   _notice_reference_explicit_text)r6   r/  r1  r,   r,   r-   rH     s   
zUserNotice.__init__r0   c                 C     d| j  d| jdS )Nz<UserNotice(notice_reference=z, explicit_text=rl   )r/  r1  r5   r,   r,   r-   rm     r   zUserNotice.__repr__rz   r{   r|   c                 C  r   r%   )r&   r+  r~   r/  r1  r   r,   r,   r-   r     r   zUserNotice.__eq__r1   c                 C  r   r%   )r   r/  r1  r5   r,   r,   r-   r     r   zUserNotice.__hash__c                 C  r   r%   )r4  r5   r,   r,   r-   r/    r   zUserNotice.notice_referencec                 C  r   r%   )r5  r5   r,   r,   r-   r1    r   zUserNotice.explicit_textN)r/  r0  r1  r2  r#   rD   rn   r   r>   )r#   r0  r#   r2  )
rO   rP   rQ   rH   rm   r   r   r   r/  r1  r,   r,   r,   r-   r+    s    



	r+  c                   @  r'  ) r3  organizationr2  notice_numbersIterable[int]r#   rD   c                 C  s2   || _ t|}tdd |D std|| _d S )Nc                 s  r   r%   )r&   r1   r   r,   r,   r-   r     r   z+NoticeReference.__init__.<locals>.<genexpr>z)notice_numbers must be a list of integers)_organizationr]   r   rh   _notice_numbers)r6   r8  r9  r,   r,   r-   rH     s
   
zNoticeReference.__init__r0   c                 C  s   d| j d| j dS )Nz<NoticeReference(organization=z, notice_numbers=rl   )r8  r9  r5   r,   r,   r-   rm     r   zNoticeReference.__repr__rz   r{   r|   c                 C  r   r%   )r&   r3  r~   r8  r9  r   r,   r,   r-   r     r   zNoticeReference.__eq__r1   c                 C     t | jt| jfS r%   )r   r8  r   r9  r5   r,   r,   r-   r        zNoticeReference.__hash__c                 C  r   r%   )r;  r5   r,   r,   r-   r8    r   zNoticeReference.organization	list[int]c                 C  r   r%   )r<  r5   r,   r,   r-   r9    r   zNoticeReference.notice_numbersN)r8  r2  r9  r:  r#   rD   rn   r   r>   r7  )r#   r?  )
rO   rP   rQ   rH   rm   r   r   r   r8  r9  r,   r,   r,   r-   r3    r   r3  c                   @  r   )ExtendedKeyUsageusagesIterable[ObjectIdentifier]r#   rD   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   rh   _usages)r6   rA  r,   r,   r-   rH     r%  zExtendedKeyUsage.__init__rD  r0   c                 C  rk   )Nz<ExtendedKeyUsage(rl   )rD  r5   r,   r,   r-   rm     r9   zExtendedKeyUsage.__repr__rz   r{   r|   c                 C  r}   r%   )r&   r@  r~   rD  r   r,   r,   r-   r     r   zExtendedKeyUsage.__eq__r1   c                 C  r   r%   )r   r   rD  r5   r,   r,   r-   r     r9   zExtendedKeyUsage.__hash__r$   c                 C  r   r%   r   r5   r,   r,   r-   r'     r   zExtendedKeyUsage.public_bytesN)rA  rB  r#   rD   rn   r   r>   rV   )rO   rP   rQ   r   ZEXTENDED_KEY_USAGErC   rH   r?   ro   rp   rq   rm   r   r   r'   r,   r,   r,   r-   r@    r&  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 )OCSPNoCheckrz   r{   r#   r|   c                 C     t |tstS dS NT)r&   rF  r~   r   r,   r,   r-   r        
zOCSPNoCheck.__eq__r1   c                 C     t tS r%   )r   rF  r5   r,   r,   r-   r        zOCSPNoCheck.__hash__r0   c                 C     dS )Nz<OCSPNoCheck()>r,   r5   r,   r,   r-   rm        zOCSPNoCheck.__repr__r$   c                 C  r   r%   r   r5   r,   r,   r-   r'   	  r   zOCSPNoCheck.public_bytesNr   r>   rn   rV   )
rO   rP   rQ   r   ZOCSP_NO_CHECKrC   r   r   rm   r'   r,   r,   r,   r-   rF        


rF  c                   @  rE  )PrecertPoisonrz   r{   r#   r|   c                 C  rG  rH  )r&   rO  r~   r   r,   r,   r-   r     rI  zPrecertPoison.__eq__r1   c                 C  rJ  r%   )r   rO  r5   r,   r,   r-   r     rK  zPrecertPoison.__hash__r0   c                 C  rL  )Nz<PrecertPoison()>r,   r5   r,   r,   r-   rm     rM  zPrecertPoison.__repr__r$   c                 C  r   r%   r   r5   r,   r,   r-   r'     r   zPrecertPoison.public_bytesNr   r>   rn   rV   )
rO   rP   rQ   r   ZPRECERT_POISONrC   r   r   rm   r'   r,   r,   r,   r-   rO    rN  rO  c                   @  r   )
TLSFeaturefeaturesIterable[TLSFeatureType]r#   rD   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   r3   rh   	_features)r6   rQ  r,   r,   r-   rH   #  s   
zTLSFeature.__init__rT  r0   c                 C  rk   )Nz<TLSFeature(features=rl   )rT  r5   r,   r,   r-   rm   2  r9   zTLSFeature.__repr__rz   r{   r|   c                 C  r}   r%   )r&   rP  r~   rT  r   r,   r,   r-   r   5  r   zTLSFeature.__eq__r1   c                 C  r   r%   )r   r   rT  r5   r,   r,   r-   r   ;  r9   zTLSFeature.__hash__r$   c                 C  r   r%   r   r5   r,   r,   r-   r'   >  r   zTLSFeature.public_bytesN)rQ  rR  r#   rD   rn   r   r>   rV   )rO   rP   rQ   r   ZTLS_FEATURErC   rH   r?   ro   rp   rq   rm   r   r   r'   r,   r,   r,   r-   rP     s    



rP  c                   @  s   e Zd ZdZdZdS )rS  r     N)rO   rP   rQ   Zstatus_requestZstatus_request_v2r,   r,   r,   r-   rS  B  s    rS  c                 C  s   i | ]}|j |qS r,   ri   r   r,   r,   r-   
<dictcomp>M      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 )InhibitAnyPolicy
skip_certsr1   r#   rD   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&   r1   rh   r   _skip_certs)r6   rZ  r,   r,   r-   rH   S  s
   

zInhibitAnyPolicy.__init__r0   c                 C  rk   )Nz<InhibitAnyPolicy(skip_certs=rl   )rZ  r5   r,   r,   r-   rm   \  r9   zInhibitAnyPolicy.__repr__rz   r{   r|   c                 C  r}   r%   )r&   rY  r~   rZ  r   r,   r,   r-   r   _  r   zInhibitAnyPolicy.__eq__c                 C  r   r%   )r   rZ  r5   r,   r,   r-   r   e  r   zInhibitAnyPolicy.__hash__c                 C  r   r%   )r[  r5   r,   r,   r-   rZ  h  r   zInhibitAnyPolicy.skip_certsr$   c                 C  r   r%   r   r5   r,   r,   r-   r'   l  r   zInhibitAnyPolicy.public_bytesN)rZ  r1   r#   rD   rn   r   r>   rV   )rO   rP   rQ   r   ZINHIBIT_ANY_POLICYrC   rH   rm   r   r   r   rZ  r'   r,   r,   r,   r-   rY  P  s    

	

rY  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_signaturer|   content_commitmentkey_enciphermentdata_enciphermentkey_agreementkey_cert_signcrl_signencipher_onlydecipher_onlyr#   rD   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)
r6   r]  r^  r_  r`  ra  rb  rc  rd  re  r,   r,   r-   rH   s  s   
zKeyUsage.__init__c                 C  r   r%   )rf  r5   r,   r,   r-   r]    r   zKeyUsage.digital_signaturec                 C  r   r%   )rg  r5   r,   r,   r-   r^    r   zKeyUsage.content_commitmentc                 C  r   r%   )rh  r5   r,   r,   r-   r_    r   zKeyUsage.key_enciphermentc                 C  r   r%   )ri  r5   r,   r,   r-   r`    r   zKeyUsage.data_enciphermentc                 C  r   r%   )rj  r5   r,   r,   r-   ra    r   zKeyUsage.key_agreementc                 C  r   r%   )rk  r5   r,   r,   r-   rb    r   zKeyUsage.key_cert_signc                 C  r   r%   )rl  r5   r,   r,   r-   rc    r   zKeyUsage.crl_signc                 C     | j std| jS )Nz7encipher_only is undefined unless key_agreement is true)ra  r   rm  r5   r,   r,   r-   rd    
   zKeyUsage.encipher_onlyc                 C  ro  )Nz7decipher_only is undefined unless key_agreement is true)ra  r   rn  r5   r,   r,   r-   re    rp  zKeyUsage.decipher_onlyr0   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=rl   )
rd  re  r   r]  r^  r_  r`  ra  rb  rc  )r6   rd  re  r,   r,   r-   rm     s2   

zKeyUsage.__repr__rz   r{   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&   r\  r~   r]  r^  r_  r`  ra  rb  rc  rm  rn  r   r,   r,   r-   r     s&   








zKeyUsage.__eq__r1   c              
   C  s,   t | j| j| j| j| j| j| j| j| j	f	S r%   )
r   r]  r^  r_  r`  ra  rb  rc  rm  rn  r5   r,   r,   r-   r     s   zKeyUsage.__hash__r$   c                 C  r   r%   r   r5   r,   r,   r-   r'     r   zKeyUsage.public_bytesN)r]  r|   r^  r|   r_  r|   r`  r|   ra  r|   rb  r|   rc  r|   rd  r|   re  r|   r#   rD   r   rn   r   r>   rV   )rO   rP   rQ   r   Z	KEY_USAGErC   rH   r   r]  r^  r_  r`  ra  rb  rc  rd  re  rm   r   r   r'   r,   r,   r,   r-   r\  p  s2    



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 )!PrivateKeyUsagePeriod
not_beforedatetime.datetime | None	not_afterr#   rD   c                 C  s   t |tjs|d urtdt |tjs|d urtd|d u r(|d u r(td|d ur8|d ur8||kr8td|| _|| _d S )Nz.not_before must be a datetime.datetime or Nonez-not_after must be a datetime.datetime or Nonez9At least one of not_before and not_after must not be Nonez#not_before must be before not_after)r&   datetimerh   r   _not_before
_not_after)r6   rr  rt  r,   r,   r-   rH     s$   


zPrivateKeyUsagePeriod.__init__c                 C  r   r%   )rv  r5   r,   r,   r-   rr    r   z PrivateKeyUsagePeriod.not_beforec                 C  r   r%   )rw  r5   r,   r,   r-   rt    r   zPrivateKeyUsagePeriod.not_afterr0   c                 C  r   )Nz"<PrivateKeyUsagePeriod(not_before=z, not_after=rl   )rr  rt  r5   r,   r,   r-   rm      r   zPrivateKeyUsagePeriod.__repr__rz   r{   r|   c                 C  r   r%   )r&   rq  r~   rr  rt  r   r,   r,   r-   r   &  r   zPrivateKeyUsagePeriod.__eq__r1   c                 C  r   r%   )r   rr  rt  r5   r,   r,   r-   r   /  r   zPrivateKeyUsagePeriod.__hash__r$   c                 C  r   r%   r   r5   r,   r,   r-   r'   2  r   z"PrivateKeyUsagePeriod.public_bytesN)rr  rs  rt  rs  r#   rD   )r#   rs  rn   r   r>   rV   )rO   rP   rQ   r   ZPRIVATE_KEY_USAGE_PERIODrC   rH   r   rr  rt  rm   r   r   r'   r,   r,   r,   r-   rq    s    
 


	rq  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#   rD   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   D  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  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   rh   _validate_tree_permitted_subtrees_excluded_subtrees)r6   ry  rz  r,   r,   r-   rH   9  s8   


zNameConstraints.__init__rz   r{   r|   c                 C  r   r%   )r&   rx  r~   rz  ry  r   r,   r,   r-   r   c  r   zNameConstraints.__eq__treeIterable[GeneralName]c                 C  s   |  | | | d S r%   )_validate_ip_name_validate_dns_namer6   r~  r,   r,   r-   r{  l  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   ri   	ipaddressIPv4NetworkIPv6Networkr   namer,   r,   r-   r   q  s    

z4NameConstraints._validate_ip_name.<locals>.<genexpr>zGIPAddress name constraints must be an IPv4Network or IPv6Network object)anyrh   r  r,   r,   r-   r  p  s   z!NameConstraints._validate_ip_namec                 C  r  )Nc                 s  s$    | ]}t |tod |jv V  qdS )*N)r&   r   ri   r  r,   r,   r-   r   ~  s    
z5NameConstraints._validate_dns_name.<locals>.<genexpr>zDDNSName name constraints must not contain the '*' wildcard character)r  r   r  r,   r,   r-   r  }  s   z"NameConstraints._validate_dns_namer0   c                 C  r   )Nz$<NameConstraints(permitted_subtrees=z, excluded_subtrees=rl   )ry  rz  r5   r,   r,   r-   rm     r   zNameConstraints.__repr__r1   c                 C  s@   | j d urt| j }nd }| jd urt| j}nd }t||fS r%   )ry  r   rz  r   )r6   Zpsesr,   r,   r-   r     s   

zNameConstraints.__hash__r   c                 C  r   r%   )r|  r5   r,   r,   r-   ry    r   z"NameConstraints.permitted_subtreesc                 C  r   r%   )r}  r5   r,   r,   r-   rz    r   z!NameConstraints.excluded_subtreesr$   c                 C  r   r%   r   r5   r,   r,   r-   r'     r   zNameConstraints.public_bytesN)ry  r   rz  r   r#   rD   r   )r~  r  r#   rD   rn   r>   r   rV   )rO   rP   rQ   r   ZNAME_CONSTRAINTSrC   rH   r   r{  r  r  rm   r   r   ry  rz  r'   r,   r,   r,   r-   rx  6  s    

*
	


	
rx  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 )#	ExtensionrC   r   criticalr|   ri   r   r#   rD   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   rh   r|   _oid	_critical_value)r6   rC   r  ri   r,   r,   r-   rH     s   


zExtension.__init__c                 C  r   r%   r  r5   r,   r,   r-   rC     r   zExtension.oidc                 C  r   r%   )r  r5   r,   r,   r-   r    r   zExtension.criticalc                 C  r   r%   r  r5   r,   r,   r-   ri     r   zExtension.valuer0   c                 C     d| j  d| j d| j dS )Nz<Extension(oid=z, critical=, value=rl   )rC   r  ri   r5   r,   r,   r-   rm     s   zExtension.__repr__rz   r{   c                 C  r   r%   )r&   r  r~   rC   r  ri   r   r,   r,   r-   r        


zExtension.__eq__r1   c                 C     t | j| j| jfS r%   )r   rC   r  ri   r5   r,   r,   r-   r     r>  zExtension.__hash__N)rC   r   r  r|   ri   r   r#   rD   r   r   )r#   r   rn   r   r>   )rO   rP   rQ   rH   r   rC   r  ri   rm   r   r   r,   r,   r,   r-   r    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_namesr  r#   rD   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   rh   _general_namesr6   r  r,   r,   r-   rH     r   zGeneralNames.__init__r  typeBtype[DNSName] | type[UniformResourceIdentifier] | type[RFC822Name]	list[str]c                 C     d S r%   r,   r6   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,   rV  r  r,   r,   r-   
<listcomp>  s    z4GeneralNames.get_values_for_type.<locals>.<listcomp>)r   r]   )r6   r  Zobjsr,   r  r-   r    s   r0   c                 C  rk   )Nz<GeneralNames(rl   r  r5   r,   r,   r-   rm     r9   zGeneralNames.__repr__rz   r{   r|   c                 C  r}   r%   )r&   r  r~   r  r   r,   r,   r-   r     r   zGeneralNames.__eq__r1   c                 C  r   r%   )r   r   r  r5   r,   r,   r-   r   %  r9   zGeneralNames.__hash__Nr  r  r#   rD   r  r  r#   r  r  r  r#   r  r  r  r#   r  r  r  r#   r  r  r  r#   r  r  r  r#   r  rn   r   r>   )rO   rP   rQ   rH   r?   ro   rp   rq   typingoverloadr  rm   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  r  r#   rD   c                 C  r\   r%   r  r  r  r,   r,   r-   rH   ,  r9   zSubjectAlternativeName.__init__r  r  r  r  c                 C  r  r%   r,   r  r,   r,   r-   r  1  r  z*SubjectAlternativeName.get_values_for_typer  r  c                 C  r  r%   r,   r  r,   r,   r-   r  9  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  E  r  r  r  c                 C  r  r%   r,   r  r,   r,   r-   r  J  r  r  r  c                 C     | j |S r%   r  r  r  r,   r,   r-   r  O     r0   c                 C  rk   )Nz<SubjectAlternativeName(rl   r  r5   r,   r,   r-   rm   a  r9   zSubjectAlternativeName.__repr__rz   r{   r|   c                 C  r}   r%   )r&   r  r~   r  r   r,   r,   r-   r   d  r   zSubjectAlternativeName.__eq__r1   c                 C  r   r%   r   r  r5   r,   r,   r-   r   j  r   zSubjectAlternativeName.__hash__r$   c                 C  r   r%   r   r5   r,   r,   r-   r'   m  r   z#SubjectAlternativeName.public_bytesNr  r  r  r  r  r  r  rn   r   r>   rV   )rO   rP   rQ   r   ZSUBJECT_ALTERNATIVE_NAMErC   rH   r?   ro   rp   rq   r  r  r  rm   r   r   r'   r,   r,   r,   r-   r  )  &    




r  c                   @  r  )6IssuerAlternativeNamer  r  r#   rD   c                 C  r\   r%   r  r  r,   r,   r-   rH   t  r9   zIssuerAlternativeName.__init__r  r  r  r  c                 C  r  r%   r,   r  r,   r,   r-   r  y  r  z)IssuerAlternativeName.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  r0   c                 C  rk   )Nz<IssuerAlternativeName(rl   r  r5   r,   r,   r-   rm     r9   zIssuerAlternativeName.__repr__rz   r{   r|   c                 C  r}   r%   )r&   r  r~   r  r   r,   r,   r-   r     r   zIssuerAlternativeName.__eq__r1   c                 C  r   r%   r  r5   r,   r,   r-   r     r   zIssuerAlternativeName.__hash__r$   c                 C  r   r%   r   r5   r,   r,   r-   r'     r   z"IssuerAlternativeName.public_bytesNr  r  r  r  r  r  r  rn   r   r>   rV   )rO   rP   rQ   r   ZISSUER_ALTERNATIVE_NAMErC   rH   r?   ro   rp   rq   r  r  r  rm   r   r   r'   r,   r,   r,   r-   r  q  r  r  c                   @  r  )6CertificateIssuerr  r  r#   rD   c                 C  r\   r%   r  r  r,   r,   r-   rH     r9   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  r0   c                 C  rk   )Nz<CertificateIssuer(rl   r  r5   r,   r,   r-   rm     r9   zCertificateIssuer.__repr__rz   r{   r|   c                 C  r}   r%   )r&   r  r~   r  r   r,   r,   r-   r     r   zCertificateIssuer.__eq__r1   c                 C  r   r%   r  r5   r,   r,   r-   r     r   zCertificateIssuer.__hash__r$   c                 C  r   r%   r   r5   r,   r,   r-   r'     r   zCertificateIssuer.public_bytesNr  r  r  r  r  r  r  rn   r   r>   rV   )rO   rP   rQ   r   ZCERTIFICATE_ISSUERrC   rH   r?   ro   rp   rq   r  r  r  rm   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#   rD   c                 C  rt   )Nz*reason must be an element from ReasonFlags)r&   r   rh   _reason)r6   r  r,   r,   r-   rH     ry   zCRLReason.__init__r0   c                 C  rk   )Nz<CRLReason(reason=rl   r  r5   r,   r,   r-   rm   
  r9   zCRLReason.__repr__rz   r{   r|   c                 C  r}   r%   )r&   r  r~   r  r   r,   r,   r-   r     r   zCRLReason.__eq__r1   c                 C  r   r%   )r   r  r5   r,   r,   r-   r     r   zCRLReason.__hash__c                 C  r   r%   r  r5   r,   r,   r-   r    r   zCRLReason.reasonr$   c                 C  r   r%   r   r5   r,   r,   r-   r'     r   zCRLReason.public_bytesN)r  r   r#   rD   rn   r   r>   )r#   r   rV   )rO   rP   rQ   r   Z
CRL_REASONrC   rH   rm   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#   rD   c                 C  s   t |tjs
td|| _d S )Nz+invalidity_date must be a datetime.datetime)r&   ru  rh   _invalidity_date)r6   r  r,   r,   r-   rH   !  s   
zInvalidityDate.__init__r0   c                 C  rk   )Nz <InvalidityDate(invalidity_date=rl   r  r5   r,   r,   r-   rm   '  r9   zInvalidityDate.__repr__rz   r{   r|   c                 C  r}   r%   )r&   r  r~   r  r   r,   r,   r-   r   *  r   zInvalidityDate.__eq__r1   c                 C  r   r%   )r   r  r5   r,   r,   r-   r   0  r   zInvalidityDate.__hash__c                 C  r   r%   r  r5   r,   r,   r-   r  3  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  replaceru  timezoneutc
astimezoner5   r,   r,   r-   invalidity_date_utc7  s   z"InvalidityDate.invalidity_date_utcr$   c                 C  r   r%   r   r5   r,   r,   r-   r'   >  r   zInvalidityDate.public_bytesN)r  r  r#   rD   rn   r   r>   )r#   r  rV   )rO   rP   rQ   r   ZINVALIDITY_DATErC   rH   rm   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$Iterable[SignedCertificateTimestamp]r#   rD   c                 C  r   )Nc                 s  r   r%   r&   r   r   Zsctr,   r,   r-   r   J  
    
zEPrecertificateSignedCertificateTimestamps.__init__.<locals>.<genexpr>YEvery item in the signed_certificate_timestamps list must be a SignedCertificateTimestampr]   r   rh   _signed_certificate_timestampsr6   r  r,   r,   r-   rH   E     
z2PrecertificateSignedCertificateTimestamps.__init__r  r0   c                 C     dt |  dS )Nz+<PrecertificateSignedCertificateTimestamps(rl   r]   r5   r,   r,   r-   rm   X  r   z2PrecertificateSignedCertificateTimestamps.__repr__r1   c                 C  r   r%   r   r   r  r5   r,   r,   r-   r   [  r9   z2PrecertificateSignedCertificateTimestamps.__hash__rz   r{   r|   c                 C  r}   r%   )r&   r  r~   r  r   r,   r,   r-   r   ^     
z0PrecertificateSignedCertificateTimestamps.__eq__r$   c                 C  r   r%   r   r5   r,   r,   r-   r'   g  r   z6PrecertificateSignedCertificateTimestamps.public_bytesNr  r  r#   rD   rn   r>   r   rV   )rO   rP   rQ   r   Z%PRECERT_SIGNED_CERTIFICATE_TIMESTAMPSrC   rH   r?   ro   rp   rq   rm   r   r   r'   r,   r,   r,   r-   r  B      




	r  c                   @  r  )SignedCertificateTimestampsr  r  r#   rD   c                 C  r   )Nc                 s  r   r%   r  r  r,   r,   r-   r   s  r  z7SignedCertificateTimestamps.__init__.<locals>.<genexpr>r  r  r  r,   r,   r-   rH   n  r  z$SignedCertificateTimestamps.__init__r  r0   c                 C  r  )Nz<SignedCertificateTimestamps(rl   r  r5   r,   r,   r-   rm     r   z$SignedCertificateTimestamps.__repr__r1   c                 C  r   r%   r  r5   r,   r,   r-   r     r9   z$SignedCertificateTimestamps.__hash__rz   r{   r|   c                 C  r}   r%   )r&   r  r~   r  r   r,   r,   r-   r     r  z"SignedCertificateTimestamps.__eq__r$   c                 C  r   r%   r   r5   r,   r,   r-   r'     r   z(SignedCertificateTimestamps.public_bytesNr  rn   r>   r   rV   )rO   rP   rQ   r   ZSIGNED_CERTIFICATE_TIMESTAMPSrC   rH   r?   ro   rp   rq   rm   r   r   r'   r,   r,   r,   r-   r  k  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#   rD   c                 C  rt   )Nznonce must be bytes)r&   r$   rh   _nonce)r6   r  r,   r,   r-   rH     ry   zOCSPNonce.__init__rz   r{   r|   c                 C  r}   r%   )r&   r  r~   r  r   r,   r,   r-   r     r   zOCSPNonce.__eq__r1   c                 C  r   r%   )r   r  r5   r,   r,   r-   r     r   zOCSPNonce.__hash__r0   c                 C  r   )Nz<OCSPNonce(nonce=rl   )r  r5   r,   r,   r-   rm     r9   zOCSPNonce.__repr__c                 C  r   r%   )r  r5   r,   r,   r-   r    r   zOCSPNonce.noncec                 C  r   r%   r   r5   r,   r,   r-   r'     r   zOCSPNonce.public_bytesN)r  r$   r#   rD   r   r>   rn   rV   )rO   rP   rQ   r   ZNONCErC   rH   r   r   rm   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	responsesrB  r#   rD   c                 C  s,   t |}tdd |D rtd|| _d S )Nc                 s  s    | ]	}t |t V  qd S r%   rC  )r   rr,   r,   r-   r     s    z3OCSPAcceptableResponses.__init__.<locals>.<genexpr>z'All responses must be ObjectIdentifiers)r]   r  rh   
_responses)r6   r  r,   r,   r-   rH     s   
z OCSPAcceptableResponses.__init__rz   r{   r|   c                 C  r}   r%   )r&   r  r~   r  r   r,   r,   r-   r     r   zOCSPAcceptableResponses.__eq__r1   c                 C  r   r%   )r   r   r  r5   r,   r,   r-   r     r9   z OCSPAcceptableResponses.__hash__r0   c                 C  rk   )Nz#<OCSPAcceptableResponses(responses=rl   )r  r5   r,   r,   r-   rm     r9   z OCSPAcceptableResponses.__repr__Iterator[ObjectIdentifier]c                 C  r   r%   )r:   r  r5   r,   r,   r-   rp     r   z OCSPAcceptableResponses.__iter__r$   c                 C  r   r%   r   r5   r,   r,   r-   r'     r   z$OCSPAcceptableResponses.public_bytesN)r  rB  r#   rD   r   r>   rn   )r#   r  rV   )rO   rP   rQ   r   ZACCEPTABLE_RESPONSESrC   rH   r   r   rm   rp   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_certsr|   only_contains_ca_certsonly_some_reasonsr   indirect_crlonly_contains_attribute_certsr#   rD   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    rX  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   rh   r   r   r   r   r|   r3   r  _only_contains_user_certs_only_contains_ca_certs_indirect_crl_only_contains_attribute_certs_only_some_reasonsr   r   )	r6   r   r   r  r  r  r  r  Zcrl_constraintsr,   r,   r-   rH     sn   




z!IssuingDistributionPoint.__init__r0   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=rl   )r   r   r  r  r  r  r  r5   r,   r,   r-   rm   &  s   
z!IssuingDistributionPoint.__repr__rz   r{   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   2  s"   





zIssuingDistributionPoint.__eq__r1   c                 C  s$   t | j| j| j| j| j| j| jfS r%   )r   r   r   r  r  r  r  r  r5   r,   r,   r-   r   A  s   z!IssuingDistributionPoint.__hash__r   c                 C  r   r%   r  r5   r,   r,   r-   r   N  r   z"IssuingDistributionPoint.full_namec                 C  r   r%   r  r5   r,   r,   r-   r   R  r   z&IssuingDistributionPoint.relative_namec                 C  r   r%   )r  r5   r,   r,   r-   r  V  r   z1IssuingDistributionPoint.only_contains_user_certsc                 C  r   r%   )r  r5   r,   r,   r-   r  Z  r   z/IssuingDistributionPoint.only_contains_ca_certsc                 C  r   r%   )r  r5   r,   r,   r-   r  ^  r   z*IssuingDistributionPoint.only_some_reasonsc                 C  r   r%   )r  r5   r,   r,   r-   r  d  r   z%IssuingDistributionPoint.indirect_crlc                 C  r   r%   )r  r5   r,   r,   r-   r  h  r   z6IssuingDistributionPoint.only_contains_attribute_certsr$   c                 C  r   r%   r   r5   r,   r,   r-   r'   l  r   z%IssuingDistributionPoint.public_bytesN)r   r   r   r   r  r|   r  r|   r  r   r  r|   r  r|   r#   rD   rn   r   r>   r   r  r   r  rV   )rO   rP   rQ   r   ZISSUING_DISTRIBUTION_POINTrC   rH   rm   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#   rD   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   rh   _template_idr1   _major_version_minor_version)r6   r  r  r  r,   r,   r-   rH   s  s   

zMSCertificateTemplate.__init__c                 C  r   r%   )r  r5   r,   r,   r-   r    r   z!MSCertificateTemplate.template_idc                 C  r   r%   )r  r5   r,   r,   r-   r    r   z#MSCertificateTemplate.major_versionc                 C  r   r%   )r  r5   r,   r,   r-   r    r   z#MSCertificateTemplate.minor_versionr0   c                 C  r  )Nz#<MSCertificateTemplate(template_id=z, major_version=z, minor_version=rl   )r  r  r  r5   r,   r,   r-   rm     r   zMSCertificateTemplate.__repr__rz   r{   r|   c                 C  r   r%   )r&   r  r~   r  r  r  r   r,   r,   r-   r     r  zMSCertificateTemplate.__eq__r1   c                 C  r  r%   )r   r  r  r  r5   r,   r,   r-   r     r>  zMSCertificateTemplate.__hash__r$   c                 C  r   r%   r   r5   r,   r,   r-   r'     r   z"MSCertificateTemplate.public_bytesN)r  r   r  r   r  r   r#   rD   r   r   rn   r   r>   rV   )rO   rP   rQ   r   ZMS_CERTIFICATE_TEMPLATErC   rH   r   r  r  r  rm   r   r   r'   r,   r,   r,   r-   r  p  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urlr2  textr#   rD   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   rh   r0   _id_url_text)r6   r  r  r  r,   r,   r-   rH     s   
zNamingAuthority.__init__c                 C  r   r%   )r	  r5   r,   r,   r-   r    r   zNamingAuthority.idc                 C  r   r%   )r
  r5   r,   r,   r-   r    r   zNamingAuthority.urlc                 C  r   r%   )r  r5   r,   r,   r-   r    r   zNamingAuthority.textr0   c                 C  r  )Nz<NamingAuthority(id=z, url=z, text=rl   )r  r  r  r5   r,   r,   r-   rm     s   zNamingAuthority.__repr__rz   r{   r|   c                 C  r   r%   )r&   r  r~   r  r  r  r   r,   r,   r-   r     r  zNamingAuthority.__eq__r1   c                 C  r  r%   )r   r  r  r  r5   r,   r,   r-   r     s   zNamingAuthority.__hash__N)r  r  r  r2  r  r2  r#   rD   )r#   r  r7  rn   r   r>   )rO   rP   rQ   rH   r   r  r  r  rm   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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Iterable[str]profession_oids!Iterable[ObjectIdentifier] | Noneregistration_numberr2  add_profession_infor   r#   rD   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&   r0   )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%   rC  )r   rC   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  rh   r]   r   r0   r$   _naming_authority_profession_items_profession_oids_registration_number_add_profession_info)r6   r  r  r  r  r  r,   r,   r-   rH     s<   



zProfessionInfo.__init__c                 C  r   r%   r  r5   r,   r,   r-   r  	  r   zProfessionInfo.naming_authorityr  c                 C  r   r%   )r  r5   r,   r,   r-   r  	  r   zProfessionInfo.profession_itemslist[ObjectIdentifier] | Nonec                 C  r   r%   )r  r5   r,   r,   r-   r  	  r   zProfessionInfo.profession_oidsc                 C  r   r%   )r  r5   r,   r,   r-   r  	  r   z"ProfessionInfo.registration_numberc                 C  r   r%   )r  r5   r,   r,   r-   r  #	  r   z"ProfessionInfo.add_profession_infor0   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=rl   )r  r  r  r  r  r5   r,   r,   r-   rm   '	  s   
zProfessionInfo.__repr__rz   r{   r|   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   0	  s   




zProfessionInfo.__eq__r1   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  )r6   r  r,   r,   r-   r   <	  s   
zProfessionInfo.__hash__N)r  r  r  r  r  r  r  r2  r  r   r#   rD   r#   r  )r#   r  )r#   r  r7  r   rn   r   r>   )rO   rP   rQ   rH   r   r  r  r  r  r  rm   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Iterable[ProfessionInfo]r#   rD   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   rh   r  r]   r   _admission_authorityr  _profession_infos)r6   r   r  r"  r,   r,   r-   rH   M	  s$   


zAdmission.__init__c                 C  r   r%   )r%  r5   r,   r,   r-   r   j	  r   zAdmission.admission_authorityc                 C  r   r%   r  r5   r,   r,   r-   r  n	  r   zAdmission.naming_authoritylist[ProfessionInfo]c                 C  r   r%   )r&  r5   r,   r,   r-   r"  r	  r   zAdmission.profession_infosr0   c                 C  r  )Nz<Admission(admission_authority=z, naming_authority=z, profession_infos=rl   )r   r  r"  r5   r,   r,   r-   rm   v	  r   zAdmission.__repr__rz   r{   r|   c                 C  r   r%   )r&   r  r~   r   r  r"  r   r,   r,   r-   r   }	  r  zAdmission.__eq__r1   c                 C  s   t | j| jt| jfS r%   )r   r   r  r   r"  r5   r,   r,   r-   r   	  s   zAdmission.__hash__N)r   r!  r  r  r"  r#  r#   rD   r#   r!  r  )r#   r'  rn   r   r>   )rO   rP   rQ   rH   r   r   r  r"  rm   r   r   r,   r,   r,   r-   r  L	  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Iterable[Admission]r#   rD   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   	  r   z&Admissions.__init__.<locals>.<genexpr>zBEvery item in the contents_of_admissions list must be an Admission)r&   r   rh   r]   r   
_authority_admissions)r6   r*  r+  r,   r,   r-   rH   	  s   
zAdmissions.__init__r.  c                 C  r   r%   )r-  r5   r,   r,   r-   r*  	  r   zAdmissions.authorityr0   c                 C  r   )Nz<Admissions(authority=z, admissions=rl   )r-  r.  r5   r,   r,   r-   rm   	  r   zAdmissions.__repr__rz   r{   r|   c                 C  r   r%   )r&   r)  r~   r*  r.  r   r,   r,   r-   r   	  r   zAdmissions.__eq__r1   c                 C  r=  r%   )r   r*  r   r.  r5   r,   r,   r-   r   	  r>  zAdmissions.__hash__r$   c                 C  r   r%   r   r5   r,   r,   r-   r'   	  r   zAdmissions.public_bytesN)r*  r!  r+  r,  r#   rD   r(  rn   r   r>   rV   )rO   rP   rQ   r   Z
ADMISSIONSrC   rH   r?   ro   rp   rq   r   r*  rm   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 )!rg   rC   r   ri   r$   r#   rD   c                 C  s"   t |ts	td|| _|| _d S )Nr   )r&   r   rh   r  r  )r6   rC   ri   r,   r,   r-   rH   	  s   

zUnrecognizedExtension.__init__c                 C  r   r%   r  r5   r,   r,   r-   rC   	  r   zUnrecognizedExtension.oidc                 C  r   r%   r  r5   r,   r,   r-   ri   	  r   zUnrecognizedExtension.valuer0   c                 C  r6  )Nz<UnrecognizedExtension(oid=r  rl   )rC   ri   r5   r,   r,   r-   rm   	  s   zUnrecognizedExtension.__repr__rz   r{   r|   c                 C  r   r%   )r&   rg   r~   rC   ri   r   r,   r,   r-   r   	  r   zUnrecognizedExtension.__eq__r1   c                 C  r   r%   )r   rC   ri   r5   r,   r,   r-   r   	  r   zUnrecognizedExtension.__hash__c                 C  r   r%   rV  r5   r,   r,   r-   r'   	  s   z"UnrecognizedExtension.public_bytesN)rC   r   ri   r$   r#   rD   r   rV   rn   r   r>   )rO   rP   rQ   rH   r   rC   ri   rm   r   r   r'   r,   r,   r,   r-   rg   	  s    



rg   )r"   r   r#   r$   )r/   r0   )t
__future__r   abcru  r(   r  r  collections.abcr   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?   	ExceptionrA   rT   ABCMetar   rY   rr   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+  r3  r@  rF  rO  rP  rS  Z_TLS_FEATURE_TYPE_TO_ENUMrY  r\  rq  rx  Genericr  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r)  rg   r,   r,   r,   r-   <module>   s   ,

%l$(.%%kA9+("  As0PHHH$)) #;:gE3