3
Zb                 @   s6  d Z ddlmZmZmZmZ yddlZW n ek
r@   dZY nX ddlm	Z	m
Z
mZmZmZmZ ddlmZmZmZmZmZmZmZmZmZmZmZmZmZ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'm(Z(m)Z)m*Z*m+Z+ G dd deZ,G dd deZ-G dd deZ.G dd deZ/G dd deZ0G dd deZ1G dd deZ2G dd deZ3G dd deZ4G dd deZ5G dd  d eZ6G d!d" d"eZ7G d#d$ d$eZ8G d%d& d&eZ9G d'd( d(eZ:G d)d* d*eZ;G d+d, d,eZ<G d-d. d.eZ=G d/d0 d0eZ>G d1d2 d2eZ?G d3d4 d4eZ@G d5d6 d6eZAG d7d8 d8eZBG d9d: d:eZCG d;d< d<eZDG d=d> d>eZEG d?d@ d@eZFG dAdB dBeZGG dCdD dDeZHG dEdF dFeZIG dGdH dHeZJG dIdJ dJeZKG dKdL dLeZLG dMdN dNeZMG dOdP dPeZNG dQdR dReZOG dSdT dTeZPG dUdV dVeZQG dWdX dXeZRG dYdZ dZeZSG d[d\ d\eZTG d]d^ d^eZUG d_d` d`eZVG dadb dbeZWG dcdd ddeZXG dedf dfeZYG dgdh dheZZG didj djeZ[G dkdl dleZ\G dmdn dneZ]G dodp dpeZ^G dqdr dreZ_G dsdt dteZ`G dudv dveZaG dwdx dxeZbG dydz dzeZcG d{d| d|eZdG d}d~ d~eZeG dd deZfG dd deZgG dd deZhG dd deZiG dd deZjG dd deZkG dd deZlG dd deZmG dd deZnG dd deZoG dd deZpG dd deZqG dd deZrG dd de	eZsG dd deZtG dd deZuG dd deZvG dd deZwG dd deZxG dd deZyG dd deZzG dd deZ{G dd deZ|G dd deZ}G dd deZ~G dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG ddĄ deZG ddƄ deZG ddȄ deZG ddʄ deZeeoeeeeeeed˜	ea_eoeeeeeeed̜ec_e3e4e5enebe7d͜e8_dS )a  
ASN.1 type classes for cryptographic message syntax (CMS). Structures are also
compatible with PKCS#7. Exports the following items:

 - AuthenticatedData()
 - AuthEnvelopedData()
 - CompressedData()
 - ContentInfo()
 - DigestedData()
 - EncryptedData()
 - EnvelopedData()
 - SignedAndEnvelopedData()
 - SignedData()

Other type classes are defined that help compose the types listed above.

Most CMS structures in the wild are formatted as ContentInfo encapsulating one of the other types.
    )unicode_literalsdivisionabsolute_importprint_functionN   )_ForceNullParametersDigestAlgorithmEncryptionAlgorithmHmacAlgorithmKdfAlgorithmSignedDigestAlgorithm)Any	BitStringChoice
EnumeratedGeneralizedTimeIntegerObjectIdentifierOctetBitStringOctetStringParsableOctetStringSequence
SequenceOfSetOfUTCTime
UTF8String)CertificateList)PublicKeyInfo)OCSPResponse)
AttributesCertificate
ExtensionsGeneralNameGeneralNamesNamec               @   s"   e Zd ZdefdefdefgZdS )ExtendedCertificateInfoversioncertificate
attributesN)__name__
__module____qualname__r   r    r   _fields r-   r-   0/usr/lib/python3/dist-packages/asn1crypto/cms.pyr%   ?   s   r%   c               @   s"   e Zd ZdefdefdefgZdS )ExtendedCertificateZextended_certificate_infosignature_algorithm	signatureN)r)   r*   r+   r%   r   r   r,   r-   r-   r-   r.   r/   G   s   r/   c               @   s   e Zd ZdddddddZdS )	
CMSVersionZv0v1v2Zv3Zv4Zv5)r   r               N)r)   r*   r+   _mapr-   r-   r-   r.   r2   U   s   r2   c               @   s   e Zd ZdddddddZdS )	CMSAttributeTypecontent_typemessage_digestsigning_timecounter_signaturesignature_time_stamp_tokencms_algorithm_protection)z1.2.840.113549.1.9.3z1.2.840.113549.1.9.4z1.2.840.113549.1.9.5z1.2.840.113549.1.9.6z1.2.840.113549.1.9.16.2.14z1.2.840.113549.1.9.52N)r)   r*   r+   r9   r-   r-   r-   r.   r:   `   s   r:   c               @   s   e Zd ZdefdefgZdS )TimeZutc_timeZgeneralized_timeN)r)   r*   r+   r   r   _alternativesr-   r-   r-   r.   rA   m   s   rA   c            
   @   s$   e Zd Zddddddddd	d
	ZdS )ContentTypedatasigned_dataenveloped_datasigned_and_enveloped_datadigested_dataencrypted_dataauthenticated_datacompressed_dataauthenticated_enveloped_data)	z1.2.840.113549.1.7.1z1.2.840.113549.1.7.2z1.2.840.113549.1.7.3z1.2.840.113549.1.7.4z1.2.840.113549.1.7.5z1.2.840.113549.1.7.6z1.2.840.113549.1.9.16.1.2z1.2.840.113549.1.9.16.1.9z1.2.840.113549.1.9.16.1.23N)r)   r*   r+   r9   r-   r-   r-   r.   rC   t   s   rC   c               @   s2   e Zd ZdefdedddfdedddfgZdS )	CMSAlgorithmProtectiondigest_algorithmr0   r   T)implicitoptionalmac_algorithmr5   N)r)   r*   r+   r   r   r
   r,   r-   r-   r-   r.   rM      s   rM   c               @   s   e Zd ZeZdS )SetOfContentTypeN)r)   r*   r+   rC   _child_specr-   r-   r-   r.   rR      s   rR   c               @   s   e Zd ZeZdS )SetOfOctetStringN)r)   r*   r+   r   rS   r-   r-   r-   r.   rT      s   rT   c               @   s   e Zd ZeZdS )	SetOfTimeN)r)   r*   r+   rA   rS   r-   r-   r-   r.   rU      s   rU   c               @   s   e Zd ZeZdS )SetOfAnyN)r)   r*   r+   r   rS   r-   r-   r-   r.   rV      s   rV   c               @   s   e Zd ZeZdS )SetOfCMSAlgorithmProtectionN)r)   r*   r+   rM   rS   r-   r-   r-   r.   rW      s   rW   c               @   s,   e Zd ZdefdgZi Zdd ZdeiZdS )CMSAttributetypevaluesNc             C   s   | j j| d jtS )NrY   )
_oid_specsgetnativerV   )selfr-   r-   r.   _values_spec   s    zCMSAttribute._values_spec)rZ   N)r)   r*   r+   r:   r,   r[   r_   _spec_callbacksr-   r-   r-   r.   rX      s
   rX   c               @   s   e Zd ZeZdS )CMSAttributesN)r)   r*   r+   rX   rS   r-   r-   r-   r.   ra      s   ra   c               @   s(   e Zd ZdefdefdeddifgZdS )IssuerSerialissuerserialZ
issuer_uidrP   TN)r)   r*   r+   r#   r   r   r,   r-   r-   r-   r.   rb      s   rb   c               @   s   e Zd ZdddZdS )AttCertVersionr3   r4   )r   r   N)r)   r*   r+   r9   r-   r-   r-   r.   re      s   re   c               @   s(   e Zd ZdeddifdeddifgZdS )AttCertSubjectbase_certificate_idexplicitr   Zsubject_namer   N)r)   r*   r+   rb   r#   rB   r-   r-   r-   r.   rf      s   rf   c               @   s   e Zd ZdefdefgZdS )AttCertValidityPeriodZnot_before_timeZnot_after_timeN)r)   r*   r+   r   r,   r-   r-   r-   r.   ri      s   ri   c               @   sX   e Zd Zdeddifdefdefdefdefdefd	e	fd
e
ddifdeddifg	ZdS )AttributeCertificateInfoV1r&   defaultr3   Zsubjectrc   r1   serial_numberatt_cert_validity_periodr(   issuer_unique_idrP   T
extensionsN)r)   r*   r+   re   rf   r#   r   r   ri   r   r   r!   r,   r-   r-   r-   r.   rj      s   rj   c               @   s"   e Zd ZdefdefdefgZdS )AttributeCertificateV1ac_infor0   r1   N)r)   r*   r+   rj   r   r   r,   r-   r-   r-   r.   rp      s   rp   c               @   s   e Zd ZddddZdS )DigestedObjectTypeZ
public_keyZpublic_key_certZother_objy_types)r   r   r5   N)r)   r*   r+   r9   r-   r-   r-   r.   rr      s   rr   c               @   s.   e Zd ZdefdeddifdefdefgZdS )ObjectDigestInfoZdigested_object_typeZother_object_type_idrP   TrN   Zobject_digestN)r)   r*   r+   rr   r   r   r   r,   r-   r-   r-   r.   rs      s   rs   c               @   s:   e Zd ZdedddfdedddfdedddfgZd	S )
Holderrg   r   T)rO   rP   Zentity_namer   object_digest_infor5   N)r)   r*   r+   rb   r#   rs   r,   r-   r-   r-   r.   rt      s   rt   c               @   s8   e Zd ZdeddifdedddfdedddfgZd	S )
V2FormZissuer_namerP   Trg   r   )rh   rP   ru   r   N)r)   r*   r+   r#   rb   rs   r,   r-   r-   r-   r.   rv      s   rv   c               @   s"   e Zd ZdefdeddifgZdS )AttCertIssuerZv1_formZv2_formrh   r   N)r)   r*   r+   r#   rv   rB   r-   r-   r-   r.   rw     s   rw   c               @   s"   e Zd ZdefdefdefgZdS )IetfAttrValueZoctetsZoidstringN)r)   r*   r+   r   r   r   rB   r-   r-   r-   r.   rx     s   rx   c               @   s   e Zd ZeZdS )IetfAttrValuesN)r)   r*   r+   rx   rS   r-   r-   r-   r.   rz     s   rz   c               @   s$   e Zd ZdedddfdefgZdS )IetfAttrSyntaxZpolicy_authorityr   T)rO   rP   rZ   N)r)   r*   r+   r#   rz   r,   r-   r-   r-   r.   r{     s   r{   c               @   s   e Zd ZeZdS )SetOfIetfAttrSyntaxN)r)   r*   r+   r{   rS   r-   r-   r-   r.   r|      s   r|   c               @   s(   e Zd ZdefdefdeddifgZdS )SvceAuthInfoserviceZidentZ	auth_inforP   TN)r)   r*   r+   r"   r   r,   r-   r-   r-   r.   r}   $  s   r}   c               @   s   e Zd ZeZdS )SetOfSvceAuthInfoN)r)   r*   r+   r}   rS   r-   r-   r-   r.   r   ,  s   r   c               @   s*   e Zd ZdedddfdeddifgZdS )	
RoleSyntaxZrole_authorityr   T)rO   rP   Z	role_namerO   r   N)r)   r*   r+   r#   r"   r,   r-   r-   r-   r.   r   0  s   r   c               @   s   e Zd ZeZdS )SetOfRoleSyntaxN)r)   r*   r+   r   rS   r-   r-   r-   r.   r   7  s   r   c               @   s   e Zd ZdddddddZdS )		ClassListZunmarkedunclassifiedZ
restrictedZconfidentialZsecretZ
top_secret)r   r   r5   r6   r7   r8   N)r)   r*   r+   r9   r-   r-   r-   r.   r   ;  s   r   c               @   s(   e Zd ZdeddifdeddifgZdS )SecurityCategoryrY   rO   r   valuer   N)r)   r*   r+   r   r   r,   r-   r-   r-   r.   r   F  s   r   c               @   s   e Zd ZeZdS )SetOfSecurityCategoryN)r)   r*   r+   r   rS   r-   r-   r-   r.   r   M  s   r   c               @   s8   e Zd Zdeddifdedddfded	d
dfgZdS )	Clearance	policy_idrO   r   Z
class_listr   r   )rO   rk   Zsecurity_categoriesr5   T)rO   rP   N)r)   r*   r+   r   r   r   r,   r-   r-   r-   r.   r   Q  s   r   c               @   s   e Zd ZeZdS )SetOfClearanceN)r)   r*   r+   r   rS   r-   r-   r-   r.   r   Y  s   r   c               @   s(   e Zd ZdefdefdeddifgZdS )BigTimemajorZfractional_secondsZsignrP   TN)r)   r*   r+   r   r,   r-   r-   r-   r.   r   ]  s   r   c               @   s   e Zd ZdefdefgZdS )LeapDataZ	leap_timeactionN)r)   r*   r+   r   r   r,   r-   r-   r-   r.   r   e  s   r   c               @   s   e Zd ZeZdS )SetOfLeapDataN)r)   r*   r+   r   rS   r-   r-   r-   r.   r   l  s   r   c               @   s4   e Zd ZdefdefdefdefdeddifgZdS )	TimingMetricsZntp_timeoffsetZdelayZ
expirationZ
leap_eventrP   TN)r)   r*   r+   r   r   r,   r-   r-   r-   r.   r   p  s
   r   c               @   s   e Zd ZeZdS )SetOfTimingMetricsN)r)   r*   r+   r   rS   r-   r-   r-   r.   r   z  s   r   c               @   s8   e Zd ZdedeifdedddfdedddfgZd	S )
TimingPolicyr   specZ
max_offsetr   T)rh   rP   Z	max_delayr   N)r)   r*   r+   r   r   r   r,   r-   r-   r-   r.   r   ~  s   r   c               @   s   e Zd ZeZdS )SetOfTimingPolicyN)r)   r*   r+   r   rS   r-   r-   r-   r.   r     s   r   c            	   @   s"   e Zd Zddddddddd	Zd
S )AttCertAttributeTypeauthentication_infoaccess_identitycharging_identitygrouprole	clearancetiming_metricstiming_policy)z1.3.6.1.5.5.7.10.1z1.3.6.1.5.5.7.10.2z1.3.6.1.5.5.7.10.3z1.3.6.1.5.5.7.10.4z2.5.4.72z2.5.4.55z1.3.6.1.4.1.601.10.4.1z1.3.6.1.4.1.601.10.4.2N)r)   r*   r+   r9   r-   r-   r-   r.   r     s   r   c            	   @   s>   e Zd ZdefdgZeeeeeee	e
dZdd ZdeiZdS )AttCertAttributerY   rZ   N)r   r   r   r   r   r   r   r   c             C   s   | j j| d jtS )NrY   )r[   r\   r]   rV   )r^   r-   r-   r.   r_     s    zAttCertAttribute._values_spec)rZ   N)r)   r*   r+   r   r,   r   r|   r   r   r   r   r[   r_   r`   r-   r-   r-   r.   r     s   r   c               @   s   e Zd ZeZdS )AttCertAttributesN)r)   r*   r+   r   rS   r-   r-   r-   r.   r     s   r   c               @   sR   e Zd Zdefdefdefdefdefdefde	fde
d	d
ifded	d
ifg	ZdS )AttributeCertificateInfoV2r&   Zholderrc   r1   rl   rm   r(   rn   rP   Tro   N)r)   r*   r+   re   rt   rw   r   r   ri   r   r   r!   r,   r-   r-   r-   r.   r     s   r   c               @   s&   e Zd ZdZdefdefdefgZdS )AttributeCertificateV2r   rq   r0   r1   N)r)   r*   r+   Z_bad_tagr   r   r   r,   r-   r-   r-   r.   r     s   r   c               @   s   e Zd ZdefdefgZdS )OtherCertificateFormatZother_cert_formatZ
other_certN)r)   r*   r+   r   r   r,   r-   r-   r-   r.   r     s   r   c                   sV   e Zd Zdefdeddifdeddifdeddifd	edd
ifgZ fddZ	  Z
S )CertificateChoicesr'   Zextended_certificaterO   r   Zv1_attr_certr   Zv2_attr_certr5   otherr6   c                sF   t t| j||| | jdkrBtjtj|d j jdkrBd| _dS )aJ  
        Ensures that the class and tag specified exist as an alternative. This
        custom version fixes parsing broken encodings there a V2 attribute
        # certificate is encoded as a V1

        :param class_:
            The integer class_ from the encoded value header

        :param tag:
            The integer tag from the encoded value header

        :param contents:
            A byte string of the contents of the value - used when the object
            is explicitly tagged

        :raises:
            ValueError - when value is not a valid alternative
        r5   r   r4   r6   N)	superr   validateZ_choicere   loadr   dumpr]   )r^   Zclass_tagcontents)	__class__r-   r.   r     s    
zCertificateChoices.validate)r)   r*   r+   r    r/   rp   r   r   rB   r   __classcell__r-   r-   )r   r.   r     s   r   c               @   s   e Zd ZeZdS )CertificateSetN)r)   r*   r+   r   rS   r-   r-   r-   r.   r     s   r   c               @   s,   e Zd ZdefdedddfgZdZi ZdS )ContentInfor;   contentr   T)rh   rP   N)r;   r   )r)   r*   r+   rC   r   r,   	_oid_pairr[   r-   r-   r-   r.   r     s   r   c               @   s   e Zd ZeZdS )SetOfContentInfoN)r)   r*   r+   r   rS   r-   r-   r-   r.   r     s   r   c               @   s,   e Zd ZdefdedddfgZdZi ZdS )EncapsulatedContentInfor;   r   r   T)rh   rP   N)r;   r   )r)   r*   r+   rC   r   r,   r   r[   r-   r-   r-   r.   r   	  s   r   c               @   s   e Zd ZdefdefgZdS )IssuerAndSerialNumberrc   rl   N)r)   r*   r+   r$   r   r,   r-   r-   r-   r.   r     s   r   c               @   s"   e Zd ZdefdeddifgZdS )SignerIdentifierissuer_and_serial_numbersubject_key_identifierrO   r   N)r)   r*   r+   r   r   rB   r-   r-   r-   r.   r     s   r   c               @   s   e Zd ZeZdS )DigestAlgorithmsN)r)   r*   r+   r   rS   r-   r-   r-   r.   r   !  s   r   c               @   s   e Zd ZeZdS )CertificateRevocationListsN)r)   r*   r+   r   rS   r-   r-   r-   r.   r   %  s   r   c               @   s$   e Zd ZdedddfdefgZdS )
SCVPReqResZrequestr   T)rh   rP   ZresponseN)r)   r*   r+   r   r,   r-   r-   r-   r.   r   )  s   r   c               @   s   e Zd ZdddZdS )OtherRevInfoFormatIdocsp_responsescvp)z1.3.6.1.5.5.7.16.2z1.3.6.1.5.5.7.16.4N)r)   r*   r+   r9   r-   r-   r-   r.   r   0  s   r   c               @   s*   e Zd ZdefdefgZdZeedZ	dS )OtherRevocationInfoFormatother_rev_info_formatother_rev_info)r   r   N)r   r   )
r)   r*   r+   r   r   r,   r   r   r   r[   r-   r-   r-   r.   r   7  s
   
r   c               @   s"   e Zd ZdefdeddifgZdS )RevocationInfoChoicecrlr   rO   r   N)r)   r*   r+   r   r   rB   r-   r-   r-   r.   r   D  s   r   c               @   s   e Zd ZeZdS )RevocationInfoChoicesN)r)   r*   r+   r   rS   r-   r-   r-   r.   r   K  s   r   c               @   sJ   e Zd Zdefdefdefdedddfdefd	efd
edddfgZ	dS )
SignerInfor&   ZsidrN   Zsigned_attrsr   T)rO   rP   r0   r1   Zunsigned_attrsr   N)
r)   r*   r+   r2   r   r   ra   r   r   r,   r-   r-   r-   r.   r   O  s   r   c               @   s   e Zd ZeZdS )SignerInfosN)r)   r*   r+   r   rS   r-   r-   r-   r.   r   [  s   r   c            	   @   sP   e Zd Zdefdefddedddfd	ed
ddfdefgZdd Z	de	iZ
dS )
SignedDatar&   digest_algorithmsencap_content_infoNcertificatesr   T)rO   rP   crlsr   signer_infosc             C   s   | d j dkrtS tS )Nr&   r3   )r]   r   r   )r^   r-   r-   r.   _encap_content_info_speci  s    z#SignedData._encap_content_info_spec)r   N)r)   r*   r+   r2   r   r   r   r   r,   r   r`   r-   r-   r-   r.   r   _  s   
r   c               @   s,   e Zd ZdedddfdedddfgZdS )OriginatorInfoZcertsr   T)rO   rP   r   r   N)r)   r*   r+   r   r   r,   r-   r-   r-   r.   r   |  s   r   c               @   s"   e Zd ZdefdeddifgZdS )RecipientIdentifierr   r   rO   r   N)r)   r*   r+   r   r   rB   r-   r-   r-   r.   r     s   r   c               @   s    e Zd ZddddddddZd	S )
KeyEncryptionAlgorithmIdZrsaZaes128_wrapZaes128_wrap_padZaes192_wrapZaes192_wrap_padZaes256_wrapZaes256_wrap_pad)z1.2.840.113549.1.1.1z2.16.840.1.101.3.4.1.5z2.16.840.1.101.3.4.1.8z2.16.840.1.101.3.4.1.25z2.16.840.1.101.3.4.1.28z2.16.840.1.101.3.4.1.45z2.16.840.1.101.3.4.1.48N)r)   r*   r+   r9   r-   r-   r-   r.   r     s   r   c               @   s"   e Zd ZdefdeddifgZdS )KeyEncryptionAlgorithm	algorithm
parametersrP   TN)r)   r*   r+   r   r   r,   r-   r-   r-   r.   r     s   r   c               @   s(   e Zd ZdefdefdefdefgZdS )KeyTransRecipientInfor&   ridkey_encryption_algorithmencrypted_keyN)r)   r*   r+   r2   r   r   r   r,   r-   r-   r-   r.   r     s   r   c               @   s.   e Zd ZdefdeddifdeddifgZdS )OriginatorIdentifierOrKeyr   r   rO   r   Zoriginator_keyr   N)r)   r*   r+   r   r   r   rB   r-   r-   r-   r.   r     s   r   c               @   s   e Zd ZdefdefgZdS )OtherKeyAttributeZkey_attr_idZkey_attrN)r)   r*   r+   r   r   r,   r-   r-   r-   r.   r     s   r   c               @   s.   e Zd ZdefdeddifdeddifgZdS )RecipientKeyIdentifierr   daterP   Tr   N)r)   r*   r+   r   r   r   r,   r-   r-   r-   r.   r     s   r   c               @   s"   e Zd ZdefdeddifgZdS )KeyAgreementRecipientIdentifierr   Zr_key_idrO   r   N)r)   r*   r+   r   r   rB   r-   r-   r-   r.   r     s   r   c               @   s   e Zd ZdefdefgZdS )RecipientEncryptedKeyr   r   N)r)   r*   r+   r   r   r,   r-   r-   r-   r.   r     s   r   c               @   s   e Zd ZeZdS )RecipientEncryptedKeysN)r)   r*   r+   r   rS   r-   r-   r-   r.   r     s   r   c               @   s<   e Zd Zdefdeddifdedddfd	efd
efgZdS )KeyAgreeRecipientInfor&   Z
originatorrh   r   Zukmr   T)rh   rP   r   Zrecipient_encrypted_keysN)	r)   r*   r+   r2   r   r   r   r   r,   r-   r-   r-   r.   r     s
   r   c               @   s.   e Zd ZdefdeddifdeddifgZdS )KEKIdentifierZkey_identifierr   rP   Tr   N)r)   r*   r+   r   r   r   r,   r-   r-   r-   r.   r     s   r   c               @   s(   e Zd ZdefdefdefdefgZdS )KEKRecipientInfor&   Zkekidr   r   N)r)   r*   r+   r2   r   r   r   r,   r-   r-   r-   r.   r     s   r   c               @   s0   e Zd ZdefdedddfdefdefgZdS )	PasswordRecipientInfor&   Zkey_derivation_algorithmr   T)rO   rP   r   r   N)r)   r*   r+   r2   r   r   r   r,   r-   r-   r-   r.   r     s   r   c               @   s   e Zd ZdefdefgZdS )OtherRecipientInfoZori_typeZ	ori_valueN)r)   r*   r+   r   r   r,   r-   r-   r-   r.   r     s   r   c               @   sF   e Zd Zdefdeddifdeddifdeddifd	edd
ifgZdS )RecipientInfoZktriZkarirO   r   Zkekrir5   Zpwrir6   Zorir7   N)	r)   r*   r+   r   r   r   r   r   rB   r-   r-   r-   r.   r     s
   r   c               @   s   e Zd ZeZdS )RecipientInfosN)r)   r*   r+   r   rS   r-   r-   r-   r.   r     s   r   c               @   s*   e Zd ZdefdefdedddfgZdS )EncryptedContentInfor;   Zcontent_encryption_algorithmZencrypted_contentr   T)rO   rP   N)r)   r*   r+   rC   r	   r   r,   r-   r-   r-   r.   r     s   r   c            	   @   s>   e Zd Zdefdedddfdefdefded	ddfgZd
S )EnvelopedDatar&   originator_infor   T)rO   rP   recipient_infosencrypted_content_infounprotected_attrsr   N)	r)   r*   r+   r2   r   r   r   ra   r,   r-   r-   r-   r.   r     s
   r   c            
   @   sJ   e Zd Zdefdefdefdefdedddfd	ed
ddfde	fgZ
dS )SignedAndEnvelopedDatar&   r   r   r   r   r   T)rO   rP   r   r   r   N)r)   r*   r+   r2   r   r   r   r   r   r   r,   r-   r-   r-   r.   r     s   r   c               @   s4   e Zd ZdefdefddefgZdd ZdeiZdS )	DigestedDatar&   rN   r   NZdigestc             C   s   | d j dkrtS tS )Nr&   r3   )r]   r   r   )r^   r-   r-   r.   r   .  s    z%DigestedData._encap_content_info_spec)r   N)	r)   r*   r+   r2   r   r   r,   r   r`   r-   r-   r-   r.   r   &  s   
r   c               @   s*   e Zd ZdefdefdedddfgZdS )EncryptedDatar&   r   r   r   T)rO   rP   N)r)   r*   r+   r2   r   ra   r,   r-   r-   r-   r.   r   A  s   r   c               @   sf   e Zd Zdefdedddfdefdefded	ddfd
efde	dddfde
fde	dddfg	ZdS )AuthenticatedDatar&   r   r   T)rO   rP   r   rQ   rN   r   r   
auth_attrsr5   macunauth_attrsr6   N)r)   r*   r+   r2   r   r   r
   r   r   ra   r   r,   r-   r-   r-   r.   r   I  s   r   c               @   sR   e Zd Zdefdedddfdefdefded	ddfd
efdedddfgZ	dS )AuthEnvelopedDatar&   r   r   T)rO   rP   r   Zauth_encrypted_content_infor   r   r   r   r5   N)
r)   r*   r+   r2   r   r   r   ra   r   r,   r-   r-   r-   r.   r   Y  s   r   c               @   s   e Zd ZddiZdS )CompressionAlgorithmIdz1.2.840.113549.1.9.16.3.8zlibN)r)   r*   r+   r9   r-   r-   r-   r.   r   e  s   r   c               @   s"   e Zd ZdefdeddifgZdS )CompressionAlgorithmr   r   rP   TN)r)   r*   r+   r   r   r,   r-   r-   r-   r.   r   k  s   r   c               @   s2   e Zd ZdefdefdefgZdZedd Z	dS )CompressedDatar&   Zcompression_algorithmr   Nc             C   s6   | j d kr0td krtdtj| d d j| _ | j S )Nz The zlib module is not availabler   r   )_decompressedr   SystemErrorZ
decompressr]   )r^   r-   r-   r.   decompressed{  s
    
zCompressedData.decompressed)
r)   r*   r+   r2   r   r   r,   r   propertyr   r-   r-   r-   r.   r   r  s
   
r   )	rD   rE   rF   rG   rH   rI   rJ   rK   rL   )rE   rF   rG   rH   rI   rJ   rK   rL   )r;   r<   r=   r>   r?   r@   )__doc__Z
__future__r   r   r   r   r   ImportErrorZalgosr   r   r	   r
   r   r   Zcorer   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   keysr   Zocspr   Zx509r   r    r!   r"   r#   r$   r%   r/   r2   r:   rA   rC   rM   rR   rT   rU   rV   rW   rX   ra   rb   re   rf   ri   rj   rp   rr   rs   rt   rv   rw   rx   rz   r{   r|   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r[   r-   r-   r-   r.   <module>   s  
 D 	
#

	
		



