Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib/python3.5/site-packages/asn1crypto/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib/python3.5/site-packages/asn1crypto/__pycache__/crl.cpython-35.pyc



��+VY?�@s�dZddlmZmZmZmZddlZddlmZddl	m
Z
mZmZm
Z
mZmZmZmZmZddlmZmZmZmZmZmZmZmZGdd	�d	e
�ZGd
d�de�ZGdd
�d
e�ZGdd�de�ZGdd�de�Z Gdd�de�Z!Gdd�de�Z"Gdd�de�Z#Gdd�de�Z$Gdd�de�Z%Gdd�de�Z&Gdd�de�Z'Gd d!�d!e�Z(dS)"z�
ASN.1 type classes for certificate revocation lists (CRL). Exports the
following items:

 - CertificateList()

Other type classes are defined that help compose the types listed above.
�)�unicode_literals�division�absolute_import�print_functionN�)�SignedDigestAlgorithm)	�Boolean�
Enumerated�GeneralizedTime�Integer�ObjectIdentifier�OctetBitString�ParsableOctetString�Sequence�
SequenceOf)�AuthorityInfoAccessSyntax�AuthorityKeyIdentifier�CRLDistributionPoints�DistributionPointName�GeneralNames�Name�ReasonFlags�Timec@s(eZdZddddddiZdS)�VersionrZv1rZv2�Zv3N)�__name__�
__module__�__qualname__�_map�rr�?/opt/alt/python35/lib/python3.5/site-packages/asn1crypto/crl.pyr+src
@s�eZdZdeddddddifdedd	dd
ddifd
edd	ddddifdedd	ddddifdedd	ddddifdedd	ddddifgZdS)�IssuingDistributionPoint�distribution_point�tag_type�explicit�tagr�optionalTZonly_contains_user_certsZimplicitr�defaultFZonly_contains_ca_certsrZonly_some_reasons�Zindirect_crl�Zonly_contains_attribute_certs�N)rrrrrr�_fieldsrrrr r!3sr!c@s@eZdZddddddddd	d
ddd
diZdS)�TBSCertListExtensionIdz	2.5.29.18�issuer_alt_namez	2.5.29.20�
crl_numberz	2.5.29.27�delta_crl_indicatorz	2.5.29.28�issuing_distribution_pointz	2.5.29.35�authority_key_identifierz	2.5.29.46�freshest_crlz1.3.6.1.5.5.7.1.1�authority_information_accessN)rrrrrrrr r,>sr,c@speZdZdefdeddifdefgZdZdede	de	d	e
d
edede
iZd
S)�TBSCertListExtension�extn_id�criticalr'F�
extn_valuer-r.r/r0r1r2r3N)r5r7)rrrr,rrr+�	_oid_pairrrr!rrr�
_oid_specsrrrr r4Js	r4c@seZdZeZdS)�TBSCertListExtensionsN)rrrr4�_child_specrrrr r:]sr:c@sdeZdZddddddddd	d
ddd
dddddddi
Zedd��ZdS)�	CRLReasonr�unspecifiedr�key_compromiser�
ca_compromiser(�affiliation_changedr)�
supersededr*�cessation_of_operation��certificate_hold��remove_from_crl�	�privilege_withdrawn�
�
aa_compromisecCsGddddddddd	d
ddd
dddddddi
|jS)a
        :return:
            A unicode string with revocation description that is suitable to
            show to end-users. Starts with a lower case letter and phrased in
            such a way that it makes sense after the phrase "because of" or
            "due to".
        r=zan unspecified reasonr>za compromised keyr?zthe CA being compromisedr@zan affiliation changerAzcertificate supersessionrBza cessation of operationrDza certificate holdrFzremoval from the CRLrHzprivilege withdrawlrJzthe AA being compromised)�native)�selfrrr �human_friendlyos	zCRLReason.human_friendlyN)rrrr�propertyrMrrrr r<asr<c@s.eZdZddddddddiZd	S)
�CRLEntryExtensionIdz	2.5.29.21�
crl_reasonz	2.5.29.23�hold_instruction_codez	2.5.29.24�invalidity_datez	2.5.29.29�certificate_issuerN)rrrrrrrr rO�srOc@s^eZdZdefdeddifdefgZdZdede	de
d	eiZd
S)�CRLEntryExtensionr5r6r'Fr7rPrQrRrSN)r5r7)
rrrrOrrr+r8r<rr
rr9rrrr rT�s	rTc@seZdZeZdS)�CRLEntryExtensionsN)rrrrTr;rrrr rU�srUc@s�eZdZdefdefdeddifgZdZdZdZ	dZ
dZdZdd	�Z
ed
d��Zedd
��Zedd��Zedd��Zedd��ZdS)�RevokedCertificateZuser_certificateZrevocation_date�crl_entry_extensionsr&TFNcCs�t�|_xl|dD]`}|dj}d|}t||�rZt|||dj�|djr|jj|�qWd|_dS)zv
        Sets common named extensions to private attributes and creates a list
        of critical extensions
        rWr5z	_%s_valuer7r6TN)�set�_critical_extensionsrK�hasattr�setattr�parsed�add�_processed_extensions)rL�	extension�name�attribute_namerrr �_set_extensions�s


z"RevokedCertificate._set_extensionscCs|js|j�|jS)z�
        Returns a set of the names (or OID if not a known extension) of the
        extensions marked as critical

        :return:
            A set of unicode strings
        )r^rbrY)rLrrr �critical_extensions�s
	
z&RevokedCertificate.critical_extensionscCs |jdkr|j�|jS)z�
        This extension indicates the reason that a certificate was revoked.

        :return:
            None or a CRLReason object
        F)r^rb�_crl_reason_value)rLrrr �crl_reason_value�s	
z#RevokedCertificate.crl_reason_valuecCs |jdkr|j�|jS)a=
        This extension indicates the suspected date/time the private key was
        compromised or the certificate became invalid. This would usually be
        before the revocation date, which is when the CA processed the
        revocation.

        :return:
            None or a GeneralizedTime object
        F)r^rb�_invalidity_date_value)rLrrr �invalidity_date_value�s
z(RevokedCertificate.invalidity_date_valuecCs |jdkr|j�|jS)a
        This extension indicates the issuer of the certificate in question,
        and is used in indirect CRLs. CRL entries without this extension are
        for certificates issued from the last seen issuer.

        :return:
            None or an x509.GeneralNames object
        F)r^rb�_certificate_issuer_value)rLrrr �certificate_issuer_value�s
z+RevokedCertificate.certificate_issuer_valuecCsX|jdkrQd|_|jrQx-|jD]"}|jdkr+|j|_Pq+W|jS)zi
        :return:
            None, or an asn1crypto.x509.Name object for the issuer of the cert
        FNZdirectory_name)�_issuer_namerir`�chosen)rL�general_namerrr �issuer_name�s		zRevokedCertificate.issuer_name)rrrrrrUr+r^rYrdrfrhrjrbrNrcrergrirmrrrr rV�s		
rVc@seZdZeZdS)�RevokedCertificatesN)rrrrVr;rrrr rnsrnc@s|eZdZdeddifdefdefdefdefdeddifd	ed
ddd
ddifgZ	dS)�TbsCertList�versionr&T�	signature�issuerZthis_updateZnext_updateZrevoked_certificates�crl_extensionsr#r$r%rN)
rrrrrrrrnr:r+rrrr ros				roc@s�eZdZdefdefdefgZdZdZdZ	dZ
dZdZdZ
dZdZdZdZdZdZdd�Zedd	��Zed
d��Zedd
��Zedd��Zedd��Zedd��Zedd��Zedd��Zedd��Zedd��Zedd��Z edd��Z!ed d!��Z"ed"d#��Z#ed$d%��Z$dS)&�CertificateList�
tbs_cert_listZsignature_algorithmrqFNcCs�t�|_xp|ddD]`}|dj}d|}t||�r^t|||dj�|djr|jj|�qWd|_dS)	zv
        Sets common named extensions to private attributes and creates a list
        of critical extensions
        rursr5z	_%s_valuer7r6TN)rXrYrKrZr[r\r]r^)rLr_r`rarrr rb4s


zCertificateList._set_extensionscCs|js|j�|jS)z�
        Returns a set of the names (or OID if not a known extension) of the
        extensions marked as critical

        :return:
            A set of unicode strings
        )r^rbrY)rLrrr rcFs
	
z#CertificateList.critical_extensionscCs |jdkr|j�|jS)z�
        This extension allows associating one or more alternative names with
        the issuer of the CRL.

        :return:
            None or an x509.GeneralNames object
        F)r^rb�_issuer_alt_name_value)rLrrr �issuer_alt_name_valueTs

z%CertificateList.issuer_alt_name_valuecCs |jdkr|j�|jS)z�
        This extension adds a monotonically increasing number to the CRL and is
        used to distinguish different versions of the CRL.

        :return:
            None or an Integer object
        F)r^rb�_crl_number_value)rLrrr �crl_number_valuebs

z CertificateList.crl_number_valuecCs |jdkr|j�|jS)z�
        This extension indicates a CRL is a delta CRL, and contains the CRL
        number of the base CRL that it is a delta from.

        :return:
            None or an Integer object
        F)r^rb�_delta_crl_indicator_value)rLrrr �delta_crl_indicator_valueps

z)CertificateList.delta_crl_indicator_valuecCs |jdkr|j�|jS)z�
        This extension includes information about what types of revocations
        and certificates are part of the CRL.

        :return:
            None or an IssuingDistributionPoint object
        F)r^rb�!_issuing_distribution_point_value)rLrrr � issuing_distribution_point_value~s

z0CertificateList.issuing_distribution_point_valuecCs |jdkr|j�|jS)z�
        This extension helps in identifying the public key with which to
        validate the authenticity of the CRL.

        :return:
            None or an AuthorityKeyIdentifier object
        F)r^rb�_authority_key_identifier_value)rLrrr �authority_key_identifier_value�s

z.CertificateList.authority_key_identifier_valuecCs |jdkr|j�|jS)z�
        This extension is used in complete CRLs to indicate where a delta CRL
        may be located.

        :return:
            None or a CRLDistributionPoints object
        F)r^rb�_freshest_crl_value)rLrrr �freshest_crl_value�s

z"CertificateList.freshest_crl_valuecCs |jdkr|j�|jS)z�
        This extension is used to provide a URL with which to download the
        certificate used to sign this CRL.

        :return:
            None or an AuthorityInfoAccessSyntax object
        F)r^rb�#_authority_information_access_value)rLrrr �"authority_information_access_value�s

z2CertificateList.authority_information_access_valuecCs|ddS)z_
        :return:
            An asn1crypto.x509.Name object for the issuer of the CRL
        rurrr)rLrrr rr�szCertificateList.issuercCs|js
dS|jdjS)z�
        :return:
            None or a byte string of the key_identifier from the authority key
            identifier extension
        NZkey_identifier)rrK)rLrrr r1�s	z(CertificateList.authority_key_identifiercCs�|jdkr�g|_|jr�xu|jD]j}|djdkr+|d}|jdkr`q+|j}|j�dd�dkr+|jj|�q+W|jS)	z�
        :return:
            A list of unicode strings that are URLs that should contain either
            an individual DER-encoded X.509 certificate, or a DER-encoded CMS
            message containing multiple certificates
        NZ
access_methodZ
ca_issuersZaccess_location�uniform_resource_identifierr�zhttp://)�_issuer_cert_urlsr�rKr`�lower�append)rL�entry�location�urlrrr �issuer_cert_urls�s			
	z CertificateList.issuer_cert_urlscCs�|jdkr�g|_|jdk	r�x`|jD]U}|d}|jdkrSq1x0|jD]%}|jdkr]|jj|�q]Wq1W|jS)z�
        Returns delta CRL URLs - only applies to complete CRLs

        :return:
            A list of zero or more DistributionPoint objects
        Nr"Zname_relative_to_crl_issuerr�)�_delta_crl_distribution_pointsr�r`rkr�)rLr"Zdistribution_point_namerlrrr �delta_crl_distribution_points�s		
z-CertificateList.delta_crl_distribution_pointscCs|djS)zE
        :return:
            A byte string of the signature
        rq)rK)rLrrr rq�szCertificateList.signaturecCs4|jdkr-tj|j��j�|_|jS)zf
        :return:
            The SHA1 hash of the DER-encoded bytes of this certificate list
        N)�_sha1�hashlib�sha1�dump�digest)rLrrr r�szCertificateList.sha1cCs4|jdkr-tj|j��j�|_|jS)zi
        :return:
            The SHA-256 hash of the DER-encoded bytes of this certificate list
        N)�_sha256r��sha256r�r�)rLrrr r�szCertificateList.sha256)%rrrrorr
r+r^rYrvrxrzr|r~r�r�r�r�r�r�rbrNrcrwryr{r}rr�r�rrr1r�r�rqr�r�rrrr rts@			
	rt))�__doc__�
__future__rrrrr�Zalgosr�corerr	r
rrr
rrrZx509rrrrrrrrrr!r,r4r:r<rOrTrUrVrnrortrrrr �<module>
s$"@:&	k