Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

rfc7906.py 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736
  1. #
  2. # This file is part of pyasn1-modules software.
  3. #
  4. # Created by Russ Housley.
  5. #
  6. # Copyright (c) 2019, Vigil Security, LLC
  7. # License: http://snmplabs.com/pyasn1/license.html
  8. #
  9. # NSA's CMS Key Management Attributes
  10. #
  11. # ASN.1 source from:
  12. # https://www.rfc-editor.org/rfc/rfc7906.txt
  13. # https://www.rfc-editor.org/errata/eid5850
  14. #
  15. from pyasn1.type import char
  16. from pyasn1.type import constraint
  17. from pyasn1.type import namedtype
  18. from pyasn1.type import namedval
  19. from pyasn1.type import tag
  20. from pyasn1.type import univ
  21. from pyasn1_modules import rfc2634
  22. from pyasn1_modules import rfc4108
  23. from pyasn1_modules import rfc5280
  24. from pyasn1_modules import rfc5652
  25. from pyasn1_modules import rfc6010
  26. from pyasn1_modules import rfc6019
  27. from pyasn1_modules import rfc7191
  28. MAX = float('inf')
  29. # Imports From RFC 2634
  30. id_aa_contentHint = rfc2634.id_aa_contentHint
  31. ContentHints = rfc2634.ContentHints
  32. id_aa_securityLabel = rfc2634.id_aa_securityLabel
  33. SecurityPolicyIdentifier = rfc2634.SecurityPolicyIdentifier
  34. SecurityClassification = rfc2634.SecurityClassification
  35. ESSPrivacyMark = rfc2634.ESSPrivacyMark
  36. SecurityCategories= rfc2634.SecurityCategories
  37. ESSSecurityLabel = rfc2634.ESSSecurityLabel
  38. # Imports From RFC 4108
  39. id_aa_communityIdentifiers = rfc4108.id_aa_communityIdentifiers
  40. CommunityIdentifier = rfc4108.CommunityIdentifier
  41. CommunityIdentifiers = rfc4108.CommunityIdentifiers
  42. # Imports From RFC 5280
  43. AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
  44. Name = rfc5280.Name
  45. Certificate = rfc5280.Certificate
  46. GeneralNames = rfc5280.GeneralNames
  47. GeneralName = rfc5280.GeneralName
  48. SubjectInfoAccessSyntax = rfc5280.SubjectInfoAccessSyntax
  49. id_pkix = rfc5280.id_pkix
  50. id_pe = rfc5280.id_pe
  51. id_pe_subjectInfoAccess = rfc5280.id_pe_subjectInfoAccess
  52. # Imports From RFC 6010
  53. CMSContentConstraints = rfc6010.CMSContentConstraints
  54. # Imports From RFC 6019
  55. BinaryTime = rfc6019.BinaryTime
  56. id_aa_binarySigningTime = rfc6019.id_aa_binarySigningTime
  57. BinarySigningTime = rfc6019.BinarySigningTime
  58. # Imports From RFC 5652
  59. Attribute = rfc5652.Attribute
  60. CertificateSet = rfc5652.CertificateSet
  61. CertificateChoices = rfc5652.CertificateChoices
  62. id_contentType = rfc5652.id_contentType
  63. ContentType = rfc5652.ContentType
  64. id_messageDigest = rfc5652.id_messageDigest
  65. MessageDigest = rfc5652.MessageDigest
  66. # Imports From RFC 7191
  67. SIREntityName = rfc7191.SIREntityName
  68. id_aa_KP_keyPkgIdAndReceiptReq = rfc7191.id_aa_KP_keyPkgIdAndReceiptReq
  69. KeyPkgIdentifierAndReceiptReq = rfc7191.KeyPkgIdentifierAndReceiptReq
  70. # Key Province Attribute
  71. id_aa_KP_keyProvinceV2 = univ.ObjectIdentifier('2.16.840.1.101.2.1.5.71')
  72. class KeyProvinceV2(univ.ObjectIdentifier):
  73. pass
  74. aa_keyProvince_v2 = Attribute()
  75. aa_keyProvince_v2['attrType'] = id_aa_KP_keyProvinceV2
  76. aa_keyProvince_v2['attrValues'][0] = KeyProvinceV2()
  77. # Manifest Attribute
  78. id_aa_KP_manifest = univ.ObjectIdentifier('2.16.840.1.101.2.1.5.72')
  79. class ShortTitle(char.PrintableString):
  80. pass
  81. class Manifest(univ.SequenceOf):
  82. pass
  83. Manifest.componentType = ShortTitle()
  84. Manifest.subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
  85. aa_manifest = Attribute()
  86. aa_manifest['attrType'] = id_aa_KP_manifest
  87. aa_manifest['attrValues'][0] = Manifest()
  88. # Key Algorithm Attribute
  89. id_kma_keyAlgorithm = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.1')
  90. class KeyAlgorithm(univ.Sequence):
  91. pass
  92. KeyAlgorithm.componentType = namedtype.NamedTypes(
  93. namedtype.NamedType('keyAlg', univ.ObjectIdentifier()),
  94. namedtype.OptionalNamedType('checkWordAlg', univ.ObjectIdentifier().subtype(
  95. implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
  96. namedtype.OptionalNamedType('crcAlg', univ.ObjectIdentifier().subtype(
  97. implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
  98. )
  99. aa_keyAlgorithm = Attribute()
  100. aa_keyAlgorithm['attrType'] = id_kma_keyAlgorithm
  101. aa_keyAlgorithm['attrValues'][0] = KeyAlgorithm()
  102. # User Certificate Attribute
  103. id_at_userCertificate = univ.ObjectIdentifier('2.5.4.36')
  104. aa_userCertificate = Attribute()
  105. aa_userCertificate['attrType'] = id_at_userCertificate
  106. aa_userCertificate['attrValues'][0] = Certificate()
  107. # Key Package Receivers Attribute
  108. id_kma_keyPkgReceiversV2 = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.16')
  109. class KeyPkgReceiver(univ.Choice):
  110. pass
  111. KeyPkgReceiver.componentType = namedtype.NamedTypes(
  112. namedtype.NamedType('sirEntity', SIREntityName().subtype(
  113. implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
  114. namedtype.NamedType('community', CommunityIdentifier().subtype(
  115. implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)))
  116. )
  117. class KeyPkgReceiversV2(univ.SequenceOf):
  118. pass
  119. KeyPkgReceiversV2.componentType = KeyPkgReceiver()
  120. KeyPkgReceiversV2.subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
  121. aa_keyPackageReceivers_v2 = Attribute()
  122. aa_keyPackageReceivers_v2['attrType'] = id_kma_keyPkgReceiversV2
  123. aa_keyPackageReceivers_v2['attrValues'][0] = KeyPkgReceiversV2()
  124. # TSEC Nomenclature Attribute
  125. id_kma_TSECNomenclature = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.3')
  126. class CharEdition(char.PrintableString):
  127. pass
  128. class CharEditionRange(univ.Sequence):
  129. pass
  130. CharEditionRange.componentType = namedtype.NamedTypes(
  131. namedtype.NamedType('firstCharEdition', CharEdition()),
  132. namedtype.NamedType('lastCharEdition', CharEdition())
  133. )
  134. class NumEdition(univ.Integer):
  135. pass
  136. NumEdition.subtypeSpec = constraint.ValueRangeConstraint(0, 308915776)
  137. class NumEditionRange(univ.Sequence):
  138. pass
  139. NumEditionRange.componentType = namedtype.NamedTypes(
  140. namedtype.NamedType('firstNumEdition', NumEdition()),
  141. namedtype.NamedType('lastNumEdition', NumEdition())
  142. )
  143. class EditionID(univ.Choice):
  144. pass
  145. EditionID.componentType = namedtype.NamedTypes(
  146. namedtype.NamedType('char', univ.Choice(componentType=namedtype.NamedTypes(
  147. namedtype.NamedType('charEdition', CharEdition().subtype(
  148. implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
  149. namedtype.NamedType('charEditionRange', CharEditionRange().subtype(
  150. implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2)))
  151. ))
  152. ),
  153. namedtype.NamedType('num', univ.Choice(componentType=namedtype.NamedTypes(
  154. namedtype.NamedType('numEdition', NumEdition().subtype(
  155. implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
  156. namedtype.NamedType('numEditionRange', NumEditionRange().subtype(
  157. implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 4)))
  158. ))
  159. )
  160. )
  161. class Register(univ.Integer):
  162. pass
  163. Register.subtypeSpec = constraint.ValueRangeConstraint(0, 2147483647)
  164. class RegisterRange(univ.Sequence):
  165. pass
  166. RegisterRange.componentType = namedtype.NamedTypes(
  167. namedtype.NamedType('firstRegister', Register()),
  168. namedtype.NamedType('lastRegister', Register())
  169. )
  170. class RegisterID(univ.Choice):
  171. pass
  172. RegisterID.componentType = namedtype.NamedTypes(
  173. namedtype.NamedType('register', Register().subtype(
  174. implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 5))),
  175. namedtype.NamedType('registerRange', RegisterRange().subtype(
  176. implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 6)))
  177. )
  178. class SegmentNumber(univ.Integer):
  179. pass
  180. SegmentNumber.subtypeSpec = constraint.ValueRangeConstraint(1, 127)
  181. class SegmentRange(univ.Sequence):
  182. pass
  183. SegmentRange.componentType = namedtype.NamedTypes(
  184. namedtype.NamedType('firstSegment', SegmentNumber()),
  185. namedtype.NamedType('lastSegment', SegmentNumber())
  186. )
  187. class SegmentID(univ.Choice):
  188. pass
  189. SegmentID.componentType = namedtype.NamedTypes(
  190. namedtype.NamedType('segmentNumber', SegmentNumber().subtype(
  191. implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 7))),
  192. namedtype.NamedType('segmentRange', SegmentRange().subtype(
  193. implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 8)))
  194. )
  195. class TSECNomenclature(univ.Sequence):
  196. pass
  197. TSECNomenclature.componentType = namedtype.NamedTypes(
  198. namedtype.NamedType('shortTitle', ShortTitle()),
  199. namedtype.OptionalNamedType('editionID', EditionID()),
  200. namedtype.OptionalNamedType('registerID', RegisterID()),
  201. namedtype.OptionalNamedType('segmentID', SegmentID())
  202. )
  203. aa_tsecNomenclature = Attribute()
  204. aa_tsecNomenclature['attrType'] = id_kma_TSECNomenclature
  205. aa_tsecNomenclature['attrValues'][0] = TSECNomenclature()
  206. # Key Purpose Attribute
  207. id_kma_keyPurpose = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.13')
  208. class KeyPurpose(univ.Enumerated):
  209. pass
  210. KeyPurpose.namedValues = namedval.NamedValues(
  211. ('n-a', 0),
  212. ('a', 65),
  213. ('b', 66),
  214. ('l', 76),
  215. ('m', 77),
  216. ('r', 82),
  217. ('s', 83),
  218. ('t', 84),
  219. ('v', 86),
  220. ('x', 88),
  221. ('z', 90)
  222. )
  223. aa_keyPurpose = Attribute()
  224. aa_keyPurpose['attrType'] = id_kma_keyPurpose
  225. aa_keyPurpose['attrValues'][0] = KeyPurpose()
  226. # Key Use Attribute
  227. id_kma_keyUse = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.14')
  228. class KeyUse(univ.Enumerated):
  229. pass
  230. KeyUse.namedValues = namedval.NamedValues(
  231. ('n-a', 0),
  232. ('ffk', 1),
  233. ('kek', 2),
  234. ('kpk', 3),
  235. ('msk', 4),
  236. ('qkek', 5),
  237. ('tek', 6),
  238. ('tsk', 7),
  239. ('trkek', 8),
  240. ('nfk', 9),
  241. ('effk', 10),
  242. ('ebfk', 11),
  243. ('aek', 12),
  244. ('wod', 13),
  245. ('kesk', 246),
  246. ('eik', 247),
  247. ('ask', 248),
  248. ('kmk', 249),
  249. ('rsk', 250),
  250. ('csk', 251),
  251. ('sak', 252),
  252. ('rgk', 253),
  253. ('cek', 254),
  254. ('exk', 255)
  255. )
  256. aa_keyUse = Attribute()
  257. aa_keyPurpose['attrType'] = id_kma_keyUse
  258. aa_keyPurpose['attrValues'][0] = KeyUse()
  259. # Transport Key Attribute
  260. id_kma_transportKey = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.15')
  261. class TransOp(univ.Enumerated):
  262. pass
  263. TransOp.namedValues = namedval.NamedValues(
  264. ('transport', 1),
  265. ('operational', 2)
  266. )
  267. aa_transportKey = Attribute()
  268. aa_transportKey['attrType'] = id_kma_transportKey
  269. aa_transportKey['attrValues'][0] = TransOp()
  270. # Key Distribution Period Attribute
  271. id_kma_keyDistPeriod = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.5')
  272. class KeyDistPeriod(univ.Sequence):
  273. pass
  274. KeyDistPeriod.componentType = namedtype.NamedTypes(
  275. namedtype.OptionalNamedType('doNotDistBefore', BinaryTime().subtype(
  276. implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
  277. namedtype.NamedType('doNotDistAfter', BinaryTime())
  278. )
  279. aa_keyDistributionPeriod = Attribute()
  280. aa_keyDistributionPeriod['attrType'] = id_kma_keyDistPeriod
  281. aa_keyDistributionPeriod['attrValues'][0] = KeyDistPeriod()
  282. # Key Validity Period Attribute
  283. id_kma_keyValidityPeriod = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.6')
  284. class KeyValidityPeriod(univ.Sequence):
  285. pass
  286. KeyValidityPeriod.componentType = namedtype.NamedTypes(
  287. namedtype.NamedType('doNotUseBefore', BinaryTime()),
  288. namedtype.OptionalNamedType('doNotUseAfter', BinaryTime())
  289. )
  290. aa_keyValidityPeriod = Attribute()
  291. aa_keyValidityPeriod['attrType'] = id_kma_keyValidityPeriod
  292. aa_keyValidityPeriod['attrValues'][0] = KeyValidityPeriod()
  293. # Key Duration Attribute
  294. id_kma_keyDuration = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.7')
  295. ub_KeyDuration_months = univ.Integer(72)
  296. ub_KeyDuration_hours = univ.Integer(96)
  297. ub_KeyDuration_days = univ.Integer(732)
  298. ub_KeyDuration_weeks = univ.Integer(104)
  299. ub_KeyDuration_years = univ.Integer(100)
  300. class KeyDuration(univ.Choice):
  301. pass
  302. KeyDuration.componentType = namedtype.NamedTypes(
  303. namedtype.NamedType('hours', univ.Integer().subtype(
  304. subtypeSpec=constraint.ValueRangeConstraint(1, ub_KeyDuration_hours)).subtype(
  305. implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
  306. namedtype.NamedType('days', univ.Integer().subtype(
  307. subtypeSpec=constraint.ValueRangeConstraint(1, ub_KeyDuration_days))),
  308. namedtype.NamedType('weeks', univ.Integer().subtype(
  309. subtypeSpec=constraint.ValueRangeConstraint(1, ub_KeyDuration_weeks)).subtype(
  310. implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
  311. namedtype.NamedType('months', univ.Integer().subtype(
  312. subtypeSpec=constraint.ValueRangeConstraint(1, ub_KeyDuration_months)).subtype(
  313. implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))),
  314. namedtype.NamedType('years', univ.Integer().subtype(
  315. subtypeSpec=constraint.ValueRangeConstraint(1, ub_KeyDuration_years)).subtype(
  316. implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3)))
  317. )
  318. aa_keyDurationPeriod = Attribute()
  319. aa_keyDurationPeriod['attrType'] = id_kma_keyDuration
  320. aa_keyDurationPeriod['attrValues'][0] = KeyDuration()
  321. # Classification Attribute
  322. id_aa_KP_classification = univ.ObjectIdentifier(id_aa_securityLabel)
  323. id_enumeratedPermissiveAttributes = univ.ObjectIdentifier('2.16.840.1.101.2.1.8.3.1')
  324. id_enumeratedRestrictiveAttributes = univ.ObjectIdentifier('2.16.840.1.101.2.1.8.3.4')
  325. id_informativeAttributes = univ.ObjectIdentifier('2.16.840.1.101.2.1.8.3.3')
  326. class SecurityAttribute(univ.Integer):
  327. pass
  328. SecurityAttribute.subtypeSpec = constraint.ValueRangeConstraint(0, MAX)
  329. class EnumeratedTag(univ.Sequence):
  330. pass
  331. EnumeratedTag.componentType = namedtype.NamedTypes(
  332. namedtype.NamedType('tagName', univ.ObjectIdentifier()),
  333. namedtype.NamedType('attributeList', univ.SetOf(componentType=SecurityAttribute()))
  334. )
  335. class FreeFormField(univ.Choice):
  336. pass
  337. FreeFormField.componentType = namedtype.NamedTypes(
  338. namedtype.NamedType('bitSetAttributes', univ.BitString()), # Not permitted in RFC 7906
  339. namedtype.NamedType('securityAttributes', univ.SetOf(componentType=SecurityAttribute()))
  340. )
  341. class InformativeTag(univ.Sequence):
  342. pass
  343. InformativeTag.componentType = namedtype.NamedTypes(
  344. namedtype.NamedType('tagName', univ.ObjectIdentifier()),
  345. namedtype.NamedType('attributes', FreeFormField())
  346. )
  347. class Classification(ESSSecurityLabel):
  348. pass
  349. aa_classification = Attribute()
  350. aa_classification['attrType'] = id_aa_KP_classification
  351. aa_classification['attrValues'][0] = Classification()
  352. # Split Identifier Attribute
  353. id_kma_splitID = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.11')
  354. class SplitID(univ.Sequence):
  355. pass
  356. SplitID.componentType = namedtype.NamedTypes(
  357. namedtype.NamedType('half', univ.Enumerated(
  358. namedValues=namedval.NamedValues(('a', 0), ('b', 1)))),
  359. namedtype.OptionalNamedType('combineAlg', AlgorithmIdentifier())
  360. )
  361. aa_splitIdentifier = Attribute()
  362. aa_splitIdentifier['attrType'] = id_kma_splitID
  363. aa_splitIdentifier['attrValues'][0] = SplitID()
  364. # Key Package Type Attribute
  365. id_kma_keyPkgType = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.12')
  366. class KeyPkgType(univ.ObjectIdentifier):
  367. pass
  368. aa_keyPackageType = Attribute()
  369. aa_keyPackageType['attrType'] = id_kma_keyPkgType
  370. aa_keyPackageType['attrValues'][0] = KeyPkgType()
  371. # Signature Usage Attribute
  372. id_kma_sigUsageV3 = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.22')
  373. class SignatureUsage(CMSContentConstraints):
  374. pass
  375. aa_signatureUsage_v3 = Attribute()
  376. aa_signatureUsage_v3['attrType'] = id_kma_sigUsageV3
  377. aa_signatureUsage_v3['attrValues'][0] = SignatureUsage()
  378. # Other Certificate Format Attribute
  379. id_kma_otherCertFormats = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.19')
  380. aa_otherCertificateFormats = Attribute()
  381. aa_signatureUsage_v3['attrType'] = id_kma_otherCertFormats
  382. aa_signatureUsage_v3['attrValues'][0] = CertificateChoices()
  383. # PKI Path Attribute
  384. id_at_pkiPath = univ.ObjectIdentifier('2.5.4.70')
  385. class PkiPath(univ.SequenceOf):
  386. pass
  387. PkiPath.componentType = Certificate()
  388. PkiPath.subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
  389. aa_pkiPath = Attribute()
  390. aa_pkiPath['attrType'] = id_at_pkiPath
  391. aa_pkiPath['attrValues'][0] = PkiPath()
  392. # Useful Certificates Attribute
  393. id_kma_usefulCerts = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.20')
  394. aa_usefulCertificates = Attribute()
  395. aa_usefulCertificates['attrType'] = id_kma_usefulCerts
  396. aa_usefulCertificates['attrValues'][0] = CertificateSet()
  397. # Key Wrap Attribute
  398. id_kma_keyWrapAlgorithm = univ.ObjectIdentifier('2.16.840.1.101.2.1.13.21')
  399. aa_keyWrapAlgorithm = Attribute()
  400. aa_keyWrapAlgorithm['attrType'] = id_kma_keyWrapAlgorithm
  401. aa_keyWrapAlgorithm['attrValues'][0] = AlgorithmIdentifier()
  402. # Content Decryption Key Identifier Attribute
  403. id_aa_KP_contentDecryptKeyID = univ.ObjectIdentifier('2.16.840.1.101.2.1.5.66')
  404. class ContentDecryptKeyID(univ.OctetString):
  405. pass
  406. aa_contentDecryptKeyIdentifier = Attribute()
  407. aa_contentDecryptKeyIdentifier['attrType'] = id_aa_KP_contentDecryptKeyID
  408. aa_contentDecryptKeyIdentifier['attrValues'][0] = ContentDecryptKeyID()
  409. # Certificate Pointers Attribute
  410. aa_certificatePointers = Attribute()
  411. aa_certificatePointers['attrType'] = id_pe_subjectInfoAccess
  412. aa_certificatePointers['attrValues'][0] = SubjectInfoAccessSyntax()
  413. # CRL Pointers Attribute
  414. id_aa_KP_crlPointers = univ.ObjectIdentifier('2.16.840.1.101.2.1.5.70')
  415. aa_cRLDistributionPoints = Attribute()
  416. aa_cRLDistributionPoints['attrType'] = id_aa_KP_crlPointers
  417. aa_cRLDistributionPoints['attrValues'][0] = GeneralNames()
  418. # Extended Error Codes
  419. id_errorCodes = univ.ObjectIdentifier('2.16.840.1.101.2.1.22')
  420. id_missingKeyType = univ.ObjectIdentifier('2.16.840.1.101.2.1.22.1')
  421. id_privacyMarkTooLong = univ.ObjectIdentifier('2.16.840.1.101.2.1.22.2')
  422. id_unrecognizedSecurityPolicy = univ.ObjectIdentifier('2.16.840.1.101.2.1.22.3')
  423. # Map of Attribute Type OIDs to Attributes added to the
  424. # ones that are in rfc5652.py
  425. _cmsAttributesMapUpdate = {
  426. id_aa_contentHint: ContentHints(),
  427. id_aa_communityIdentifiers: CommunityIdentifiers(),
  428. id_aa_binarySigningTime: BinarySigningTime(),
  429. id_contentType: ContentType(),
  430. id_messageDigest: MessageDigest(),
  431. id_aa_KP_keyPkgIdAndReceiptReq: KeyPkgIdentifierAndReceiptReq(),
  432. id_aa_KP_keyProvinceV2: KeyProvinceV2(),
  433. id_aa_KP_manifest: Manifest(),
  434. id_kma_keyAlgorithm: KeyAlgorithm(),
  435. id_at_userCertificate: Certificate(),
  436. id_kma_keyPkgReceiversV2: KeyPkgReceiversV2(),
  437. id_kma_TSECNomenclature: TSECNomenclature(),
  438. id_kma_keyPurpose: KeyPurpose(),
  439. id_kma_keyUse: KeyUse(),
  440. id_kma_transportKey: TransOp(),
  441. id_kma_keyDistPeriod: KeyDistPeriod(),
  442. id_kma_keyValidityPeriod: KeyValidityPeriod(),
  443. id_kma_keyDuration: KeyDuration(),
  444. id_aa_KP_classification: Classification(),
  445. id_kma_splitID: SplitID(),
  446. id_kma_keyPkgType: KeyPkgType(),
  447. id_kma_sigUsageV3: SignatureUsage(),
  448. id_kma_otherCertFormats: CertificateChoices(),
  449. id_at_pkiPath: PkiPath(),
  450. id_kma_usefulCerts: CertificateSet(),
  451. id_kma_keyWrapAlgorithm: AlgorithmIdentifier(),
  452. id_aa_KP_contentDecryptKeyID: ContentDecryptKeyID(),
  453. id_pe_subjectInfoAccess: SubjectInfoAccessSyntax(),
  454. id_aa_KP_crlPointers: GeneralNames(),
  455. }
  456. rfc5652.cmsAttributesMap.update(_cmsAttributesMapUpdate)