o
    Th/                    @  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	   EncodingDERPublicFormatPKCS1r
   X962UncompressedPointSubjectPublicKeyInfor   parse_spki_for_datahashlibsha1digest)r"   data
serialized r5   \/home/air/segue/gpt/backup/venv/lib/python3.10/site-packages/cryptography/x509/extensions.py_key_identifier_from_public_key3   s    


r7   
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r8   r5   r6   
len_methodL      z*_make_sequence_methods.<locals>.len_methodc                   r;   r%   )iterr=   r>   r@   r5   r6   iter_methodO   rB   z+_make_sequence_methods.<locals>.iter_methodc                   s   t |  | S r%   )r=   )r?   idxr@   r5   r6   getitem_methodR   rB   z._make_sequence_methods.<locals>.getitem_methodr#   r:   r5   )r8   rA   rD   rF   r5   r@   r6   _make_sequence_methodsK   s   
rH   c                         e Zd Zd	 fddZ  ZS )
DuplicateExtensionmsgr9   oidr   r#   Nonec                      t  | || _d S r%   super__init__rL   r?   rK   rL   	__class__r5   r6   rQ   Y      
zDuplicateExtension.__init__rK   r9   rL   r   r#   rM   __name__
__module____qualname__rQ   __classcell__r5   r5   rS   r6   rJ   X       rJ   c                      rI   )
ExtensionNotFoundrK   r9   rL   r   r#   rM   c                   rN   r%   rO   rR   rS   r5   r6   rQ   _   rU   zExtensionNotFound.__init__rV   rW   r5   r5   rS   r6   r]   ^   r\   r]   c                   @  s    e Zd ZU ded< dddZdS )	r   z!typing.ClassVar[ObjectIdentifier]rL   r#   r$   c                 C  s   t d| )z7
        Serializes the extension type to DER.
        z3public_bytes is not implemented for extension type )NotImplementedErrorr>   r5   r5   r6   r'   g   s   zExtensionType.public_bytesNr#   r$   )rX   rY   rZ   __annotations__r'   r5   r5   r5   r6   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#   rM   c                 C     t || _d S r%   )list_extensions)r?   rc   r5   r5   r6   rQ   q   rB   zExtensions.__init__rL   r   Extension[ExtensionType]c                 C  s.   | D ]}|j |kr|  S qtd| d|)NNo  extension was found)rL   r]   )r?   rL   extr5   r5   r6   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.ri   rj   )UnrecognizedExtension	TypeErrorr&   valuer]   rL   )r?   rm   rk   r5   r5   r6   get_extension_for_class}   s   z"Extensions.get_extension_for_classrg   r9   c                 C     d| j  dS )Nz<Extensions()>)rg   r>   r5   r5   r6   __repr__   rB   zExtensions.__repr__N)rc   rd   r#   rM   )rL   r   r#   rh   )rm   rn   r#   ro   r#   r9   )rX   rY   rZ   rQ   rl   rs   rH   __len____iter____getitem__rv   r5   r5   r5   r6   rb   p   s    


	rb   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#   rM   c                 C     t |ts	td|| _d S Nzcrl_number must be an integerr&   r:   rq   _crl_numberr?   r|   r5   r5   r6   rQ         

zCRLNumber.__init__otherobjectboolc                 C     t |tstS | j|jkS r%   )r&   r{   NotImplementedr|   r?   r   r5   r5   r6   __eq__      
zCRLNumber.__eq__c                 C  
   t | jS r%   hashr|   r>   r5   r5   r6   __hash__      
zCRLNumber.__hash__r9   c                 C  rt   )Nz<CRLNumber(ru   r|   r>   r5   r5   r6   rv      rB   zCRLNumber.__repr__c                 C     | j S r%   r   r>   r5   r5   r6   r|         zCRLNumber.crl_numberr$   c                 C  
   t | S r%   	rust_x509encode_extension_valuer>   r5   r5   r6   r'      r   zCRLNumber.public_bytesNr|   r:   r#   rM   r   r   r#   r   rG   rw   r_   )rX   rY   rZ   r   
CRL_NUMBERrL   rQ   r   r   rv   propertyr|   r'   r5   r5   r5   r6   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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#   rM   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xr5   r5   r6   	<genexpr>       

z2AuthorityKeyIdentifier.__init__.<locals>.<genexpr>z;authority_cert_issuer must be a list of GeneralName objectsz/authority_cert_serial_number must be an integer)	
ValueErrorrf   allrq   r&   r:   _key_identifier_authority_cert_issuer_authority_cert_serial_number)r?   r   r   r   r5   r5   r6   rQ      s*   

zAuthorityKeyIdentifier.__init__r"   r   c                 C  s   t |}| |d d dS Nr   r   r   r7   )clsr"   r2   r5   r5   r6   from_issuer_public_key   s   z-AuthorityKeyIdentifier.from_issuer_public_keyskiSubjectKeyIdentifierc                 C  s   | |j d d dS r   r2   )r   r   r5   r5   r6   "from_issuer_subject_key_identifier   s
   z9AuthorityKeyIdentifier.from_issuer_subject_key_identifierr9   c                 C  s   d| j d| j d| j dS )Nz'<AuthorityKeyIdentifier(key_identifier=z, authority_cert_issuer=z, authority_cert_serial_number=ru   r   r>   r5   r5   r6   rv         
zAuthorityKeyIdentifier.__repr__r   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   r5   r5   r6   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   )r?   acir5   r5   r6   r     s   

zAuthorityKeyIdentifier.__hash__c                 C  r   r%   )r   r>   r5   r5   r6   r     r   z%AuthorityKeyIdentifier.key_identifierlist[GeneralName] | Nonec                 C  r   r%   )r   r>   r5   r5   r6   r        z,AuthorityKeyIdentifier.authority_cert_issuerc                 C  r   r%   )r   r>   r5   r5   r6   r     r   z3AuthorityKeyIdentifier.authority_cert_serial_numberr$   c                 C  r   r%   r   r>   r5   r5   r6   r'     r   z#AuthorityKeyIdentifier.public_bytesN)r   r   r   r   r   r   r#   rM   )r"   r   r#   r   )r   r   r#   r   rw   r   rG   r#   r   r#   r   r#   r   r_   )rX   rY   rZ   r   AUTHORITY_KEY_IDENTIFIERrL   rQ   classmethodr   r   rv   r   r   r   r   r   r   r'   r5   r5   r5   r6   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   r2   r$   r#   rM   c                 C  s
   || _ d S r%   _digest)r?   r2   r5   r5   r6   rQ   !  r   zSubjectKeyIdentifier.__init__r"   r   c                 C  s   | t |S r%   r   )r   r"   r5   r5   r6   from_public_key$  s   z$SubjectKeyIdentifier.from_public_keyc                 C  r   r%   r   r>   r5   r5   r6   r2   *  r   zSubjectKeyIdentifier.digestc                 C  r   r%   r   r>   r5   r5   r6   r   .  r   z#SubjectKeyIdentifier.key_identifierr9   c                 C     d| j dS )Nz<SubjectKeyIdentifier(digest=ru   r   r>   r5   r5   r6   rv   2  rB   zSubjectKeyIdentifier.__repr__r   r   r   c                 C  s   t |tstS t| j|jS r%   )r&   r   r   r   bytes_eqr2   r   r5   r5   r6   r   5  s   
zSubjectKeyIdentifier.__eq__r:   c                 C  r   r%   )r   r2   r>   r5   r5   r6   r   ;  r   zSubjectKeyIdentifier.__hash__c                 C  r   r%   r   r>   r5   r5   r6   r'   >  r   z!SubjectKeyIdentifier.public_bytesN)r2   r$   r#   rM   )r"   r   r#   r   r_   rw   r   rG   )rX   rY   rZ   r   SUBJECT_KEY_IDENTIFIERrL   rQ   r   r   r   r2   r   rv   r   r   r'   r5   r5   r5   r6   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#   rM   c                 C  ,   t |}tdd |D std|| _d S )Nc                 s  r   r%   r&   AccessDescriptionr   r5   r5   r6   r   G      z6AuthorityInformationAccess.__init__.<locals>.<genexpr>@Every item in the descriptions list must be an AccessDescriptionrf   r   rq   _descriptionsr?   r   r5   r5   r6   rQ   E     
z#AuthorityInformationAccess.__init__r   r9   c                 C  rt   )Nz<AuthorityInformationAccess(ru   r   r>   r5   r5   r6   rv   Q  rB   z#AuthorityInformationAccess.__repr__r   r   r   c                 C  r   r%   )r&   r   r   r   r   r5   r5   r6   r   T  r   z!AuthorityInformationAccess.__eq__r:   c                 C     t t| jS r%   r   r   r   r>   r5   r5   r6   r   Z  rB   z#AuthorityInformationAccess.__hash__r$   c                 C  r   r%   r   r>   r5   r5   r6   r'   ]  r   z'AuthorityInformationAccess.public_bytesNr   r   r#   rM   rw   r   rG   r_   )rX   rY   rZ   r   AUTHORITY_INFORMATION_ACCESSrL   rQ   rH   rx   ry   rz   rv   r   r   r'   r5   r5   r5   r6   r   B      




r   c                   @  r   )SubjectInformationAccessr   r   r#   rM   c                 C  r   )Nc                 s  r   r%   r   r   r5   r5   r6   r   f  r   z4SubjectInformationAccess.__init__.<locals>.<genexpr>r   r   r   r5   r5   r6   rQ   d  r   z!SubjectInformationAccess.__init__r   r9   c                 C  rt   )Nz<SubjectInformationAccess(ru   r   r>   r5   r5   r6   rv   p  rB   z!SubjectInformationAccess.__repr__r   r   r   c                 C  r   r%   )r&   r   r   r   r   r5   r5   r6   r   s  r   zSubjectInformationAccess.__eq__r:   c                 C  r   r%   r   r>   r5   r5   r6   r   y  rB   z!SubjectInformationAccess.__hash__r$   c                 C  r   r%   r   r>   r5   r5   r6   r'   |  r   z%SubjectInformationAccess.public_bytesNr   rw   r   rG   r_   )rX   rY   rZ   r   SUBJECT_INFORMATION_ACCESSrL   rQ   rH   rx   ry   rz   rv   r   r   r'   r5   r5   r5   r6   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#   rM   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   rq   r   _access_method_access_location)r?   r   r   r5   r5   r6   rQ     s   


zAccessDescription.__init__r9   c                 C     d| j  d| j dS )Nz!<AccessDescription(access_method=z, access_location=ru   )r   r   r>   r5   r5   r6   rv        
zAccessDescription.__repr__r   r   r   c                 C  &   t |tstS | j|jko| j|jkS r%   )r&   r   r   r   r   r   r5   r5   r6   r     
   

zAccessDescription.__eq__r:   c                 C     t | j| jfS r%   )r   r   r   r>   r5   r5   r6   r        zAccessDescription.__hash__c                 C  r   r%   )r   r>   r5   r5   r6   r     r   zAccessDescription.access_methodc                 C  r   r%   )r   r>   r5   r5   r6   r     r   z!AccessDescription.access_locationN)r   r   r   r   r#   rM   rw   r   rG   r#   r   )r#   r   )
rX   rY   rZ   rQ   rv   r   r   r   r   r   r5   r5   r5   r6   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#   rM   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   rq   r   r:   _ca_path_length)r?   r   r   r5   r5   r6   rQ     s   

zBasicConstraints.__init__c                 C  r   r%   )r   r>   r5   r5   r6   r     r   zBasicConstraints.cac                 C  r   r%   )r   r>   r5   r5   r6   r     r   zBasicConstraints.path_lengthr9   c                 C  r   )Nz<BasicConstraints(ca=z, path_length=ru   )r   r   r>   r5   r5   r6   rv     s   zBasicConstraints.__repr__r   r   c                 C  r   r%   )r&   r   r   r   r   r   r5   r5   r6   r        
zBasicConstraints.__eq__r:   c                 C  r   r%   )r   r   r   r>   r5   r5   r6   r     r   zBasicConstraints.__hash__r$   c                 C  r   r%   r   r>   r5   r5   r6   r'     r   zBasicConstraints.public_bytesN)r   r   r   r   r#   rM   r#   r   r   rw   r   rG   r_   )rX   rY   rZ   r   BASIC_CONSTRAINTSrL   rQ   r   r   r   rv   r   r   r'   r5   r5   r5   r6   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 )DeltaCRLIndicatorr|   r:   r#   rM   c                 C  r}   r~   r   r   r5   r5   r6   rQ     r   zDeltaCRLIndicator.__init__c                 C  r   r%   r   r>   r5   r5   r6   r|     r   zDeltaCRLIndicator.crl_numberr   r   r   c                 C  r   r%   )r&   r   r   r|   r   r5   r5   r6   r     r   zDeltaCRLIndicator.__eq__c                 C  r   r%   r   r>   r5   r5   r6   r     r   zDeltaCRLIndicator.__hash__r9   c                 C  rt   )Nz<DeltaCRLIndicator(crl_number=ru   r   r>   r5   r5   r6   rv     rB   zDeltaCRLIndicator.__repr__r$   c                 C  r   r%   r   r>   r5   r5   r6   r'     r   zDeltaCRLIndicator.public_bytesNr   rG   r   rw   r_   )rX   rY   rZ   r   DELTA_CRL_INDICATORrL   rQ   r   r|   r   r   rv   r'   r5   r5   r5   r6   r     s    



r   c                   @  r   )CRLDistributionPointsdistribution_pointsIterable[DistributionPoint]r#   rM   c                 C  r   )Nc                 s  r   r%   r&   DistributionPointr   r5   r5   r6   r     r   z1CRLDistributionPoints.__init__.<locals>.<genexpr>?distribution_points must be a list of DistributionPoint objectsrf   r   rq   _distribution_pointsr?   r   r5   r5   r6   rQ        
zCRLDistributionPoints.__init__r   r9   c                 C  rt   )Nz<CRLDistributionPoints(ru   r   r>   r5   r5   r6   rv     rB   zCRLDistributionPoints.__repr__r   r   r   c                 C  r   r%   )r&   r   r   r   r   r5   r5   r6   r     r   zCRLDistributionPoints.__eq__r:   c                 C  r   r%   r   r   r   r>   r5   r5   r6   r     rB   zCRLDistributionPoints.__hash__r$   c                 C  r   r%   r   r>   r5   r5   r6   r'     r   z"CRLDistributionPoints.public_bytesNr   r   r#   rM   rw   r   rG   r_   )rX   rY   rZ   r   CRL_DISTRIBUTION_POINTSrL   rQ   rH   rx   ry   rz   rv   r   r   r'   r5   r5   r5   r6   r         




r   c                   @  r   )FreshestCRLr   r   r#   rM   c                 C  r   )Nc                 s  r   r%   r   r   r5   r5   r6   r     r   z'FreshestCRL.__init__.<locals>.<genexpr>r   r   r   r5   r5   r6   rQ     r   zFreshestCRL.__init__r   r9   c                 C  rt   )Nz<FreshestCRL(ru   r   r>   r5   r5   r6   rv   -  rB   zFreshestCRL.__repr__r   r   r   c                 C  r   r%   )r&   r  r   r   r   r5   r5   r6   r   0  r   zFreshestCRL.__eq__r:   c                 C  r   r%   r  r>   r5   r5   r6   r   6  rB   zFreshestCRL.__hash__r$   c                 C  r   r%   r   r>   r5   r5   r6   r'   9  r   zFreshestCRL.public_bytesNr  rw   r   rG   r_   )rX   rY   rZ   r   FRESHEST_CRLrL   rQ   rH   rx   ry   rz   rv   r   r   r'   r5   r5   r5   r6   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#   rM   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   r5   r5   r6   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   r5   r5   r6   r   _  r   z2crl_issuer must be None or a list of general namesc                 s  r   r%   r&   ReasonFlagsr   r5   r5   r6   r   f  r   z0reasons must be None or frozenset of ReasonFlagszLunspecified and remove_from_crl are not valid reasons in a DistributionPoint)r   rf   r   rq   r&   r   	frozensetr  unspecifiedremove_from_crl
_full_name_relative_name_reasons_crl_issuer)r?   r  r  r
  r  r5   r5   r6   rQ   >  sR   



zDistributionPoint.__init__r9   c                 C  
   d | S )Nz}<DistributionPoint(full_name={0.full_name}, relative_name={0.relative_name}, reasons={0.reasons}, crl_issuer={0.crl_issuer})>formatr>   r5   r5   r6   rv   x     zDistributionPoint.__repr__r   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   r5   r5   r6   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
  )r?   fnr  r5   r5   r6   r     s   

zDistributionPoint.__hash__r   c                 C  r   r%   r  r>   r5   r5   r6   r    r   zDistributionPoint.full_namec                 C  r   r%   r  r>   r5   r5   r6   r    r   zDistributionPoint.relative_namec                 C  r   r%   )r  r>   r5   r5   r6   r
    r   zDistributionPoint.reasonsc                 C  r   r%   )r  r>   r5   r5   r6   r    r   zDistributionPoint.crl_issuerN)
r  r   r  r	  r
  r  r  r   r#   rM   rw   r   rG   r   r#   r	  r#   r  )rX   rY   rZ   rQ   rv   r   r   r   r  r  r
  r  r5   r5   r5   r6   r   =  s    

:

r   c                   @  s4   e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdS )r  r  keyCompromisecACompromiseaffiliationChanged
supersededcessationOfOperationcertificateHoldprivilegeWithdrawnaACompromiseremoveFromCRLN)rX   rY   rZ   r  key_compromiseca_compromiseaffiliation_changedr"  cessation_of_operationcertificate_holdprivilege_withdrawnaa_compromiser  r5   r5   r5   r6   r    s    r  )                        r/  r0  r1  r2  r3  r4  r5  r6  	   
   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#   rM   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:   rq   r   _require_explicit_policy_inhibit_policy_mapping)r?   r:  r;  r5   r5   r6   rQ     s$   


zPolicyConstraints.__init__r9   c                 C  r  )Nz{<PolicyConstraints(require_explicit_policy={0.require_explicit_policy}, inhibit_policy_mapping={0.inhibit_policy_mapping})>r  r>   r5   r5   r6   rv     r  zPolicyConstraints.__repr__r   r   r   c                 C  r   r%   )r&   r9  r   r:  r;  r   r5   r5   r6   r     r   zPolicyConstraints.__eq__r:   c                 C  r   r%   )r   r:  r;  r>   r5   r5   r6   r   !  s   
zPolicyConstraints.__hash__c                 C  r   r%   )r<  r>   r5   r5   r6   r:  &  r   z)PolicyConstraints.require_explicit_policyc                 C  r   r%   )r=  r>   r5   r5   r6   r;  *  r   z(PolicyConstraints.inhibit_policy_mappingr$   c                 C  r   r%   r   r>   r5   r5   r6   r'   .  r   zPolicyConstraints.public_bytesN)r:  r   r;  r   r#   rM   rw   r   rG   r   r_   )rX   rY   rZ   r   POLICY_CONSTRAINTSrL   rQ   rv   r   r   r   r:  r;  r'   r5   r5   r5   r6   r9    s    



	r9  c                   @  r   )CertificatePoliciespoliciesIterable[PolicyInformation]r#   rM   c                 C  r   )Nc                 s  r   r%   )r&   PolicyInformationr   r5   r5   r6   r   7  r   z/CertificatePolicies.__init__.<locals>.<genexpr>z;Every item in the policies list must be a PolicyInformation)rf   r   rq   	_policies)r?   r@  r5   r5   r6   rQ   5     
zCertificatePolicies.__init__rC  r9   c                 C  rt   )Nz<CertificatePolicies(ru   )rC  r>   r5   r5   r6   rv   @  rB   zCertificatePolicies.__repr__r   r   r   c                 C  r   r%   )r&   r?  r   rC  r   r5   r5   r6   r   C  r   zCertificatePolicies.__eq__r:   c                 C  r   r%   )r   r   rC  r>   r5   r5   r6   r   I  rB   zCertificatePolicies.__hash__r$   c                 C  r   r%   r   r>   r5   r5   r6   r'   L  r   z CertificatePolicies.public_bytesN)r@  rA  r#   rM   rw   r   rG   r_   )rX   rY   rZ   r   CERTIFICATE_POLICIESrL   rQ   rH   rx   ry   rz   rv   r   r   r'   r5   r5   r5   r6   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 ) rB  policy_identifierr   policy_qualifiers!Iterable[str | UserNotice] | Noner#   rM   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&   r9   
UserNoticer   r5   r5   r6   r   ]  s    
z-PolicyInformation.__init__.<locals>.<genexpr>zMpolicy_qualifiers must be a list of strings and/or UserNotice objects or None)r&   r   rq   _policy_identifierrf   r   _policy_qualifiers)r?   rH  rI  r5   r5   r6   rQ   Q  s   

zPolicyInformation.__init__r9   c                 C  r   )Nz%<PolicyInformation(policy_identifier=z, policy_qualifiers=ru   )rH  rI  r>   r5   r5   r6   rv   g  r   zPolicyInformation.__repr__r   r   r   c                 C  r   r%   )r&   rB  r   rH  rI  r   r5   r5   r6   r   m  r   zPolicyInformation.__eq__r:   c                 C  s(   | j d urt| j }nd }t| j|fS r%   )rI  r   r   rH  )r?   pqr5   r5   r6   r   v  s   
zPolicyInformation.__hash__c                 C  r   r%   )rL  r>   r5   r5   r6   rH  ~  r   z#PolicyInformation.policy_identifierlist[str | UserNotice] | Nonec                 C  r   r%   )rM  r>   r5   r5   r6   rI    r   z#PolicyInformation.policy_qualifiersN)rH  r   rI  rJ  r#   rM   rw   r   rG   r   )r#   rO  )
rX   rY   rZ   rQ   rv   r   r   r   rH  rI  r5   r5   r5   r6   rB  P  s    



	rB  c                   @  r   )rK  notice_referenceNoticeReference | Noneexplicit_text
str | Noner#   rM   c                 C  s&   |rt |tstd|| _|| _d S )Nz2notice_reference must be None or a NoticeReference)r&   NoticeReferencerq   _notice_reference_explicit_text)r?   rP  rR  r5   r5   r6   rQ     s   
zUserNotice.__init__r9   c                 C     d| j  d| jdS )Nz<UserNotice(notice_reference=z, explicit_text=ru   )rP  rR  r>   r5   r5   r6   rv     r   zUserNotice.__repr__r   r   r   c                 C  r   r%   )r&   rK  r   rP  rR  r   r5   r5   r6   r     r   zUserNotice.__eq__r:   c                 C  r   r%   )r   rP  rR  r>   r5   r5   r6   r     r   zUserNotice.__hash__c                 C  r   r%   )rU  r>   r5   r5   r6   rP    r   zUserNotice.notice_referencec                 C  r   r%   )rV  r>   r5   r5   r6   rR    r   zUserNotice.explicit_textN)rP  rQ  rR  rS  r#   rM   rw   r   rG   )r#   rQ  r#   rS  )
rX   rY   rZ   rQ   rv   r   r   r   rP  rR  r5   r5   r5   r6   rK    s    



	rK  c                   @  rG  ) rT  organizationrS  notice_numbersIterable[int]r#   rM   c                 C  s2   || _ t|}tdd |D std|| _d S )Nc                 s  r   r%   )r&   r:   r   r5   r5   r6   r     r   z+NoticeReference.__init__.<locals>.<genexpr>z)notice_numbers must be a list of integers)_organizationrf   r   rq   _notice_numbers)r?   rY  rZ  r5   r5   r6   rQ     s
   
zNoticeReference.__init__r9   c                 C  s   d| j d| j dS )Nz<NoticeReference(organization=z, notice_numbers=ru   )rY  rZ  r>   r5   r5   r6   rv     r   zNoticeReference.__repr__r   r   r   c                 C  r   r%   )r&   rT  r   rY  rZ  r   r5   r5   r6   r     r   zNoticeReference.__eq__r:   c                 C     t | jt| jfS r%   )r   rY  r   rZ  r>   r5   r5   r6   r        zNoticeReference.__hash__c                 C  r   r%   )r\  r>   r5   r5   r6   rY    r   zNoticeReference.organization	list[int]c                 C  r   r%   )r]  r>   r5   r5   r6   rZ    r   zNoticeReference.notice_numbersN)rY  rS  rZ  r[  r#   rM   rw   r   rG   rX  )r#   r`  )
rX   rY   rZ   rQ   rv   r   r   r   rY  rZ  r5   r5   r5   r6   rT    r   rT  c                   @  r   )ExtendedKeyUsageusagesIterable[ObjectIdentifier]r#   rM   c                 C  r   )Nc                 s  r   r%   r&   r   r   r5   r5   r6   r     r   z,ExtendedKeyUsage.__init__.<locals>.<genexpr>z9Every item in the usages list must be an ObjectIdentifier)rf   r   rq   _usages)r?   rb  r5   r5   r6   rQ     rD  zExtendedKeyUsage.__init__re  r9   c                 C  rt   )Nz<ExtendedKeyUsage(ru   )re  r>   r5   r5   r6   rv     rB   zExtendedKeyUsage.__repr__r   r   r   c                 C  r   r%   )r&   ra  r   re  r   r5   r5   r6   r     r   zExtendedKeyUsage.__eq__r:   c                 C  r   r%   )r   r   re  r>   r5   r5   r6   r     rB   zExtendedKeyUsage.__hash__r$   c                 C  r   r%   r   r>   r5   r5   r6   r'     r   zExtendedKeyUsage.public_bytesN)rb  rc  r#   rM   rw   r   rG   r_   )rX   rY   rZ   r   EXTENDED_KEY_USAGErL   rQ   rH   rx   ry   rz   rv   r   r   r'   r5   r5   r5   r6   ra    rF  ra  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 )OCSPNoCheckr   r   r#   r   c                 C     t |tstS dS NT)r&   rh  r   r   r5   r5   r6   r        
zOCSPNoCheck.__eq__r:   c                 C     t tS r%   )r   rh  r>   r5   r5   r6   r        zOCSPNoCheck.__hash__r9   c                 C     dS )Nz<OCSPNoCheck()>r5   r>   r5   r5   r6   rv        zOCSPNoCheck.__repr__r$   c                 C  r   r%   r   r>   r5   r5   r6   r'   	  r   zOCSPNoCheck.public_bytesNr   rG   rw   r_   )
rX   rY   rZ   r   OCSP_NO_CHECKrL   r   r   rv   r'   r5   r5   r5   r6   rh        


rh  c                   @  rg  )PrecertPoisonr   r   r#   r   c                 C  ri  rj  )r&   rr  r   r   r5   r5   r6   r     rk  zPrecertPoison.__eq__r:   c                 C  rl  r%   )r   rr  r>   r5   r5   r6   r     rm  zPrecertPoison.__hash__r9   c                 C  rn  )Nz<PrecertPoison()>r5   r>   r5   r5   r6   rv     ro  zPrecertPoison.__repr__r$   c                 C  r   r%   r   r>   r5   r5   r6   r'     r   zPrecertPoison.public_bytesNr   rG   rw   r_   )
rX   rY   rZ   r   PRECERT_POISONrL   r   r   rv   r'   r5   r5   r5   r6   rr    rq  rr  c                   @  r   )
TLSFeaturefeaturesIterable[TLSFeatureType]r#   rM   c                 C  s8   t |}tdd |D rt|dkrtd|| _d S )Nc                 s  r   r%   )r&   TLSFeatureTyper   r5   r5   r6   r   &  r   z&TLSFeature.__init__.<locals>.<genexpr>r   z@features must be a list of elements from the TLSFeatureType enum)rf   r   r<   rq   	_features)r?   ru  r5   r5   r6   rQ   #  s   
zTLSFeature.__init__rx  r9   c                 C  rt   )Nz<TLSFeature(features=ru   )rx  r>   r5   r5   r6   rv   2  rB   zTLSFeature.__repr__r   r   r   c                 C  r   r%   )r&   rt  r   rx  r   r5   r5   r6   r   5  r   zTLSFeature.__eq__r:   c                 C  r   r%   )r   r   rx  r>   r5   r5   r6   r   ;  rB   zTLSFeature.__hash__r$   c                 C  r   r%   r   r>   r5   r5   r6   r'   >  r   zTLSFeature.public_bytesN)ru  rv  r#   rM   rw   r   rG   r_   )rX   rY   rZ   r   TLS_FEATURErL   rQ   rH   rx   ry   rz   rv   r   r   r'   r5   r5   r5   r6   rt     s    



rt  c                   @  s   e Zd ZdZdZdS )rw  r3     N)rX   rY   rZ   status_requeststatus_request_v2r5   r5   r5   r6   rw  B  s    rw  c                 C  s   i | ]}|j |qS r5   rr   r   r5   r5   r6   
<dictcomp>M      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 )InhibitAnyPolicy
skip_certsr:   r#   rM   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:   rq   r   _skip_certs)r?   r  r5   r5   r6   rQ   S  s
   

zInhibitAnyPolicy.__init__r9   c                 C  rt   )Nz<InhibitAnyPolicy(skip_certs=ru   )r  r>   r5   r5   r6   rv   \  rB   zInhibitAnyPolicy.__repr__r   r   r   c                 C  r   r%   )r&   r  r   r  r   r5   r5   r6   r   _  r   zInhibitAnyPolicy.__eq__c                 C  r   r%   )r   r  r>   r5   r5   r6   r   e  r   zInhibitAnyPolicy.__hash__c                 C  r   r%   )r  r>   r5   r5   r6   r  h  r   zInhibitAnyPolicy.skip_certsr$   c                 C  r   r%   r   r>   r5   r5   r6   r'   l  r   zInhibitAnyPolicy.public_bytesN)r  r:   r#   rM   rw   r   rG   r_   )rX   rY   rZ   r   INHIBIT_ANY_POLICYrL   rQ   rv   r   r   r   r  r'   r5   r5   r5   r6   r  P  s    

	

r  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#   rM   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)
r?   r  r  r  r  r  r  r  r  r  r5   r5   r6   rQ   s  s   
zKeyUsage.__init__c                 C  r   r%   )r  r>   r5   r5   r6   r    r   zKeyUsage.digital_signaturec                 C  r   r%   )r  r>   r5   r5   r6   r    r   zKeyUsage.content_commitmentc                 C  r   r%   )r  r>   r5   r5   r6   r    r   zKeyUsage.key_enciphermentc                 C  r   r%   )r  r>   r5   r5   r6   r    r   zKeyUsage.data_enciphermentc                 C  r   r%   )r  r>   r5   r5   r6   r    r   zKeyUsage.key_agreementc                 C  r   r%   )r  r>   r5   r5   r6   r    r   zKeyUsage.key_cert_signc                 C  r   r%   )r  r>   r5   r5   r6   r    r   zKeyUsage.crl_signc                 C     | j std| jS )Nz7encipher_only is undefined unless key_agreement is true)r  r   r  r>   r5   r5   r6   r    
   zKeyUsage.encipher_onlyc                 C  r  )Nz7decipher_only is undefined unless key_agreement is true)r  r   r  r>   r5   r5   r6   r    r  zKeyUsage.decipher_onlyr9   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=ru   )
r  r  r   r  r  r  r  r  r  r  )r?   r  r  r5   r5   r6   rv     s2   

zKeyUsage.__repr__r   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  r  r  r  r  r  r   r5   r5   r6   r     s&   








zKeyUsage.__eq__r:   c              
   C  s,   t | j| j| j| j| j| j| j| j| j	f	S r%   )
r   r  r  r  r  r  r  r  r  r  r>   r5   r5   r6   r     s   zKeyUsage.__hash__r$   c                 C  r   r%   r   r>   r5   r5   r6   r'     r   zKeyUsage.public_bytesN)r  r   r  r   r  r   r  r   r  r   r  r   r  r   r  r   r  r   r#   rM   r   rw   r   rG   r_   )rX   rY   rZ   r   	KEY_USAGErL   rQ   r   r  r  r  r  r  r  r  r  r  rv   r   r   r'   r5   r5   r5   r6   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#   rM   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&   datetimerq   r   _not_before
_not_after)r?   r  r  r5   r5   r6   rQ     s$   


zPrivateKeyUsagePeriod.__init__c                 C  r   r%   )r  r>   r5   r5   r6   r    r   z PrivateKeyUsagePeriod.not_beforec                 C  r   r%   )r  r>   r5   r5   r6   r    r   zPrivateKeyUsagePeriod.not_afterr9   c                 C  r   )Nz"<PrivateKeyUsagePeriod(not_before=z, not_after=ru   )r  r  r>   r5   r5   r6   rv      r   zPrivateKeyUsagePeriod.__repr__r   r   r   c                 C  r   r%   )r&   r  r   r  r  r   r5   r5   r6   r   &  r   zPrivateKeyUsagePeriod.__eq__r:   c                 C  r   r%   )r   r  r  r>   r5   r5   r6   r   /  r   zPrivateKeyUsagePeriod.__hash__r$   c                 C  r   r%   r   r>   r5   r5   r6   r'   2  r   z"PrivateKeyUsagePeriod.public_bytesN)r  r  r  r  r#   rM   )r#   r  rw   r   rG   r_   )rX   rY   rZ   r   PRIVATE_KEY_USAGE_PERIODrL   rQ   r   r  r  rv   r   r   r'   r5   r5   r5   r6   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	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#   rM   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   r5   r5   r6   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   r5   r5   r6   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)rf   r   r   rq   _validate_tree_permitted_subtrees_excluded_subtrees)r?   r  r  r5   r5   r6   rQ   9  s8   


zNameConstraints.__init__r   r   r   c                 C  r   r%   )r&   r  r   r  r  r   r5   r5   r6   r   c  r   zNameConstraints.__eq__treeIterable[GeneralName]c                 C  s   |  | | | d S r%   )_validate_ip_name_validate_dns_namer?   r  r5   r5   r6   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   rr   	ipaddressIPv4NetworkIPv6Networkr   namer5   r5   r6   r   q  s    

z4NameConstraints._validate_ip_name.<locals>.<genexpr>zGIPAddress name constraints must be an IPv4Network or IPv6Network object)anyrq   r  r5   r5   r6   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   rr   r  r5   r5   r6   r   ~  s    
z5NameConstraints._validate_dns_name.<locals>.<genexpr>zDDNSName name constraints must not contain the '*' wildcard character)r  r   r  r5   r5   r6   r  }  s   z"NameConstraints._validate_dns_namer9   c                 C  r   )Nz$<NameConstraints(permitted_subtrees=z, excluded_subtrees=ru   )r  r  r>   r5   r5   r6   rv     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%   )r  r   r  r   )r?   psesr5   r5   r6   r     s   

zNameConstraints.__hash__r   c                 C  r   r%   )r  r>   r5   r5   r6   r    r   z"NameConstraints.permitted_subtreesc                 C  r   r%   )r  r>   r5   r5   r6   r    r   z!NameConstraints.excluded_subtreesr$   c                 C  r   r%   r   r>   r5   r5   r6   r'     r   zNameConstraints.public_bytesN)r  r   r  r   r#   rM   r   )r  r  r#   rM   rw   rG   r   r_   )rX   rY   rZ   r   NAME_CONSTRAINTSrL   rQ   r   r  r  r  rv   r   r   r  r  r'   r5   r5   r5   r6   r  6  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 )#	ExtensionrL   r   criticalr   rr   r   r#   rM   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   rq   r   _oid	_critical_value)r?   rL   r  rr   r5   r5   r6   rQ     s   


zExtension.__init__c                 C  r   r%   r  r>   r5   r5   r6   rL     r   zExtension.oidc                 C  r   r%   )r  r>   r5   r5   r6   r    r   zExtension.criticalc                 C  r   r%   r  r>   r5   r5   r6   rr     r   zExtension.valuer9   c                 C     d| j  d| j d| j dS )Nz<Extension(oid=z, critical=, value=ru   )rL   r  rr   r>   r5   r5   r6   rv     s   zExtension.__repr__r   r   c                 C  r   r%   )r&   r  r   rL   r  rr   r   r5   r5   r6   r        


zExtension.__eq__r:   c                 C     t | j| j| jfS r%   )r   rL   r  rr   r>   r5   r5   r6   r     r_  zExtension.__hash__N)rL   r   r  r   rr   r   r#   rM   r   r   )r#   r   rw   r   rG   )rX   rY   rZ   rQ   r   rL   r  rr   rv   r   r   r5   r5   r5   r6   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#   rM   c                 C  r   )Nc                 s  r   r%   r   r   r5   r5   r6   r     r   z(GeneralNames.__init__.<locals>.<genexpr>z^Every item in the general_names list must be an object conforming to the GeneralName interface)rf   r   rq   _general_namesr?   r  r5   r5   r6   rQ     r   zGeneralNames.__init__r  typeBtype[DNSName] | type[UniformResourceIdentifier] | type[RFC822Name]	list[str]c                 C     d S r%   r5   r?   r  r5   r5   r6   get_values_for_type     z GeneralNames.get_values_for_typetype[DirectoryName]
list[Name]c                 C  r  r%   r5   r  r5   r5   r6   r       type[RegisteredID]list[ObjectIdentifier]c                 C  r  r%   r5   r  r5   r5   r6   r    r  type[IPAddress]list[_IPAddressTypes]c                 C  r  r%   r5   r  r5   r5   r6   r       type[OtherName]list[OtherName]c                 C  r  r%   r5   r  r5   r5   r6   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  r5   r6   r     s    z3GeneralNames.get_values_for_type.<locals>.<genexpr>c                 S  s   g | ]}|j qS r5   r}  r  r5   r5   r6   
<listcomp>  s    z4GeneralNames.get_values_for_type.<locals>.<listcomp>)r   rf   )r?   r  objsr5   r  r6   r    s   r9   c                 C  rt   )Nz<GeneralNames(ru   r  r>   r5   r5   r6   rv     rB   zGeneralNames.__repr__r   r   r   c                 C  r   r%   )r&   r  r   r  r   r5   r5   r6   r     r   zGeneralNames.__eq__r:   c                 C  r   r%   )r   r   r  r>   r5   r5   r6   r   %  rB   zGeneralNames.__hash__Nr  r  r#   rM   r  r  r#   r  r  r  r#   r  r  r  r#   r  r  r  r#   r  r  r  r#   r  r  r  r#   r  rw   r   rG   )rX   rY   rZ   rQ   rH   rx   ry   rz   typingoverloadr  rv   r   r   r5   r5   r5   r6   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#   rM   c                 C  re   r%   r  r  r  r5   r5   r6   rQ   ,  rB   zSubjectAlternativeName.__init__r  r  r  r  c                 C  r  r%   r5   r  r5   r5   r6   r  1  r  z*SubjectAlternativeName.get_values_for_typer  r  c                 C  r  r%   r5   r  r5   r5   r6   r  9  r  r  r  c                 C  r  r%   r5   r  r5   r5   r6   r  ?  r  r  r  c                 C  r  r%   r5   r  r5   r5   r6   r  E  r  r  r  c                 C  r  r%   r5   r  r5   r5   r6   r  J  r  r  r  c                 C     | j |S r%   r  r  r  r5   r5   r6   r  O     r9   c                 C  rt   )Nz<SubjectAlternativeName(ru   r  r>   r5   r5   r6   rv   a  rB   zSubjectAlternativeName.__repr__r   r   r   c                 C  r   r%   )r&   r  r   r  r   r5   r5   r6   r   d  r   zSubjectAlternativeName.__eq__r:   c                 C  r   r%   r   r  r>   r5   r5   r6   r   j  r   zSubjectAlternativeName.__hash__r$   c                 C  r   r%   r   r>   r5   r5   r6   r'   m  r   z#SubjectAlternativeName.public_bytesNr  r  r  r  r  r  r  rw   r   rG   r_   )rX   rY   rZ   r   SUBJECT_ALTERNATIVE_NAMErL   rQ   rH   rx   ry   rz   r  r  r  rv   r   r   r'   r5   r5   r5   r6   r  )  &    




r  c                   @  r  )6IssuerAlternativeNamer  r  r#   rM   c                 C  re   r%   r  r  r5   r5   r6   rQ   t  rB   zIssuerAlternativeName.__init__r  r  r  r  c                 C  r  r%   r5   r  r5   r5   r6   r  y  r  z)IssuerAlternativeName.get_values_for_typer  r  c                 C  r  r%   r5   r  r5   r5   r6   r    r  r  r  c                 C  r  r%   r5   r  r5   r5   r6   r    r  r  r  c                 C  r  r%   r5   r  r5   r5   r6   r    r  r  r  c                 C  r  r%   r5   r  r5   r5   r6   r    r  r  r  c                 C  r  r%   r  r  r5   r5   r6   r    r  r9   c                 C  rt   )Nz<IssuerAlternativeName(ru   r  r>   r5   r5   r6   rv     rB   zIssuerAlternativeName.__repr__r   r   r   c                 C  r   r%   )r&   r  r   r  r   r5   r5   r6   r     r   zIssuerAlternativeName.__eq__r:   c                 C  r   r%   r  r>   r5   r5   r6   r     r   zIssuerAlternativeName.__hash__r$   c                 C  r   r%   r   r>   r5   r5   r6   r'     r   z"IssuerAlternativeName.public_bytesNr  r  r  r  r  r  r  rw   r   rG   r_   )rX   rY   rZ   r   ISSUER_ALTERNATIVE_NAMErL   rQ   rH   rx   ry   rz   r  r  r  rv   r   r   r'   r5   r5   r5   r6   r  q  r  r  c                   @  r  )6CertificateIssuerr  r  r#   rM   c                 C  re   r%   r  r  r5   r5   r6   rQ     rB   zCertificateIssuer.__init__r  r  r  r  c                 C  r  r%   r5   r  r5   r5   r6   r    r  z%CertificateIssuer.get_values_for_typer  r  c                 C  r  r%   r5   r  r5   r5   r6   r    r  r  r  c                 C  r  r%   r5   r  r5   r5   r6   r    r  r  r  c                 C  r  r%   r5   r  r5   r5   r6   r    r  r  r  c                 C  r  r%   r5   r  r5   r5   r6   r    r  r  r  c                 C  r  r%   r  r  r5   r5   r6   r    r  r9   c                 C  rt   )Nz<CertificateIssuer(ru   r  r>   r5   r5   r6   rv     rB   zCertificateIssuer.__repr__r   r   r   c                 C  r   r%   )r&   r  r   r  r   r5   r5   r6   r     r   zCertificateIssuer.__eq__r:   c                 C  r   r%   r  r>   r5   r5   r6   r     r   zCertificateIssuer.__hash__r$   c                 C  r   r%   r   r>   r5   r5   r6   r'     r   zCertificateIssuer.public_bytesNr  r  r  r  r  r  r  rw   r   rG   r_   )rX   rY   rZ   r   CERTIFICATE_ISSUERrL   rQ   rH   rx   ry   rz   r  r  r  rv   r   r   r'   r5   r5   r5   r6   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#   rM   c                 C  r}   )Nz*reason must be an element from ReasonFlags)r&   r  rq   _reason)r?   r  r5   r5   r6   rQ     r   zCRLReason.__init__r9   c                 C  rt   )Nz<CRLReason(reason=ru   r  r>   r5   r5   r6   rv   
  rB   zCRLReason.__repr__r   r   r   c                 C  r   r%   )r&   r  r   r  r   r5   r5   r6   r     r   zCRLReason.__eq__r:   c                 C  r   r%   )r   r  r>   r5   r5   r6   r     r   zCRLReason.__hash__c                 C  r   r%   r  r>   r5   r5   r6   r    r   zCRLReason.reasonr$   c                 C  r   r%   r   r>   r5   r5   r6   r'     r   zCRLReason.public_bytesN)r  r  r#   rM   rw   r   rG   )r#   r  r_   )rX   rY   rZ   r   
CRL_REASONrL   rQ   rv   r   r   r   r  r'   r5   r5   r5   r6   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#   rM   c                 C  s   t |tjs
td|| _d S )Nz+invalidity_date must be a datetime.datetime)r&   r  rq   _invalidity_date)r?   r  r5   r5   r6   rQ   !  s   
zInvalidityDate.__init__r9   c                 C  rt   )Nz <InvalidityDate(invalidity_date=ru   r  r>   r5   r5   r6   rv   '  rB   zInvalidityDate.__repr__r   r   r   c                 C  r   r%   )r&   r  r   r  r   r5   r5   r6   r   *  r   zInvalidityDate.__eq__r:   c                 C  r   r%   )r   r  r>   r5   r5   r6   r   0  r   zInvalidityDate.__hash__c                 C  r   r%   r  r>   r5   r5   r6   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   replacer  timezoneutc
astimezoner>   r5   r5   r6   invalidity_date_utc7  s   z"InvalidityDate.invalidity_date_utcr$   c                 C  r   r%   r   r>   r5   r5   r6   r'   >  r   zInvalidityDate.public_bytesN)r  r  r#   rM   rw   r   rG   )r#   r  r_   )rX   rY   rZ   r   INVALIDITY_DATErL   rQ   rv   r   r   r   r  r  r'   r5   r5   r5   r6   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#   rM   c                 C  r   )Nc                 s  r   r%   r&   r   r   sctr5   r5   r6   r   J  
    
zEPrecertificateSignedCertificateTimestamps.__init__.<locals>.<genexpr>YEvery item in the signed_certificate_timestamps list must be a SignedCertificateTimestamprf   r   rq   _signed_certificate_timestampsr?   r
  r5   r5   r6   rQ   E     
z2PrecertificateSignedCertificateTimestamps.__init__r  r9   c                 C     dt |  dS )Nz+<PrecertificateSignedCertificateTimestamps(ru   rf   r>   r5   r5   r6   rv   X  r   z2PrecertificateSignedCertificateTimestamps.__repr__r:   c                 C  r   r%   r   r   r  r>   r5   r5   r6   r   [  rB   z2PrecertificateSignedCertificateTimestamps.__hash__r   r   r   c                 C  r   r%   )r&   r	  r   r  r   r5   r5   r6   r   ^     
z0PrecertificateSignedCertificateTimestamps.__eq__r$   c                 C  r   r%   r   r>   r5   r5   r6   r'   g  r   z6PrecertificateSignedCertificateTimestamps.public_bytesNr
  r  r#   rM   rw   rG   r   r_   )rX   rY   rZ   r   %PRECERT_SIGNED_CERTIFICATE_TIMESTAMPSrL   rQ   rH   rx   ry   rz   rv   r   r   r'   r5   r5   r5   r6   r	  B      




	r	  c                   @  r  )SignedCertificateTimestampsr
  r  r#   rM   c                 C  r   )Nc                 s  r   r%   r  r  r5   r5   r6   r   s  r  z7SignedCertificateTimestamps.__init__.<locals>.<genexpr>r  r  r  r5   r5   r6   rQ   n  r  z$SignedCertificateTimestamps.__init__r  r9   c                 C  r  )Nz<SignedCertificateTimestamps(ru   r  r>   r5   r5   r6   rv     r   z$SignedCertificateTimestamps.__repr__r:   c                 C  r   r%   r  r>   r5   r5   r6   r     rB   z$SignedCertificateTimestamps.__hash__r   r   r   c                 C  r   r%   )r&   r  r   r  r   r5   r5   r6   r     r  z"SignedCertificateTimestamps.__eq__r$   c                 C  r   r%   r   r>   r5   r5   r6   r'     r   z(SignedCertificateTimestamps.public_bytesNr  rw   rG   r   r_   )rX   rY   rZ   r   SIGNED_CERTIFICATE_TIMESTAMPSrL   rQ   rH   rx   ry   rz   rv   r   r   r'   r5   r5   r5   r6   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#   rM   c                 C  r}   )Nznonce must be bytes)r&   r$   rq   _nonce)r?   r  r5   r5   r6   rQ     r   zOCSPNonce.__init__r   r   r   c                 C  r   r%   )r&   r  r   r  r   r5   r5   r6   r     r   zOCSPNonce.__eq__r:   c                 C  r   r%   )r   r  r>   r5   r5   r6   r     r   zOCSPNonce.__hash__r9   c                 C  r   )Nz<OCSPNonce(nonce=ru   )r  r>   r5   r5   r6   rv     rB   zOCSPNonce.__repr__c                 C  r   r%   )r   r>   r5   r5   r6   r    r   zOCSPNonce.noncec                 C  r   r%   r   r>   r5   r5   r6   r'     r   zOCSPNonce.public_bytesN)r  r$   r#   rM   r   rG   rw   r_   )rX   rY   rZ   r   NONCErL   rQ   r   r   rv   r   r  r'   r5   r5   r5   r6   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	responsesrc  r#   rM   c                 C  s,   t |}tdd |D rtd|| _d S )Nc                 s  s    | ]	}t |t V  qd S r%   rd  )r   rr5   r5   r6   r     s    z3OCSPAcceptableResponses.__init__.<locals>.<genexpr>z'All responses must be ObjectIdentifiers)rf   r  rq   
_responses)r?   r#  r5   r5   r6   rQ     s   
z OCSPAcceptableResponses.__init__r   r   r   c                 C  r   r%   )r&   r"  r   r%  r   r5   r5   r6   r     r   zOCSPAcceptableResponses.__eq__r:   c                 C  r   r%   )r   r   r%  r>   r5   r5   r6   r     rB   z OCSPAcceptableResponses.__hash__r9   c                 C  rt   )Nz#<OCSPAcceptableResponses(responses=ru   )r%  r>   r5   r5   r6   rv     rB   z OCSPAcceptableResponses.__repr__Iterator[ObjectIdentifier]c                 C  r   r%   )rC   r%  r>   r5   r5   r6   ry     r   z OCSPAcceptableResponses.__iter__r$   c                 C  r   r%   r   r>   r5   r5   r6   r'     r   z$OCSPAcceptableResponses.public_bytesN)r#  rc  r#   rM   r   rG   rw   )r#   r&  r_   )rX   rY   rZ   r   ACCEPTABLE_RESPONSESrL   rQ   r   r   rv   ry   r'   r5   r5   r5   r6   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#   rM   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   r5   r5   r6   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 r5   r5   r   r5   r5   r6   r    r  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.)rf   r&   r  r   rq   r  r  r  r   r   r<   r  _only_contains_user_certs_only_contains_ca_certs_indirect_crl_only_contains_attribute_certs_only_some_reasonsr  r  )	r?   r  r  r)  r*  r+  r,  r-  crl_constraintsr5   r5   r6   rQ     sn   




z!IssuingDistributionPoint.__init__r9   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=ru   )r  r  r)  r*  r+  r,  r-  r>   r5   r5   r6   rv   &  s   
z!IssuingDistributionPoint.__repr__r   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   r5   r5   r6   r   2  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-  r>   r5   r5   r6   r   A  s   z!IssuingDistributionPoint.__hash__r   c                 C  r   r%   r  r>   r5   r5   r6   r  N  r   z"IssuingDistributionPoint.full_namec                 C  r   r%   r  r>   r5   r5   r6   r  R  r   z&IssuingDistributionPoint.relative_namec                 C  r   r%   )r.  r>   r5   r5   r6   r)  V  r   z1IssuingDistributionPoint.only_contains_user_certsc                 C  r   r%   )r/  r>   r5   r5   r6   r*  Z  r   z/IssuingDistributionPoint.only_contains_ca_certsc                 C  r   r%   )r2  r>   r5   r5   r6   r+  ^  r   z*IssuingDistributionPoint.only_some_reasonsc                 C  r   r%   )r0  r>   r5   r5   r6   r,  d  r   z%IssuingDistributionPoint.indirect_crlc                 C  r   r%   )r1  r>   r5   r5   r6   r-  h  r   z6IssuingDistributionPoint.only_contains_attribute_certsr$   c                 C  r   r%   r   r>   r5   r5   r6   r'   l  r   z%IssuingDistributionPoint.public_bytesN)r  r   r  r	  r)  r   r*  r   r+  r  r,  r   r-  r   r#   rM   rw   r   rG   r   r  r   r  r_   )rX   rY   rZ   r   ISSUING_DISTRIBUTION_POINTrL   rQ   rv   r   r   r   r  r  r)  r*  r+  r,  r-  r'   r5   r5   r5   r6   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#   rM   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   rq   _template_idr:   _major_version_minor_version)r?   r6  r7  r8  r5   r5   r6   rQ   s  s   

zMSCertificateTemplate.__init__c                 C  r   r%   )r:  r>   r5   r5   r6   r6    r   z!MSCertificateTemplate.template_idc                 C  r   r%   )r;  r>   r5   r5   r6   r7    r   z#MSCertificateTemplate.major_versionc                 C  r   r%   )r<  r>   r5   r5   r6   r8    r   z#MSCertificateTemplate.minor_versionr9   c                 C  r  )Nz#<MSCertificateTemplate(template_id=z, major_version=z, minor_version=ru   )r6  r7  r8  r>   r5   r5   r6   rv     r   zMSCertificateTemplate.__repr__r   r   r   c                 C  r   r%   )r&   r5  r   r6  r7  r8  r   r5   r5   r6   r     r  zMSCertificateTemplate.__eq__r:   c                 C  r  r%   )r   r6  r7  r8  r>   r5   r5   r6   r     r_  zMSCertificateTemplate.__hash__r$   c                 C  r   r%   r   r>   r5   r5   r6   r'     r   z"MSCertificateTemplate.public_bytesN)r6  r   r7  r   r8  r   r#   rM   r   r   rw   r   rG   r_   )rX   rY   rZ   r   MS_CERTIFICATE_TEMPLATErL   rQ   r   r6  r7  r8  rv   r   r   r'   r5   r5   r5   r6   r5  p  s    




r5  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urlrS  textr#   rM   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   rq   r9   _id_url_text)r?   r?  rA  rB  r5   r5   r6   rQ     s   
zNamingAuthority.__init__c                 C  r   r%   )rC  r>   r5   r5   r6   r?    r   zNamingAuthority.idc                 C  r   r%   )rD  r>   r5   r5   r6   rA    r   zNamingAuthority.urlc                 C  r   r%   )rE  r>   r5   r5   r6   rB    r   zNamingAuthority.textr9   c                 C  r  )Nz<NamingAuthority(id=z, url=z, text=ru   )r?  rA  rB  r>   r5   r5   r6   rv     s   zNamingAuthority.__repr__r   r   r   c                 C  r   r%   )r&   r>  r   r?  rA  rB  r   r5   r5   r6   r     r  zNamingAuthority.__eq__r:   c                 C  r  r%   )r   r?  rA  rB  r>   r5   r5   r6   r     s   zNamingAuthority.__hash__N)r?  r@  rA  rS  rB  rS  r#   rM   )r#   r@  rX  rw   r   rG   )rX   rY   rZ   rQ   r   r?  rA  rB  rv   r   r   r5   r5   r5   r6   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_numberrS  add_profession_infor   r#   rM   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&   r9   )r   itemr5   r5   r6   r     r   z*ProfessionInfo.__init__.<locals>.<genexpr>z5Every item in the profession_items list must be a strc                 s  r   r%   rd  )r   rL   r5   r5   r6   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>  rq   rf   r   r9   r$   _naming_authority_profession_items_profession_oids_registration_number_add_profession_info)r?   rG  rI  rK  rM  rN  r5   r5   r6   rQ     s<   



zProfessionInfo.__init__c                 C  r   r%   rQ  r>   r5   r5   r6   rG  	  r   zProfessionInfo.naming_authorityr  c                 C  r   r%   )rR  r>   r5   r5   r6   rI  	  r   zProfessionInfo.profession_itemslist[ObjectIdentifier] | Nonec                 C  r   r%   )rS  r>   r5   r5   r6   rK  	  r   zProfessionInfo.profession_oidsc                 C  r   r%   )rT  r>   r5   r5   r6   rM  	  r   z"ProfessionInfo.registration_numberc                 C  r   r%   )rU  r>   r5   r5   r6   rN  #	  r   z"ProfessionInfo.add_profession_infor9   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=ru   )rG  rI  rK  rM  rN  r>   r5   r5   r6   rv   '	  s   
zProfessionInfo.__repr__r   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&   rF  r   rG  rI  rK  rM  rN  r   r5   r5   r6   r   0	  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%   )rK  r   r   rG  rI  rM  rN  )r?   rK  r5   r5   r6   r   <	  s   
zProfessionInfo.__hash__N)rG  rH  rI  rJ  rK  rL  rM  rS  rN  r   r#   rM   r#   rH  )r#   r  )r#   rW  rX  r   rw   r   rG   )rX   rY   rZ   rQ   r   rG  rI  rK  rM  rN  rv   r   r   r5   r5   r5   r6   rF    s    
-

	rF  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 | NonerG  rH  profession_infosIterable[ProfessionInfo]r#   rM   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 GeneralNamerO  c                 s  r   r%   )r&   rF  )r   infor5   r5   r6   r   ^	  r   z%Admission.__init__.<locals>.<genexpr>z@Every item in the profession_infos list must be a ProfessionInfo)	r&   r   rq   r>  rf   r   _admission_authorityrQ  _profession_infos)r?   rZ  rG  r\  r5   r5   r6   rQ   M	  s$   


zAdmission.__init__c                 C  r   r%   )r_  r>   r5   r5   r6   rZ  j	  r   zAdmission.admission_authorityc                 C  r   r%   rV  r>   r5   r5   r6   rG  n	  r   zAdmission.naming_authoritylist[ProfessionInfo]c                 C  r   r%   )r`  r>   r5   r5   r6   r\  r	  r   zAdmission.profession_infosr9   c                 C  r  )Nz<Admission(admission_authority=z, naming_authority=z, profession_infos=ru   )rZ  rG  r\  r>   r5   r5   r6   rv   v	  r   zAdmission.__repr__r   r   r   c                 C  r   r%   )r&   rY  r   rZ  rG  r\  r   r5   r5   r6   r   }	  r  zAdmission.__eq__r:   c                 C  s   t | j| jt| jfS r%   )r   rZ  rG  r   r\  r>   r5   r5   r6   r   	  s   zAdmission.__hash__N)rZ  r[  rG  rH  r\  r]  r#   rM   r#   r[  rX  )r#   ra  rw   r   rG   )rX   rY   rZ   rQ   r   rZ  rG  r\  rv   r   r   r5   r5   r5   r6   rY  L	  s    



rY  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#   rM   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&   rY  )r   	admissionr5   r5   r6   r   	  r   z&Admissions.__init__.<locals>.<genexpr>zBEvery item in the contents_of_admissions list must be an Admission)r&   r   rq   rf   r   
_authority_admissions)r?   rd  re  r5   r5   r6   rQ   	  s   
zAdmissions.__init__ri  c                 C  r   r%   )rh  r>   r5   r5   r6   rd  	  r   zAdmissions.authorityr9   c                 C  r   )Nz<Admissions(authority=z, admissions=ru   )rh  ri  r>   r5   r5   r6   rv   	  r   zAdmissions.__repr__r   r   r   c                 C  r   r%   )r&   rc  r   rd  ri  r   r5   r5   r6   r   	  r   zAdmissions.__eq__r:   c                 C  r^  r%   )r   rd  r   ri  r>   r5   r5   r6   r   	  r_  zAdmissions.__hash__r$   c                 C  r   r%   r   r>   r5   r5   r6   r'   	  r   zAdmissions.public_bytesN)rd  r[  re  rf  r#   rM   rb  rw   r   rG   r_   )rX   rY   rZ   r   
ADMISSIONSrL   rQ   rH   rx   ry   rz   r   rd  rv   r   r   r'   r5   r5   r5   r6   rc  	  s    



	rc  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 )!rp   rL   r   rr   r$   r#   rM   c                 C  s"   t |ts	td|| _|| _d S )Nr9  )r&   r   rq   r  r  )r?   rL   rr   r5   r5   r6   rQ   	  s   

zUnrecognizedExtension.__init__c                 C  r   r%   r  r>   r5   r5   r6   rL   	  r   zUnrecognizedExtension.oidc                 C  r   r%   r  r>   r5   r5   r6   rr   	  r   zUnrecognizedExtension.valuer9   c                 C  rW  )Nz<UnrecognizedExtension(oid=r  ru   )rL   rr   r>   r5   r5   r6   rv   	  s   zUnrecognizedExtension.__repr__r   r   r   c                 C  r   r%   )r&   rp   r   rL   rr   r   r5   r5   r6   r   	  r   zUnrecognizedExtension.__eq__r:   c                 C  r   r%   )r   rL   rr   r>   r5   r5   r6   r   	  r   zUnrecognizedExtension.__hash__c                 C  r   r%   r}  r>   r5   r5   r6   r'   	  s   z"UnrecognizedExtension.public_bytesN)rL   r   rr   r$   r#   rM   r   r_   rw   r   rG   )rX   rY   rZ   rQ   r   rL   rr   rv   r   r   r'   r5   r5   r5   r6   rp   	  s    



rp   )r"   r   r#   r$   )r8   r9   )t
__future__r   abcr  r0   r  r  collections.abcr   r   cryptographyr   "cryptography.hazmat.bindings._rustr   r   r   cryptography.hazmat.primitivesr   r	   ,cryptography.hazmat.primitives.asymmetric.ecr
   -cryptography.hazmat.primitives.asymmetric.rsar   /cryptography.hazmat.primitives.asymmetric.typesr   r   *cryptography.x509.certificate_transparencyr   cryptography.x509.general_namer   r   r   r   r   r   r   r   r   cryptography.x509.namer   r   cryptography.x509.oidr   r   r   r   TypeVarr   r7   rH   	ExceptionrJ   r]   ABCMetar   rb   r{   r   r   r   r   r   r   r   r   r  r   Enumr  r(  r)  r*  r"  r+  r,  r-  r.  _REASON_BIT_MAPPING_CRLREASONFLAGSr  r  _CRL_ENTRY_REASON_ENUM_TO_CODEr9  r?  rB  rK  rT  ra  rh  rr  rt  rw  _TLS_FEATURE_TYPE_TO_ENUMr  r  r  r  Genericr  r  r  r  r  r  r  r	  r  r  r"  r(  r5  r>  rF  rY  rc  rp   r5   r5   r5   r6   <module>   s   ,

%l$(.%%kA9+("  As0PHHH$)) #;:gE3