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__/ocsp.cpython-35.pyc



"�2VRF�@s�dZddlmZmZmZmZddlmZmZddl	m
Z
mZmZm
Z
mZmZmZmZmZmZmZmZmZddlmZmZddlmZddlmZmZmZm Z Gd	d
�d
e�Z!Gdd�de�Z"Gd
d�de�Z#Gdd�de�Z$Gdd�de�Z%Gdd�de�Z&Gdd�de�Z'Gdd�de�Z(Gdd�de�Z)Gdd�de�Z*Gdd�de�Z+Gdd �d e�Z,Gd!d"�d"e�Z-Gd#d$�d$e�Z.Gd%d&�d&e�Z/Gd'd(�d(e�Z0Gd)d*�d*e�Z1Gd+d,�d,e�Z2Gd-d.�d.e�Z3Gd/d0�d0e�Z4Gd1d2�d2e�Z5Gd3d4�d4e�Z6Gd5d6�d6e�Z7Gd7d8�d8e�Z8Gd9d:�d:e�Z9Gd;d<�d<e�Z:Gd=d>�d>e�Z;Gd?d@�d@e�Z<GdAdB�dBe�Z=GdCdD�dDe�Z>GdEdF�dFe�Z?GdGdH�dHe�Z@GdIdJ�dJe�ZAGdKdL�dLe�ZBGdMdN�dNe�ZCGdOdP�dPe�ZDdQS)Rz�
ASN.1 type classes for the online certificate status protocol (OCSP). Exports
the following items:

 - OCSPRequest()
 - OCSPResponse()

Other type classes are defined that help compose the types listed above.
�)�unicode_literals�division�absolute_import�print_function�)�DigestAlgorithm�SignedDigestAlgorithm)
�Boolean�Choice�
Enumerated�GeneralizedTime�	IA5String�Integer�Null�ObjectIdentifier�OctetBitString�OctetString�ParsableOctetString�Sequence�
SequenceOf)�AuthorityInfoAccessSyntax�	CRLReason)�PublicKeyAlgorithm)�Certificate�GeneralName�GeneralNames�Namec@seZdZddiZdS)�Versionr�v1N)�__name__�
__module__�__qualname__�_map�r#r#�@/opt/alt/python35/lib/python3.5/site-packages/asn1crypto/ocsp.pyr'src@s:eZdZdefdefdefdefgZdS)�CertIdZhash_algorithmZissuer_name_hashZissuer_key_hashZ
serial_numberN)rr r!rrr�_fieldsr#r#r#r$r%-s			r%c@s(eZdZdefdefgZdS)�ServiceLocatorZissuer�locatorN)rr r!rrr&r#r#r#r$r'6s	r'c@seZdZddiZdS)�RequestExtensionIdz1.3.6.1.5.5.7.48.1.7�service_locatorN)rr r!r"r#r#r#r$r)=sr)c@sLeZdZdefdeddifdefgZdZdeiZ	dS)	�RequestExtension�extn_id�critical�defaultF�
extn_valuer*N)r,r/)
rr r!r)r	rr&�	_oid_pairr'�
_oid_specsr#r#r#r$r+Cs
	r+c@seZdZeZdS)�RequestExtensionsN)rr r!r+�_child_specr#r#r#r$r2Psr2c	@seZdZdefdeddddddifgZd	Zd
Zd
Zdd�Z	e
d
d��Ze
dd��Zd
S)�RequestZreq_cert�single_request_extensions�tag_type�explicit�tagr�optionalTFNcCs�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
        r5r,z	_%s_valuer/r-TN)�set�_critical_extensions�native�hasattr�setattr�parsed�add�_processed_extensions)�self�	extension�name�attribute_namer#r#r$�_set_extensions^s


zRequest._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
        )rArFr;)rBr#r#r$�critical_extensionsps
	
zRequest.critical_extensionscCs |jdkr|j�|jS)z�
        This extension is used when communicating with an OCSP responder that
        acts as a proxy for OCSP requests

        :return:
            None or a ServiceLocator object
        F)rArF�_service_locator_value)rBr#r#r$�service_locator_value~s

zRequest.service_locator_value)
rr r!r%r2r&rAr;rHrF�propertyrGrIr#r#r#r$r4Ts	$r4c@seZdZeZdS)�RequestsN)rr r!r4r3r#r#r#r$rK�srKc@seZdZddiZdS)�ResponseTypez1.3.6.1.5.5.7.48.1.1�basic_ocsp_responseN)rr r!r"r#r#r#r$rL�srLc@seZdZeZdS)�AcceptableResponsesN)rr r!rLr3r#r#r#r$rN�srNc@s1eZdZdefdeddifgZdS)�PreferredSignatureAlgorithmZsig_identifierZcert_identifierr9TN)rr r!rrr&r#r#r#r$rO�s	rOc@seZdZeZdS)�PreferredSignatureAlgorithmsN)rr r!rOr3r#r#r#r$rP�srPc@s(eZdZddddddiZdS)�TBSRequestExtensionIdz1.3.6.1.5.5.7.48.1.2�noncez1.3.6.1.5.5.7.48.1.4�acceptable_responsesz1.3.6.1.5.5.7.48.1.8�preferred_signature_algorithmsN)rr r!r"r#r#r#r$rQ�srQc@sXeZdZdefdeddifdefgZd
Zdede	de
iZd	S)�TBSRequestExtensionr,r-r.Fr/rRrSrTN)r,r/)rr r!rQr	rr&r0rrNrPr1r#r#r#r$rU�s	rUc@seZdZeZdS)�TBSRequestExtensionsN)rr r!rUr3r#r#r#r$rV�srVc@syeZdZdeddddddifdedddd	d
difdefd
eddddd
difgZdS)�
TBSRequest�versionr6r7r8rr.rZrequestor_namerr9TZrequest_list�request_extensions�N)rr r!rrrKrVr&r#r#r#r$rW�s	rWc@seZdZeZdS)�CertificatesN)rr r!rr3r#r#r#r$r[�sr[c
@sFeZdZdefdefdedddddd	ifgZd
S)�	Signature�signature_algorithm�	signature�certsr6r7r8rr9TN)rr r!rrr[r&r#r#r#r$r\�s		r\c	@s�eZdZdefdeddddddifgZd	Zd
Zd
Zd
Z	d
Z
dd�Zed
d��Z
edd��Zedd��Zedd��Zd
S)�OCSPRequest�tbs_requestZoptional_signaturer6r7r8rr9TFNcCs�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
        rarYr,z	_%s_valuer/r-TN)r:r;r<r=r>r?r@rA)rBrCrDrEr#r#r$rF�s


zOCSPRequest._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
        )rArFr;)rBr#r#r$rG�s
	
zOCSPRequest.critical_extensionscCs |jdkr|j�|jS)z�
        This extension is used to prevent replay attacks by including a unique,
        random value with each request/response pair

        :return:
            None or an OctetString object
        F)rArF�_nonce_value)rBr#r#r$�nonce_values

zOCSPRequest.nonce_valuecCs |jdkr|j�|jS)a(
        This extension is used to allow the client and server to communicate
        with alternative response formats other than just basic_ocsp_response,
        although no other formats are defined in the standard.

        :return:
            None or an AcceptableResponses object
        F)rArF�_acceptable_responses_value)rBr#r#r$�acceptable_responses_values
z&OCSPRequest.acceptable_responses_valuecCs |jdkr|j�|jS)aj
        This extension is used by the client to define what signature algorithms
        are preferred, including both the hash algorithm and the public key
        algorithm, with a level of detail down to even the public key algorithm
        parameters, such as curve name.

        :return:
            None or a PreferredSignatureAlgorithms object
        F)rArF�%_preferred_signature_algorithms_value)rBr#r#r$�$preferred_signature_algorithms_values
z0OCSPRequest.preferred_signature_algorithms_value)rr r!rWr\r&rAr;rbrdrfrFrJrGrcrergr#r#r#r$r`�s	$r`c@s:eZdZddddddddd	d
ddiZd
S)�OCSPResponseStatusrZ
successfulrZmalformed_requestrZZinternal_error�Z	try_later�Z
sign_required�ZunauthorizedN)rr r!r"r#r#r#r$rh0srhc@sFeZdZdeddddifdeddddifgZdS)	�ResponderIdZby_namer6r7r8r�by_keyrZN)rr r!rr�
_alternativesr#r#r#r$rl;srlc	@s=eZdZdefdeddddddifgZd	S)
�RevokedInfoZrevocation_timeZrevocation_reasonr6r7r8rr9TN)rr r!rrr&r#r#r#r$roBs	roc@s^eZdZdeddddifdeddddifdedddd	ifgZd
S)�
CertStatusZgoodr6Zimplicitr8rZrevokedr�unknownrZN)rr r!rrornr#r#r#r$rpIsrpc
@speZdZdeddddddifdedddd	ddifd
eddddddifgZdS)
�CrlIdZcrl_urlr6r7r8rr9TZcrl_numrZcrl_timerZN)rr r!r
rrr&r#r#r#r$rrQsrrc
@s4eZdZddddddddd	d
iZdS)�SingleResponseExtensionIdz1.3.6.1.5.5.7.48.1.3�crlz1.3.6.1.5.5.7.48.1.6�archive_cutoffz	2.5.29.21�
crl_reasonz	2.5.29.24�invalidity_datez	2.5.29.29�certificate_issuerN)rr r!r"r#r#r#r$rsYs
rsc
@sdeZdZdefdeddifdefgZdZdede	de
d	e	d
eiZdS)
�SingleResponseExtensionr,r-r.Fr/rtrurvrwrxN)r,r/)
rr r!rsr	rr&r0rrrrrr1r#r#r#r$ryes	ryc@seZdZeZdS)�SingleResponseExtensionsN)rr r!ryr3r#r#r#r$rzvsrzc@seZdZdefdefdefdeddddd	d
ifdeddddd	d
ifgZd
ZdZ	dZ
dZdZdZ
dZdd�Zedd��Zedd��Zedd��Zedd��Zedd��Zedd��ZdS)�SingleResponseZcert_idZcert_statusZthis_updateZnext_updater6r7r8rr9T�single_extensionsrFNcCs�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
        r|r,z	_%s_valuer/r-TN)r:r;r<r=r>r?r@rA)rBrCrDrEr#r#r$rF�s


zSingleResponse._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
        )rArFr;)rBr#r#r$rG�s
	
z"SingleResponse.critical_extensionscCs |jdkr|j�|jS)z�
        This extension is used to locate the CRL that a certificate's revocation
        is contained within.

        :return:
            None or a CrlId object
        F)rArF�
_crl_value)rBr#r#r$�	crl_value�s

zSingleResponse.crl_valuecCs |jdkr|j�|jS)z�
        This extension is used to indicate the date at which an archived
        (historical) certificate status entry will no longer be available.

        :return:
            None or a GeneralizedTime object
        F)rArF�_archive_cutoff_value)rBr#r#r$�archive_cutoff_value�s

z#SingleResponse.archive_cutoff_valuecCs |jdkr|j�|jS)z�
        This extension indicates the reason that a certificate was revoked.

        :return:
            None or a CRLReason object
        F)rArF�_crl_reason_value)rBr#r#r$�crl_reason_value�s	
zSingleResponse.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)rArF�_invalidity_date_value)rBr#r#r$�invalidity_date_value�s
z$SingleResponse.invalidity_date_valuecCs |jdkr|j�|jS)z�
        This extension indicates the issuer of the certificate in question.

        :return:
            None or an x509.GeneralNames object
        F)rArF�_certificate_issuer_value)rBr#r#r$�certificate_issuer_value�s	
z'SingleResponse.certificate_issuer_value)rr r!r%rprrzr&rAr;r}rr�r�r�rFrJrGr~r�r�r�r�r#r#r#r$r{zs&			$
r{c@seZdZeZdS)�	ResponsesN)rr r!r{r3r#r#r#r$r��sr�c@s"eZdZddddiZdS)�ResponseDataExtensionIdz1.3.6.1.5.5.7.48.1.2rRz1.3.6.1.5.5.7.48.1.9�extended_revokeN)rr r!r"r#r#r#r$r��sr�c@sReZdZdefdeddifdefgZd	Zdede	iZ
dS)
�ResponseDataExtensionr,r-r.Fr/rRr�N)r,r/)rr r!r�r	rr&r0rrr1r#r#r#r$r��s	r�c@seZdZeZdS)�ResponseDataExtensionsN)rr r!r�r3r#r#r#r$r�sr�c@smeZdZdeddddddifdefd	efd
efdeddddd
difgZdS)�ResponseDatarXr6r7r8rr.rZresponder_idZproduced_atZ	responses�response_extensionsrr9TN)	rr r!rrlrr�r�r&r#r#r#r$r�s
			r�c@sOeZdZdefdefdefdeddddd	d
ifgZdS)�BasicOCSPResponse�tbs_response_datar]r^r_r6r7r8rr9TN)rr r!r�rrr[r&r#r#r#r$r�s			r�c@s:eZdZdefdefgZdZdeiZdS)�
ResponseBytes�
response_type�responserMN)r�r�)	rr r!rLrr&r0r�r1r#r#r#r$r�"s	r�c	@s�eZdZdefdeddddddifgZd	Zd
Zd
Zd
Z	dd�Z
ed
d��Zedd��Z
edd��Zedd��Zedd��Zd
S)�OCSPResponseZresponse_status�response_bytesr6r7r8rr9TFNcCs�t�|_x{|ddjddD]`}|dj}d|}t||�rit|||dj�|djr&|jj|�q&Wd	|_d
S)zv
        Sets common named extensions to private attributes and creates a list
        of critical extensions
        r�r�r�r�r,z	_%s_valuer/r-TN)r:r;r?r<r=r>r@rA)rBrCrDrEr#r#r$rF9s 


zOCSPResponse._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
        )rArFr;)rBr#r#r$rGKs
	
z OCSPResponse.critical_extensionscCs |jdkr|j�|jS)z�
        This extension is used to prevent replay attacks on the request/response
        exchange

        :return:
            None or an OctetString object
        F)rArFrb)rBr#r#r$rcYs

zOCSPResponse.nonce_valuecCs |jdkr|j�|jS)z�
        This extension is used to signal that the responder will return a
        "revoked" status for non-issued certificates.

        :return:
            None or a Null object (if present)
        F)rArF�_extended_revoke_value)rBr#r#r$�extended_revoke_valuegs

z"OCSPResponse.extended_revoke_valuecCs|ddjS)z�
        A shortcut into the BasicOCSPResponse sequence

        :return:
            None or an asn1crypto.ocsp.BasicOCSPResponse object
        r�r�)r?)rBr#r#r$rMus	z OCSPResponse.basic_ocsp_responsecCs|ddjdS)z�
        A shortcut into the parsed, ResponseData sequence

        :return:
            None or an asn1crypto.ocsp.ResponseData object
        r�r�r�)r?)rBr#r#r$�
response_data�s	zOCSPResponse.response_data)rr r!rhr�r&rAr;rbr�rFrJrGrcr�rMr�r#r#r#r$r�.s	$r�N)E�__doc__�
__future__rrrrZalgosrr�corer	r
rrr
rrrrrrrrrtrr�keysrZx509rrrrrr%r'r)r+r2r4rKrLrNrOrPrQrUrVrWr[r\r`rhrlrorprrrsryrzr{r�r�r�r�r�r�r�r�r#r#r#r$�<module>sT"X"	
9	Zx