U BB`j @spdZddlmZmZmZmZz ddlZWnek r@dZYnXddlm Z m Z m Z m Z m Z mZmZddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZddl m!Z!ddl"m#Z#dd l$m%Z%dd l&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,Gd d d eZ-Gd ddeZ.GdddeZ/GdddeZ0GdddeZ1GdddeZ2GdddeZ3GdddeZ4GdddeZ5GdddeZ6Gdd d eZ7Gd!d"d"eZ8Gd#d$d$eZ9Gd%d&d&eZ:Gd'd(d(eZ;Gd)d*d*eZGd/d0d0eZ?Gd1d2d2eZ@Gd3d4d4eZAGd5d6d6eZBGd7d8d8eZCGd9d:d:eZDGd;d<dd>eZFGd?d@d@eZGGdAdBdBeZHGdCdDdDeZIGdEdFdFeZJGdGdHdHeZKGdIdJdJeZLGdKdLdLeZMGdMdNdNeZNGdOdPdPeZOGdQdRdReZPGdSdTdTeZQGdUdVdVeZRGdWdXdXeZSGdYdZdZeZTGd[d\d\eZUGd]d^d^eZVGd_d`d`eZWGdadbdbeZXGdcddddeZYGdedfdfeZZGdgdhdheZ[GdidjdjeZ\GdkdldleZ]GdmdndneZ^GdodpdpeZ_GdqdrdreZ`GdsdtdteZaGdudvdveZbGdwdxdxeZcGdydzdzeZdGd{d|d|eZeGd}d~d~eZfGdddeZgGdddeZhGdddeZiGdddeZjGdddeZkGdddeZlGdddeZmGdddeZnGdddeZoGdddeZpGdddeZqGdddeZrGdddeZsGddde eZtGdddeZuGdddeZvGdddeZwGdddeZxGdddeZyGdddeZzGdddeZ{GdddeZ|GdddeZ}GdddeZ~GdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdd„deZGddĄdeZGddƄdeZGddȄdeZGddʄdeZGdddeZxGdd̈́deZGddτdeZeepeeeeeeedМ eb_epeeeeeeedќed_e4e5e6eoece8ececedҜ e9_dS)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_literalsdivisionabsolute_importprint_functionN)_ForceNullParametersDigestAlgorithmEncryptionAlgorithm HmacAlgorithm KdfAlgorithmRSAESOAEPParamsSignedDigestAlgorithm)Any BitStringChoice EnumeratedGeneralizedTimeIntegerObjectIdentifierOctetBitString OctetStringParsableOctetStringSequence SequenceOfSetOfUTCTime UTF8String)CertificateList) PublicKeyInfo) OCSPResponse) Attributes Certificate Extensions GeneralName GeneralNamesNamec@s"eZdZdefdefdefgZdS)ExtendedCertificateInfoversion certificate attributesN)__name__ __module__ __qualname__rr!r _fieldsr.r.]C:\Users\shjeevan\PycharmProjects\Verisk-XactWare\venv3.8\Lib\site-packages\asn1crypto/cms.pyr&@sr&c@s"eZdZdefdefdefgZdS)ExtendedCertificateZextended_certificate_infosignature_algorithm signatureN)r*r+r,r&r rr-r.r.r.r/r0Hsr0c@seZdZdddddddZdS) CMSVersionZv0v1v2Zv3Zv4Zv5rrNr*r+r,_mapr.r.r.r/r3Vsr3c @s$eZdZddddddddd d Zd S) CMSAttributeType content_typemessage_digest signing_timecounter_signatureencrypt_key_prefsignature_time_stamp_tokencms_algorithm_protectionmicrosoft_nested_signaturemicrosoft_time_stamp_token) z1.2.840.113549.1.9.3z1.2.840.113549.1.9.4z1.2.840.113549.1.9.5z1.2.840.113549.1.9.6z1.2.840.113549.1.9.16.2.11z1.2.840.113549.1.9.16.2.14z1.2.840.113549.1.9.52z1.3.6.1.4.1.311.2.4.1z1.3.6.1.4.1.311.3.3.1Nr;r.r.r.r/r=asr=c@seZdZdefdefgZdS)TimeZutc_timeZgeneralized_timeN)r*r+r,rr _alternativesr.r.r.r/rGxsrGc @s$eZdZddddddddd d Zd S) ContentTypedata signed_dataenveloped_datasigned_and_enveloped_data digested_dataencrypted_dataauthenticated_datacompressed_dataauthenticated_enveloped_data) z1.2.840.113549.1.7.1z1.2.840.113549.1.7.2z1.2.840.113549.1.7.3z1.2.840.113549.1.7.4z1.2.840.113549.1.7.5z1.2.840.113549.1.7.6z1.2.840.113549.1.9.16.1.2z1.2.840.113549.1.9.16.1.9z1.2.840.113549.1.9.16.1.23Nr;r.r.r.r/rIsrIc@s2eZdZdefdedddfdedddfgZdS) CMSAlgorithmProtectiondigest_algorithmr1rTimplicitoptional mac_algorithmr7N)r*r+r,rr r r-r.r.r.r/rSsrSc@seZdZeZdS)SetOfContentTypeN)r*r+r,rI _child_specr.r.r.r/rYsrYc@seZdZeZdS)SetOfOctetStringN)r*r+r,rrZr.r.r.r/r[sr[c@seZdZeZdS) SetOfTimeN)r*r+r,rGrZr.r.r.r/r\sr\c@seZdZeZdS)SetOfAnyN)r*r+r,rrZr.r.r.r/r]sr]c@seZdZeZdS)SetOfCMSAlgorithmProtectionN)r*r+r,rSrZr.r.r.r/r^sr^c@s,eZdZdefdgZiZddZdeiZdS) CMSAttributetypevaluesNcCs|j|djtSNr` _oid_specsgetnativer]selfr.r.r/ _values_specszCMSAttribute._values_specrbN)r*r+r,r=r-rerj_spec_callbacksr.r.r.r/r_sr_c@seZdZeZdS) CMSAttributesN)r*r+r,r_rZr.r.r.r/rlsrlc@s(eZdZdefdefdeddifgZdS) IssuerSerialissuerserialZ issuer_uidrWTN)r*r+r,r$rrr-r.r.r.r/rms rmc@seZdZdddZdS)AttCertVersionr4r5)rrNr;r.r.r.r/rpsrpc@s(eZdZdeddifdeddifgZdS)AttCertSubjectbase_certificate_idexplicitrZ subject_namerN)r*r+r,rmr$rHr.r.r.r/rqs  rqc@seZdZdefdefgZdS)AttCertValidityPeriodZnot_before_timeZnot_after_timeN)r*r+r,rr-r.r.r.r/rtsrtc @sXeZdZdeddifdefdefdefdefdefd e fd e d d ifd e d d ifg Z dS)AttributeCertificateInfoV1r'defaultr4subjectrnr2 serial_numberatt_cert_validity_periodr)issuer_unique_idrWT extensionsN) r*r+r,rprqr$r rrtr rr"r-r.r.r.r/rus   ruc@s"eZdZdefdefdefgZdS)AttributeCertificateV1ac_infor1r2N)r*r+r,rur rr-r.r.r.r/r|sr|c@seZdZddddZdS)DigestedObjectTypeZ public_keyZpublic_key_certZother_objy_types)rrr7Nr;r.r.r.r/r~sr~c@s.eZdZdefdeddifdefdefgZdS)ObjectDigestInfoZdigested_object_typeZother_object_type_idrWTrTZ object_digestN)r*r+r,r~rrrr-r.r.r.r/rs  rc@s:eZdZdedddfdedddfdedddfgZd S) HolderrrrTrUZ entity_namerobject_digest_infor7N)r*r+r,rmr$rr-r.r.r.r/rsrc@s8eZdZdeddifdedddfdedddfgZd S) V2FormZ issuer_namerWTrrrrsrWrrN)r*r+r,r$rmrr-r.r.r.r/r s rc@s"eZdZdefdeddifgZdS) AttCertIssuerZv1_formZv2_formrsrN)r*r+r,r$rrHr.r.r.r/rs rc@s"eZdZdefdefdefgZdS) IetfAttrValueoctetsoidstringN)r*r+r,rrrrHr.r.r.r/rsrc@seZdZeZdS)IetfAttrValuesN)r*r+r,rrZr.r.r.r/r src@s$eZdZdedddfdefgZdS)IetfAttrSyntaxZpolicy_authorityrTrUrbN)r*r+r,r$rr-r.r.r.r/r$src@seZdZeZdS)SetOfIetfAttrSyntaxN)r*r+r,rrZr.r.r.r/r+src@s(eZdZdefdefdeddifgZdS) SvceAuthInfoZserviceidentZ auth_inforWTN)r*r+r,r#rr-r.r.r.r/r/s rc@seZdZeZdS)SetOfSvceAuthInfoN)r*r+r,rrZr.r.r.r/r7src@s*eZdZdedddfdeddifgZdS) RoleSyntaxZrole_authorityrTrUZ role_namerVrN)r*r+r,r$r#r-r.r.r.r/r;s rc@seZdZeZdS)SetOfRoleSyntaxN)r*r+r,rrZr.r.r.r/rBsrc@seZdZdddddddZdS) ClassListZunmarked unclassifiedZ restrictedZ confidentialsecretZ top_secretr6Nr;r.r.r.r/rFsrc@s(eZdZdeddifdeddifgZdS)SecurityCategoryr`rVrvaluerNr*r+r,rrr-r.r.r.r/rQs  rc@seZdZeZdS)SetOfSecurityCategoryN)r*r+r,rrZr.r.r.r/rXsrc@s8eZdZdeddifdedddfded d d fgZd S) Clearance policy_idrVrZ class_listrr)rVrvZsecurity_categoriesr7TrUN)r*r+r,rrrr-r.r.r.r/r\s rc@seZdZeZdS)SetOfClearanceN)r*r+r,rrZr.r.r.r/rdsrc@s(eZdZdefdefdeddifgZdS)BigTimemajorZfractional_secondssignrWTN)r*r+r,rr-r.r.r.r/rhs rc@seZdZdefdefgZdS)LeapDataZ leap_timeactionN)r*r+r,rrr-r.r.r.r/rpsrc@seZdZeZdS) SetOfLeapDataN)r*r+r,rrZr.r.r.r/rwsrc@s4eZdZdefdefdefdefdeddifgZdS) TimingMetricsZntp_timeoffsetdelayZ expirationZ leap_eventrWTN)r*r+r,rrr-r.r.r.r/r{s  rc@seZdZeZdS)SetOfTimingMetricsN)r*r+r,rrZr.r.r.r/rsrc@s8eZdZdedeifdedddfdedddfgZd S) TimingPolicyrspecZ max_offsetrTr max_delayrN)r*r+r,rrrr-r.r.r.r/rs rc@seZdZeZdS)SetOfTimingPolicyN)r*r+r,rrZr.r.r.r/rsrc @s"eZdZddddddddd Zd S) AttCertAttributeTypeauthentication_infoaccess_identitycharging_identitygrouprole clearancetiming_metrics timing_policy)z1.3.6.1.5.5.7.10.1z1.3.6.1.5.5.7.10.2z1.3.6.1.5.5.7.10.3z1.3.6.1.5.5.7.10.4z2.5.4.72z2.5.4.55z1.3.6.1.4.1.601.10.4.1z1.3.6.1.4.1.601.10.4.2Nr;r.r.r.r/rsrc @s>eZdZdefdgZeeeeeee e dZ ddZ de iZ dS)AttCertAttributer`ra)rrrrrrrrcCs|j|djtSrcrdrhr.r.r/rjszAttCertAttribute._values_specrbN)r*r+r,rr-rrrrrrrerjrkr.r.r.r/rs  rc@seZdZeZdS)AttCertAttributesN)r*r+r,rrZr.r.r.r/rsrc @sReZdZdefdefdefdefdefdefde fde d d ifd e d d ifg Z d S) AttributeCertificateInfoV2r'Zholderrnr2rxryr)rzrWTr{N) r*r+r,rprrr rrtrrr"r-r.r.r.r/rs  rc@s&eZdZdZdefdefdefgZdS)AttributeCertificateV2rr}r1r2N)r*r+r,Z_bad_tagrr rr-r.r.r.r/rs rc@seZdZdefdefgZdS)OtherCertificateFormatZother_cert_formatZ other_certNrr.r.r.r/rsrcsVeZdZdefdeddifdeddifdeddifd edd ifgZfd d Z Z S) CertificateChoicesr(Zextended_certificaterVrZ v1_attr_certrZ v2_attr_certr7otherr8csFtt|||||jdkrBtt|djdkrBd|_dS)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 r7rr5r8N) superrvalidateZ_choicerploadrdumprg)riclass_tagcontents __class__r.r/rs zCertificateChoices.validate) r*r+r,r!r0r|rrrHr __classcell__r.r.rr/rs    rc@seZdZeZdS)CertificateSetN)r*r+r,rrZr.r.r.r/rsrc@s,eZdZdefdedddfgZdZiZdS) ContentInfor>contentrTrr>rN)r*r+r,rIrr- _oid_pairrer.r.r.r/rs rc@seZdZeZdS)SetOfContentInfoN)r*r+r,rrZr.r.r.r/rsrc@s,eZdZdefdedddfgZdZiZdS)EncapsulatedContentInfor>rrTrrN)r*r+r,rIrr-rrer.r.r.r/rs rc@seZdZdefdefgZdS)IssuerAndSerialNumberrnrxN)r*r+r,r%rr-r.r.r.r/rsrc@s"eZdZdefdeddifgZdS)SignerIdentifierissuer_and_serial_numbersubject_key_identifierrVrNr*r+r,rrrHr.r.r.r/r%s rc@seZdZeZdS)DigestAlgorithmsN)r*r+r,rrZr.r.r.r/r,src@seZdZeZdS)CertificateRevocationListsN)r*r+r,rrZr.r.r.r/r0src@s$eZdZdedddfdefgZdS) SCVPReqResrequestrTrresponseN)r*r+r,rr-r.r.r.r/r4src@seZdZdddZdS)OtherRevInfoFormatId ocsp_responsescvp)z1.3.6.1.5.5.7.16.2z1.3.6.1.5.5.7.16.4Nr;r.r.r.r/r;src@s*eZdZdefdefgZdZeedZ dS)OtherRevocationInfoFormatother_rev_info_formatother_rev_info)rr)rrN) r*r+r,rrr-rrrrer.r.r.r/rBsrc@s"eZdZdefdeddifgZdS)RevocationInfoChoicecrlrrVrN)r*r+r,rrrHr.r.r.r/rOs rc@seZdZeZdS)RevocationInfoChoicesN)r*r+r,rrZr.r.r.r/rVsrc @sJeZdZdefdefdefdedddfdefd efd ed ddfgZ d S) SignerInfor'ZsidrTZ signed_attrsrTrUr1r2Zunsigned_attrsrN) r*r+r,r3rrrlr rr-r.r.r.r/rZsrc@seZdZeZdS) SignerInfosN)r*r+r,rrZr.r.r.r/rfsrc @sPeZdZdefdefddedddfded ddfd efgZd d Z d e iZ dS) SignedDatar'digest_algorithmsencap_content_infoN certificatesrTrUcrlsr signer_infoscCs|djdkrtStSNr'r4rgrrrhr.r.r/_encap_content_info_spectsz#SignedData._encap_content_info_specrN) r*r+r,r3rrrrr-rrkr.r.r.r/rjs rc@s,eZdZdedddfdedddfgZdS)OriginatorInfocertsrTrUrrN)r*r+r,rrr-r.r.r.r/rsrc@s"eZdZdefdeddifgZdS)RecipientIdentifierrrrVrNrr.r.r.r/rs rc @s:eZdZddddddddd Zd d d d d ddddd ZdS)KeyEncryptionAlgorithmIdrsaes_pkcs1v15 rsaes_oaep aes128_wrapaes128_wrap_pad aes192_wrapaes192_wrap_pad aes256_wrapaes256_wrap_pad)1.2.840.113549.1.1.11.2.840.113549.1.1.72.16.840.1.101.3.4.1.52.16.840.1.101.3.4.1.82.16.840.1.101.3.4.1.252.16.840.1.101.3.4.1.282.16.840.1.101.3.4.1.452.16.840.1.101.3.4.1.48rrrrrrrr) rsarrrrrrrrN)r*r+r,r<Z _reverse_mapr.r.r.r/rs& rc@s.eZdZdefdeddifgZdZdeiZdS)KeyEncryptionAlgorithm algorithm parametersrWT)rrrN) r*r+r,rrr-rr rer.r.r.r/rs rc@s(eZdZdefdefdefdefgZdS)KeyTransRecipientInfor'ridkey_encryption_algorithm encrypted_keyN)r*r+r,r3rrrr-r.r.r.r/rs rc@s.eZdZdefdeddifdeddifgZdS)OriginatorIdentifierOrKeyrrrVrZoriginator_keyrN)r*r+r,rrrrHr.r.r.r/rs  rc@seZdZdefdefgZdS)OtherKeyAttributeZ key_attr_idZkey_attrNrr.r.r.r/rsrc@s.eZdZdefdeddifdeddifgZdS)RecipientKeyIdentifierrdaterWTrNr*r+r,rrrr-r.r.r.r/rs  rc@s"eZdZdefdeddifgZdS)KeyAgreementRecipientIdentifierrZr_key_idrVrN)r*r+r,rrrHr.r.r.r/r s r c@seZdZdefdefgZdS)RecipientEncryptedKeyrrN)r*r+r,r rr-r.r.r.r/r sr c@seZdZeZdS)RecipientEncryptedKeysN)r*r+r,r rZr.r.r.r/r sr c@s<eZdZdefdeddifdedddfd efd efgZd S) KeyAgreeRecipientInfor'Z originatorrsrZukmrTrrZrecipient_encrypted_keysN) r*r+r,r3rrrr r-r.r.r.r/r s  r c@s.eZdZdefdeddifdeddifgZdS) KEKIdentifierZkey_identifierrrWTrNr r.r.r.r/rs  rc@s(eZdZdefdefdefdefgZdS)KEKRecipientInfor'ZkekidrrN)r*r+r,r3rrrr-r.r.r.r/rs rc@s0eZdZdefdedddfdefdefgZdS) PasswordRecipientInfor'Zkey_derivation_algorithmrTrUrrN)r*r+r,r3r rrr-r.r.r.r/rs rc@seZdZdefdefgZdS)OtherRecipientInfoZori_typeZ ori_valueNrr.r.r.r/rsrc@sFeZdZdefdeddifdeddifdeddifd edd ifgZd S) RecipientInfoZktriZkarirVrZkekrir7Zpwrir8Zorir9N) r*r+r,rr rrrrHr.r.r.r/rs     rc@seZdZeZdS)RecipientInfosN)r*r+r,rrZr.r.r.r/r!src@s*eZdZdefdefdedddfgZdS)EncryptedContentInfor>Zcontent_encryption_algorithmZencrypted_contentrTrUN)r*r+r,rIr rr-r.r.r.r/r%src @s>eZdZdefdedddfdefdefded ddfgZd S) EnvelopedDatar'originator_inforTrUrecipient_infosencrypted_content_infounprotected_attrsrN) r*r+r,r3rrrrlr-r.r.r.r/r-s rc @sJeZdZdefdefdefdefdedddfd ed ddfd e fgZ d S) SignedAndEnvelopedDatar'rrrrrTrUrrrN) r*r+r,r3rrrrrrr-r.r.r.r/r7src@s4eZdZdefdefddefgZddZdeiZdS) DigestedDatar'rTrdigestcCs|djdkrtStSrrrhr.r.r/rKsz%DigestedData._encap_content_info_specrN) r*r+r,r3rrr-rrkr.r.r.r/rCsrc@s*eZdZdefdefdedddfgZdS) EncryptedDatar'rrrTrUN)r*r+r,r3rrlr-r.r.r.r/r^src @sfeZdZdefdedddfdefdefded ddfd efd e d ddfd e fde dddfg Z dS)AuthenticatedDatar'rrTrUrrXrTrr auth_attrsr7mac unauth_attrsr8N) r*r+r,r3rrr rrrlrr-r.r.r.r/rfsrc @sReZdZdefdedddfdefdefded ddfd efd ed ddfgZ d S)AuthEnvelopedDatar'rrTrUrZauth_encrypted_content_inforrr r!r7N) r*r+r,r3rrrrlrr-r.r.r.r/r"vsr"c@seZdZddiZdS)CompressionAlgorithmIdz1.2.840.113549.1.9.16.3.8zlibNr;r.r.r.r/r#sr#c@s"eZdZdefdeddifgZdS)CompressionAlgorithmrrrWTN)r*r+r,r#rr-r.r.r.r/r%s r%c@s2eZdZdefdefdefgZdZeddZ dS)CompressedDatar'Zcompression_algorithmrNcCs6|jdkr0tdkrtdt|ddj|_|jS)Nz The zlib module is not availablerr) _decompressedr$ SystemError decompressrgrhr.r.r/ decompresseds  zCompressedData.decompressed) r*r+r,r3r%rr-r'propertyr*r.r.r.r/r&sr&c@s.eZdZdefdeddifdeddifgZdS)rZsubjectKeyIdentifierrrWTrNr r.r.r.r/rs  c@s4eZdZdeddifdeddifdeddifgZdS) SMIMEEncryptionKeyPreferencerrVrZrecipientKeyIdrZsubjectAltKeyIdentifierr7N)r*r+r,rrrrHr.r.r.r/r,s   r,c@seZdZeZdS)SMIMEEncryptionKeyPreferencesN)r*r+r,r,rZr.r.r.r/r-sr-) rJrKrLrMrNrOrPrQrR)rKrLrMrNrOrPrQrR) r>r?r@rArCrDrErFrB)__doc__ __future__rrrrr$ ImportErrorZalgosrrr r r r r corerrrrrrrrrrrrrrrrrkeysrZocsprx509r r!r"r#r$r%r&r0r3r=rGrIrSrYr[r\r]r^r_rlrmrprqrtrur|r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r r rrrrrrrrrrrrr"r#r%r&r,r-rer.r.r.r/s  $ D          #