rfc2315.py (8072B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\carbon\common\lib\pyasn1_modules\rfc2315.py 2 from pyasn1.type import tag, namedtype, namedval, univ, constraint, char, useful 3 from pyasn1_modules.rfc2459 import * 4 5 class Attribute(univ.Sequence): 6 componentType = namedtype.NamedTypes(namedtype.NamedType('type', AttributeType()), namedtype.NamedType('values', univ.SetOf(componentType=AttributeValue()))) 7 8 9 class AttributeValueAssertion(univ.Sequence): 10 componentType = namedtype.NamedTypes(namedtype.NamedType('attributeType', AttributeType()), namedtype.NamedType('attributeValue', AttributeValue())) 11 12 13 pkcs_7 = univ.ObjectIdentifier('1.2.840.113549.1.7') 14 data = univ.ObjectIdentifier('1.2.840.113549.1.7.1') 15 signedData = univ.ObjectIdentifier('1.2.840.113549.1.7.2') 16 envelopedData = univ.ObjectIdentifier('1.2.840.113549.1.7.3') 17 signedAndEnvelopedData = univ.ObjectIdentifier('1.2.840.113549.1.7.4') 18 digestedData = univ.ObjectIdentifier('1.2.840.113549.1.7.5') 19 encryptedData = univ.ObjectIdentifier('1.2.840.113549.1.7.6') 20 21 class ContentType(univ.ObjectIdentifier): 22 pass 23 24 25 class ContentEncryptionAlgorithmIdentifier(AlgorithmIdentifier): 26 pass 27 28 29 class EncryptedContent(univ.OctetString): 30 pass 31 32 33 class EncryptedContentInfo(univ.Sequence): 34 componentType = namedtype.NamedTypes(namedtype.NamedType('contentType', ContentType()), namedtype.NamedType('contentEncryptionAlgorithm', ContentEncryptionAlgorithmIdentifier()), namedtype.OptionalNamedType('encryptedContent', EncryptedContent().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))) 35 36 37 class Version(univ.Integer): 38 pass 39 40 41 class EncryptedData(univ.Sequence): 42 componentType = namedtype.NamedTypes(namedtype.NamedType('version', Version()), namedtype.NamedType('encryptedContentInfo', EncryptedContentInfo())) 43 44 45 class DigestAlgorithmIdentifier(AlgorithmIdentifier): 46 pass 47 48 49 class DigestAlgorithmIdentifiers(univ.SetOf): 50 componentType = DigestAlgorithmIdentifier() 51 52 53 class Digest(univ.OctetString): 54 pass 55 56 57 class ContentInfo(univ.Sequence): 58 componentType = namedtype.NamedTypes(namedtype.NamedType('contentType', ContentType()), namedtype.OptionalNamedType('content', univ.Any().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))) 59 60 61 class DigestedData(univ.Sequence): 62 componentType = namedtype.NamedTypes(namedtype.NamedType('version', Version()), namedtype.NamedType('digestAlgorithm', DigestAlgorithmIdentifier()), namedtype.NamedType('contentInfo', ContentInfo()), namedtype.NamedType('digest', Digest)) 63 64 65 class IssuerAndSerialNumber(univ.Sequence): 66 componentType = namedtype.NamedTypes(namedtype.NamedType('issuer', Name()), namedtype.NamedType('serialNumber', CertificateSerialNumber())) 67 68 69 class KeyEncryptionAlgorithmIdentifier(AlgorithmIdentifier): 70 pass 71 72 73 class EncryptedKey(univ.OctetString): 74 pass 75 76 77 class RecipientInfo(univ.Sequence): 78 componentType = namedtype.NamedTypes(namedtype.NamedType('version', Version()), namedtype.NamedType('issuerAndSerialNumber', IssuerAndSerialNumber()), namedtype.NamedType('keyEncryptionAlgorithm', KeyEncryptionAlgorithmIdentifier()), namedtype.NamedType('encryptedKey', EncryptedKey())) 79 80 81 class RecipientInfos(univ.SetOf): 82 componentType = RecipientInfo() 83 84 85 class Attributes(univ.SetOf): 86 componentType = Attribute() 87 88 89 class ExtendedCertificateInfo(univ.Sequence): 90 componentType = namedtype.NamedTypes(namedtype.NamedType('version', Version()), namedtype.NamedType('certificate', Certificate()), namedtype.NamedType('attributes', Attributes())) 91 92 93 class SignatureAlgorithmIdentifier(AlgorithmIdentifier): 94 pass 95 96 97 class Signature(univ.BitString): 98 pass 99 100 101 class ExtendedCertificate(univ.Sequence): 102 componentType = namedtype.NamedTypes(namedtype.NamedType('extendedCertificateInfo', ExtendedCertificateInfo()), namedtype.NamedType('signatureAlgorithm', SignatureAlgorithmIdentifier()), namedtype.NamedType('signature', Signature())) 103 104 105 class ExtendedCertificateOrCertificate(univ.Choice): 106 componentType = namedtype.NamedTypes(namedtype.NamedType('certificate', Certificate()), namedtype.NamedType('extendedCertificate', ExtendedCertificate().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)))) 107 108 109 class ExtendedCertificatesAndCertificates(univ.SetOf): 110 componentType = ExtendedCertificateOrCertificate() 111 112 113 class SerialNumber(univ.Integer): 114 pass 115 116 117 class CRLEntry(univ.Sequence): 118 componentType = namedtype.NamedTypes(namedtype.NamedType('userCertificate', SerialNumber()), namedtype.NamedType('revocationDate', useful.UTCTime())) 119 120 121 class TBSCertificateRevocationList(univ.Sequence): 122 componentType = namedtype.NamedTypes(namedtype.NamedType('signature', AlgorithmIdentifier()), namedtype.NamedType('issuer', Name()), namedtype.NamedType('lastUpdate', useful.UTCTime()), namedtype.NamedType('nextUpdate', useful.UTCTime()), namedtype.OptionalNamedType('revokedCertificates', univ.SequenceOf(componentType=CRLEntry()))) 123 124 125 class CertificateRevocationList(univ.Sequence): 126 componentType = namedtype.NamedTypes(namedtype.NamedType('tbsCertificateRevocationList', TBSCertificateRevocationList()), namedtype.NamedType('signatureAlgorithm', AlgorithmIdentifier()), namedtype.NamedType('signature', univ.BitString())) 127 128 129 class CertificateRevocationLists(univ.SetOf): 130 componentType = CertificateRevocationList() 131 132 133 class DigestEncryptionAlgorithmIdentifier(AlgorithmIdentifier): 134 pass 135 136 137 class EncryptedDigest(univ.OctetString): 138 pass 139 140 141 class SignerInfo(univ.Sequence): 142 componentType = namedtype.NamedTypes(namedtype.NamedType('version', Version()), namedtype.NamedType('issuerAndSerialNumber', IssuerAndSerialNumber()), namedtype.NamedType('digestAlgorithm', DigestAlgorithmIdentifier()), namedtype.OptionalNamedType('authenticatedAttributes', Attributes().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))), namedtype.NamedType('digestEncryptionAlgorithm', DigestEncryptionAlgorithmIdentifier()), namedtype.NamedType('encryptedDigest', EncryptedDigest()), namedtype.OptionalNamedType('unauthenticatedAttributes', Attributes().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)))) 143 144 145 class SignerInfos(univ.SetOf): 146 componentType = SignerInfo() 147 148 149 class SignedAndEnvelopedData(univ.Sequence): 150 componentType = namedtype.NamedTypes(namedtype.NamedType('version', Version()), namedtype.NamedType('recipientInfos', RecipientInfos()), namedtype.NamedType('digestAlgorithms', DigestAlgorithmIdentifiers()), namedtype.NamedType('encryptedContentInfo', EncryptedContentInfo()), namedtype.OptionalNamedType('certificates', ExtendedCertificatesAndCertificates().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))), namedtype.OptionalNamedType('crls', CertificateRevocationLists().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))), namedtype.NamedType('signerInfos', SignerInfos())) 151 152 153 class EnvelopedData(univ.Sequence): 154 componentType = namedtype.NamedTypes(namedtype.NamedType('version', Version()), namedtype.NamedType('recipientInfos', RecipientInfos()), namedtype.NamedType('encryptedContentInfo', EncryptedContentInfo())) 155 156 157 class DigestInfo(univ.Sequence): 158 componentType = namedtype.NamedTypes(namedtype.NamedType('digestAlgorithm', DigestAlgorithmIdentifier()), namedtype.NamedType('digest', Digest())) 159 160 161 class SignedData(univ.Sequence): 162 componentType = namedtype.NamedTypes(namedtype.NamedType('version', Version()), namedtype.NamedType('digestAlgorithms', DigestAlgorithmIdentifiers()), namedtype.NamedType('contentInfo', ContentInfo()), namedtype.OptionalNamedType('certificates', ExtendedCertificatesAndCertificates().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))), namedtype.OptionalNamedType('crls', CertificateRevocationLists().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))), namedtype.NamedType('signerInfos', SignerInfos())) 163 164 165 class Data(univ.OctetString): 166 pass