pyasn1-alt-modules 0.4.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pyasn1-alt-modules might be problematic. Click here for more details.

Files changed (195) hide show
  1. pyasn1_alt_modules/__init__.py +2 -0
  2. pyasn1_alt_modules/opentypemap.py +19 -0
  3. pyasn1_alt_modules/pem.py +66 -0
  4. pyasn1_alt_modules/rfc1155.py +97 -0
  5. pyasn1_alt_modules/rfc1157.py +127 -0
  6. pyasn1_alt_modules/rfc1901.py +23 -0
  7. pyasn1_alt_modules/rfc1902.py +130 -0
  8. pyasn1_alt_modules/rfc1905.py +136 -0
  9. pyasn1_alt_modules/rfc2040.py +50 -0
  10. pyasn1_alt_modules/rfc2251.py +564 -0
  11. pyasn1_alt_modules/rfc2314.py +68 -0
  12. pyasn1_alt_modules/rfc2315.py +325 -0
  13. pyasn1_alt_modules/rfc2437.py +70 -0
  14. pyasn1_alt_modules/rfc2459.py +1340 -0
  15. pyasn1_alt_modules/rfc2511.py +303 -0
  16. pyasn1_alt_modules/rfc2528.py +34 -0
  17. pyasn1_alt_modules/rfc2560.py +226 -0
  18. pyasn1_alt_modules/rfc2631.py +37 -0
  19. pyasn1_alt_modules/rfc2634.py +342 -0
  20. pyasn1_alt_modules/rfc2743.py +60 -0
  21. pyasn1_alt_modules/rfc2876.py +61 -0
  22. pyasn1_alt_modules/rfc2898.py +72 -0
  23. pyasn1_alt_modules/rfc2985.py +593 -0
  24. pyasn1_alt_modules/rfc2986.py +76 -0
  25. pyasn1_alt_modules/rfc3058.py +48 -0
  26. pyasn1_alt_modules/rfc3114.py +80 -0
  27. pyasn1_alt_modules/rfc3125.py +469 -0
  28. pyasn1_alt_modules/rfc3161.py +142 -0
  29. pyasn1_alt_modules/rfc3217.py +42 -0
  30. pyasn1_alt_modules/rfc3274.py +62 -0
  31. pyasn1_alt_modules/rfc3279.py +264 -0
  32. pyasn1_alt_modules/rfc3280.py +1544 -0
  33. pyasn1_alt_modules/rfc3281.py +332 -0
  34. pyasn1_alt_modules/rfc3370.py +142 -0
  35. pyasn1_alt_modules/rfc3412.py +54 -0
  36. pyasn1_alt_modules/rfc3414.py +29 -0
  37. pyasn1_alt_modules/rfc3447.py +46 -0
  38. pyasn1_alt_modules/rfc3537.py +44 -0
  39. pyasn1_alt_modules/rfc3546.py +23 -0
  40. pyasn1_alt_modules/rfc3560.py +74 -0
  41. pyasn1_alt_modules/rfc3565.py +59 -0
  42. pyasn1_alt_modules/rfc3657.py +69 -0
  43. pyasn1_alt_modules/rfc3709.py +230 -0
  44. pyasn1_alt_modules/rfc3739.py +207 -0
  45. pyasn1_alt_modules/rfc3770.py +77 -0
  46. pyasn1_alt_modules/rfc3779.py +139 -0
  47. pyasn1_alt_modules/rfc3820.py +66 -0
  48. pyasn1_alt_modules/rfc3852.py +707 -0
  49. pyasn1_alt_modules/rfc3874.py +29 -0
  50. pyasn1_alt_modules/rfc4010.py +58 -0
  51. pyasn1_alt_modules/rfc4043.py +45 -0
  52. pyasn1_alt_modules/rfc4055.py +285 -0
  53. pyasn1_alt_modules/rfc4056.py +56 -0
  54. pyasn1_alt_modules/rfc4059.py +101 -0
  55. pyasn1_alt_modules/rfc4073.py +62 -0
  56. pyasn1_alt_modules/rfc4108.py +355 -0
  57. pyasn1_alt_modules/rfc4210.py +807 -0
  58. pyasn1_alt_modules/rfc4211.py +420 -0
  59. pyasn1_alt_modules/rfc4231.py +38 -0
  60. pyasn1_alt_modules/rfc4262.py +37 -0
  61. pyasn1_alt_modules/rfc4334.py +78 -0
  62. pyasn1_alt_modules/rfc4357.py +485 -0
  63. pyasn1_alt_modules/rfc4366.py +23 -0
  64. pyasn1_alt_modules/rfc4387.py +23 -0
  65. pyasn1_alt_modules/rfc4476.py +99 -0
  66. pyasn1_alt_modules/rfc4490.py +119 -0
  67. pyasn1_alt_modules/rfc4491.py +44 -0
  68. pyasn1_alt_modules/rfc4683.py +76 -0
  69. pyasn1_alt_modules/rfc4985.py +52 -0
  70. pyasn1_alt_modules/rfc4998.py +125 -0
  71. pyasn1_alt_modules/rfc5035.py +206 -0
  72. pyasn1_alt_modules/rfc5055.py +763 -0
  73. pyasn1_alt_modules/rfc5083.py +55 -0
  74. pyasn1_alt_modules/rfc5084.py +94 -0
  75. pyasn1_alt_modules/rfc5126.py +578 -0
  76. pyasn1_alt_modules/rfc5208.py +73 -0
  77. pyasn1_alt_modules/rfc5275.py +404 -0
  78. pyasn1_alt_modules/rfc5276.py +82 -0
  79. pyasn1_alt_modules/rfc5280.py +1666 -0
  80. pyasn1_alt_modules/rfc5480.py +190 -0
  81. pyasn1_alt_modules/rfc5544.py +127 -0
  82. pyasn1_alt_modules/rfc5636.py +117 -0
  83. pyasn1_alt_modules/rfc5639.py +49 -0
  84. pyasn1_alt_modules/rfc5649.py +33 -0
  85. pyasn1_alt_modules/rfc5652.py +763 -0
  86. pyasn1_alt_modules/rfc5697.py +64 -0
  87. pyasn1_alt_modules/rfc5698.py +159 -0
  88. pyasn1_alt_modules/rfc5751.py +127 -0
  89. pyasn1_alt_modules/rfc5752.py +52 -0
  90. pyasn1_alt_modules/rfc5753.py +163 -0
  91. pyasn1_alt_modules/rfc5755.py +400 -0
  92. pyasn1_alt_modules/rfc5913.py +46 -0
  93. pyasn1_alt_modules/rfc5914.py +119 -0
  94. pyasn1_alt_modules/rfc5915.py +32 -0
  95. pyasn1_alt_modules/rfc5916.py +39 -0
  96. pyasn1_alt_modules/rfc5917.py +59 -0
  97. pyasn1_alt_modules/rfc5924.py +19 -0
  98. pyasn1_alt_modules/rfc5934.py +786 -0
  99. pyasn1_alt_modules/rfc5940.py +62 -0
  100. pyasn1_alt_modules/rfc5958.py +100 -0
  101. pyasn1_alt_modules/rfc5990.py +238 -0
  102. pyasn1_alt_modules/rfc6010.py +92 -0
  103. pyasn1_alt_modules/rfc6019.py +46 -0
  104. pyasn1_alt_modules/rfc6031.py +469 -0
  105. pyasn1_alt_modules/rfc6032.py +71 -0
  106. pyasn1_alt_modules/rfc6066.py +25 -0
  107. pyasn1_alt_modules/rfc6120.py +46 -0
  108. pyasn1_alt_modules/rfc6170.py +17 -0
  109. pyasn1_alt_modules/rfc6187.py +22 -0
  110. pyasn1_alt_modules/rfc6210.py +45 -0
  111. pyasn1_alt_modules/rfc6211.py +75 -0
  112. pyasn1_alt_modules/rfc6402.py +643 -0
  113. pyasn1_alt_modules/rfc6482.py +77 -0
  114. pyasn1_alt_modules/rfc6484.py +17 -0
  115. pyasn1_alt_modules/rfc6486.py +70 -0
  116. pyasn1_alt_modules/rfc6487.py +22 -0
  117. pyasn1_alt_modules/rfc6492.py +41 -0
  118. pyasn1_alt_modules/rfc6493.py +24 -0
  119. pyasn1_alt_modules/rfc6494.py +23 -0
  120. pyasn1_alt_modules/rfc6664.py +151 -0
  121. pyasn1_alt_modules/rfc6955.py +112 -0
  122. pyasn1_alt_modules/rfc6960.py +234 -0
  123. pyasn1_alt_modules/rfc6962.py +52 -0
  124. pyasn1_alt_modules/rfc7030.py +70 -0
  125. pyasn1_alt_modules/rfc7191.py +267 -0
  126. pyasn1_alt_modules/rfc7229.py +29 -0
  127. pyasn1_alt_modules/rfc7292.py +359 -0
  128. pyasn1_alt_modules/rfc7296.py +32 -0
  129. pyasn1_alt_modules/rfc7508.py +92 -0
  130. pyasn1_alt_modules/rfc7585.py +53 -0
  131. pyasn1_alt_modules/rfc7633.py +40 -0
  132. pyasn1_alt_modules/rfc7693.py +66 -0
  133. pyasn1_alt_modules/rfc7773.py +54 -0
  134. pyasn1_alt_modules/rfc7836.py +65 -0
  135. pyasn1_alt_modules/rfc7894.py +100 -0
  136. pyasn1_alt_modules/rfc7906.py +739 -0
  137. pyasn1_alt_modules/rfc7914.py +55 -0
  138. pyasn1_alt_modules/rfc8017.py +159 -0
  139. pyasn1_alt_modules/rfc8018.py +269 -0
  140. pyasn1_alt_modules/rfc8103.py +36 -0
  141. pyasn1_alt_modules/rfc8209.py +20 -0
  142. pyasn1_alt_modules/rfc8226.py +151 -0
  143. pyasn1_alt_modules/rfc8358.py +54 -0
  144. pyasn1_alt_modules/rfc8360.py +46 -0
  145. pyasn1_alt_modules/rfc8398.py +55 -0
  146. pyasn1_alt_modules/rfc8410.py +43 -0
  147. pyasn1_alt_modules/rfc8418.py +36 -0
  148. pyasn1_alt_modules/rfc8419.py +70 -0
  149. pyasn1_alt_modules/rfc8479.py +48 -0
  150. pyasn1_alt_modules/rfc8494.py +80 -0
  151. pyasn1_alt_modules/rfc8520.py +66 -0
  152. pyasn1_alt_modules/rfc8619.py +45 -0
  153. pyasn1_alt_modules/rfc8649.py +42 -0
  154. pyasn1_alt_modules/rfc8692.py +79 -0
  155. pyasn1_alt_modules/rfc8696.py +108 -0
  156. pyasn1_alt_modules/rfc8702.py +109 -0
  157. pyasn1_alt_modules/rfc8708.py +43 -0
  158. pyasn1_alt_modules/rfc8737.py +36 -0
  159. pyasn1_alt_modules/rfc8769.py +21 -0
  160. pyasn1_alt_modules/rfc8894.py +52 -0
  161. pyasn1_alt_modules/rfc8951.py +42 -0
  162. pyasn1_alt_modules/rfc8954.py +238 -0
  163. pyasn1_alt_modules/rfc8994.py +52 -0
  164. pyasn1_alt_modules/rfc8995.py +39 -0
  165. pyasn1_alt_modules/rfc9044.py +80 -0
  166. pyasn1_alt_modules/rfc9092.py +35 -0
  167. pyasn1_alt_modules/rfc9118.py +82 -0
  168. pyasn1_alt_modules/rfc9174.py +55 -0
  169. pyasn1_alt_modules/rfc9189.py +74 -0
  170. pyasn1_alt_modules/rfc9215.py +228 -0
  171. pyasn1_alt_modules/rfc9286.py +78 -0
  172. pyasn1_alt_modules/rfc9289.py +22 -0
  173. pyasn1_alt_modules/rfc9310.py +46 -0
  174. pyasn1_alt_modules/rfc9323.py +129 -0
  175. pyasn1_alt_modules/rfc9336.py +20 -0
  176. pyasn1_alt_modules/rfc9337.py +74 -0
  177. pyasn1_alt_modules/rfc9345.py +36 -0
  178. pyasn1_alt_modules/rfc9385.py +22 -0
  179. pyasn1_alt_modules/rfc9399.py +59 -0
  180. pyasn1_alt_modules/rfc9480.py +731 -0
  181. pyasn1_alt_modules/rfc9481.py +224 -0
  182. pyasn1_alt_modules/rfc9509.py +24 -0
  183. pyasn1_alt_modules/rfc9548.py +23 -0
  184. pyasn1_alt_modules/rfc9579.py +89 -0
  185. pyasn1_alt_modules/rfc9582.py +107 -0
  186. pyasn1_alt_modules/rfc9598.py +52 -0
  187. pyasn1_alt_modules/rfc9608.py +35 -0
  188. pyasn1_alt_modules/rfc9629.py +100 -0
  189. pyasn1_alt_modules/rfc9654.py +241 -0
  190. pyasn1_alt_modules-0.4.5.dist-info/LICENSE.txt +25 -0
  191. pyasn1_alt_modules-0.4.5.dist-info/METADATA +34 -0
  192. pyasn1_alt_modules-0.4.5.dist-info/RECORD +195 -0
  193. pyasn1_alt_modules-0.4.5.dist-info/WHEEL +5 -0
  194. pyasn1_alt_modules-0.4.5.dist-info/top_level.txt +1 -0
  195. pyasn1_alt_modules-0.4.5.dist-info/zip-safe +1 -0
@@ -0,0 +1,74 @@
1
+ #
2
+ # This file is part of pyasn1-alt-modules software.
3
+ #
4
+ # Created by Russ Housley.
5
+ #
6
+ # Copyright (c) 2019-2024, Vigil Security, LLC
7
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
8
+ #
9
+ # RSAES-OAEP Key Transport Algorithm in CMS
10
+ #
11
+ # Notice that all of the things needed in RFC 3560 are also defined
12
+ # in RFC 4055. So, they are all pulled from the RFC 4055 module into
13
+ # this one so that people looking a RFC 3560 can easily find them.
14
+ #
15
+ # ASN.1 source from:
16
+ # https://www.rfc-editor.org/rfc/rfc3560.txt
17
+ #
18
+
19
+ from pyasn1_alt_modules import rfc4055
20
+
21
+ id_sha1 = rfc4055.id_sha1
22
+
23
+ id_sha256 = rfc4055.id_sha256
24
+
25
+ id_sha384 = rfc4055.id_sha384
26
+
27
+ id_sha512 = rfc4055.id_sha512
28
+
29
+ id_mgf1 = rfc4055.id_mgf1
30
+
31
+ rsaEncryption = rfc4055.rsaEncryption
32
+
33
+ id_RSAES_OAEP = rfc4055.id_RSAES_OAEP
34
+
35
+ id_pSpecified = rfc4055.id_pSpecified
36
+
37
+ sha1Identifier = rfc4055.sha1Identifier
38
+
39
+ sha256Identifier = rfc4055.sha256Identifier
40
+
41
+ sha384Identifier = rfc4055.sha384Identifier
42
+
43
+ sha512Identifier = rfc4055.sha512Identifier
44
+
45
+ mgf1SHA1Identifier = rfc4055.mgf1SHA1Identifier
46
+
47
+ mgf1SHA256Identifier = rfc4055.mgf1SHA256Identifier
48
+
49
+ mgf1SHA384Identifier = rfc4055.mgf1SHA384Identifier
50
+
51
+ mgf1SHA512Identifier = rfc4055.mgf1SHA512Identifier
52
+
53
+ pSpecifiedEmptyIdentifier = rfc4055.pSpecifiedEmptyIdentifier
54
+
55
+
56
+ class RSAES_OAEP_params(rfc4055.RSAES_OAEP_params):
57
+ pass
58
+
59
+
60
+ rSAES_OAEP_Default_Params = RSAES_OAEP_params()
61
+
62
+ rSAES_OAEP_Default_Identifier = rfc4055.rSAES_OAEP_Default_Identifier
63
+
64
+ rSAES_OAEP_SHA256_Params = rfc4055.rSAES_OAEP_SHA256_Params
65
+
66
+ rSAES_OAEP_SHA256_Identifier = rfc4055.rSAES_OAEP_SHA256_Identifier
67
+
68
+ rSAES_OAEP_SHA384_Params = rfc4055.rSAES_OAEP_SHA384_Params
69
+
70
+ rSAES_OAEP_SHA384_Identifier = rfc4055.rSAES_OAEP_SHA384_Identifier
71
+
72
+ rSAES_OAEP_SHA512_Params = rfc4055.rSAES_OAEP_SHA512_Params
73
+
74
+ rSAES_OAEP_SHA512_Identifier = rfc4055.rSAES_OAEP_SHA512_Identifier
@@ -0,0 +1,59 @@
1
+ # This file is part of pyasn1-alt-modules software.
2
+ #
3
+ # Created by Russ Housley.
4
+ # Modified by Russ Housley to add maps for use with opentypes.
5
+ # Modified by Russ Housley to include the opentypemap manager.
6
+ #
7
+ # Copyright (c) 2019-2024, Vigil Security, LLC
8
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
9
+ #
10
+ # Use of the Advanced Encryption Standard (AES) Encryption
11
+ # Algorithm in the Cryptographic Message Syntax (CMS)
12
+ #
13
+ # ASN.1 source from:
14
+ # https://www.rfc-editor.org/rfc/rfc3565.txt
15
+
16
+
17
+ from pyasn1.type import constraint
18
+ from pyasn1.type import univ
19
+
20
+ from pyasn1_alt_modules import rfc5280
21
+ from pyasn1_alt_modules import opentypemap
22
+
23
+ algorithmIdentifierMap = opentypemap.get('algorithmIdentifierMap')
24
+
25
+
26
+ class AlgorithmIdentifier(rfc5280.AlgorithmIdentifier):
27
+ pass
28
+
29
+
30
+ class AES_IV(univ.OctetString):
31
+ subtypeSpec = constraint.ValueSizeConstraint(16, 16)
32
+
33
+
34
+ id_aes128_CBC = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.2')
35
+
36
+ id_aes192_CBC = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.22')
37
+
38
+ id_aes256_CBC = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.42')
39
+
40
+
41
+ id_aes128_wrap = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.5')
42
+
43
+ id_aes192_wrap = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.25')
44
+
45
+ id_aes256_wrap = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.45')
46
+
47
+
48
+ # Update the Algorithm Identifier map
49
+
50
+ _algorithmIdentifierMapUpdate = {
51
+ id_aes128_CBC: AES_IV(),
52
+ id_aes192_CBC: AES_IV(),
53
+ id_aes256_CBC: AES_IV(),
54
+ id_aes128_wrap: univ.Null(),
55
+ id_aes192_wrap: univ.Null(),
56
+ id_aes256_wrap: univ.Null(),
57
+ }
58
+
59
+ algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
@@ -0,0 +1,69 @@
1
+ #
2
+ # This file is part of pyasn1-alt-modules software.
3
+ #
4
+ # Created by Russ Housley.
5
+ # Modified by Russ Housley to include the opentypemap manager.
6
+ #
7
+ # Copyright (c) 2019-2024, Vigil Security, LLC
8
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
9
+ #
10
+ # Camellia Algorithm in CMS
11
+ #
12
+ # ASN.1 source from:
13
+ # https://www.rfc-editor.org/rfc/rfc3657.txt
14
+ #
15
+
16
+ from pyasn1.type import constraint
17
+ from pyasn1.type import univ
18
+
19
+ from pyasn1_alt_modules import opentypemap
20
+
21
+ algorithmIdentifierMap = opentypemap.get('algorithmIdentifierMap')
22
+
23
+ smimeCapabilityMap = opentypemap.get('smimeCapabilityMap')
24
+
25
+
26
+ id_camellia128_cbc = univ.ObjectIdentifier('1.2.392.200011.61.1.1.1.2')
27
+
28
+ id_camellia192_cbc = univ.ObjectIdentifier('1.2.392.200011.61.1.1.1.3')
29
+
30
+ id_camellia256_cbc = univ.ObjectIdentifier('1.2.392.200011.61.1.1.1.4')
31
+
32
+ id_camellia128_wrap = univ.ObjectIdentifier('1.2.392.200011.61.1.1.3.2')
33
+
34
+ id_camellia192_wrap = univ.ObjectIdentifier('1.2.392.200011.61.1.1.3.3')
35
+
36
+ id_camellia256_wrap = univ.ObjectIdentifier('1.2.392.200011.61.1.1.3.4')
37
+
38
+
39
+ class Camellia_IV(univ.OctetString):
40
+ subtypeSpec = constraint.ValueSizeConstraint(16, 16)
41
+
42
+
43
+ class CamelliaSMimeCapability(univ.Null):
44
+ pass
45
+
46
+
47
+ # Update the Algorithm Identifiers Map
48
+
49
+ _algorithmIdentifierMapUpdate = {
50
+ id_camellia128_cbc: Camellia_IV(),
51
+ id_camellia192_cbc: Camellia_IV(),
52
+ id_camellia256_cbc: Camellia_IV(),
53
+ }
54
+
55
+ algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)
56
+
57
+
58
+ # Update the S/MIME Capability Map
59
+
60
+ _smimeCapabilityMapUpdate = {
61
+ id_camellia128_cbc: CamelliaSMimeCapability(),
62
+ id_camellia192_cbc: CamelliaSMimeCapability(),
63
+ id_camellia256_cbc: CamelliaSMimeCapability(),
64
+ id_camellia128_wrap: CamelliaSMimeCapability(),
65
+ id_camellia192_wrap: CamelliaSMimeCapability(),
66
+ id_camellia256_wrap: CamelliaSMimeCapability(),
67
+ }
68
+
69
+ smimeCapabilityMap.update(_smimeCapabilityMapUpdate)
@@ -0,0 +1,230 @@
1
+ #
2
+ # This file is part of pyasn1-alt-modules software.
3
+ #
4
+ # Created by Russ Housley with assistance from asn1ate v.0.6.0.
5
+ # Modified by Russ Housley to add maps for use with opentypes.
6
+ # Modified by Russ Housley to include the opentypemap manager.
7
+ # Modified by Russ Housley to add WITH COMPONENTS constraints for
8
+ # requirements from the text, but stated in the ASN.1 module.
9
+ #
10
+ # Copyright (c) 2019-2024, Vigil Security, LLC
11
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
12
+ #
13
+ # Logotypes in X.509 Certificates
14
+ #
15
+ # ASN.1 source from:
16
+ # https://www.rfc-editor.org/rfc/rfc3709.txt
17
+ #
18
+
19
+ from pyasn1.type import char
20
+ from pyasn1.type import constraint
21
+ from pyasn1.type import namedtype
22
+ from pyasn1.type import namedval
23
+ from pyasn1.type import tag
24
+ from pyasn1.type import univ
25
+
26
+ from pyasn1_alt_modules import rfc5280
27
+ from pyasn1_alt_modules import rfc6170
28
+ from pyasn1_alt_modules import opentypemap
29
+
30
+ certificateExtensionsMap = opentypemap.get('certificateExtensionsMap')
31
+
32
+ MAX = float('inf')
33
+
34
+
35
+ class HashAlgAndValue(univ.Sequence):
36
+ pass
37
+
38
+ HashAlgAndValue.componentType = namedtype.NamedTypes(
39
+ namedtype.NamedType('hashAlg', rfc5280.AlgorithmIdentifier()),
40
+ namedtype.NamedType('hashValue', univ.OctetString())
41
+ )
42
+
43
+
44
+ class LogotypeDetails(univ.Sequence):
45
+ pass
46
+
47
+ LogotypeDetails.componentType = namedtype.NamedTypes(
48
+ namedtype.NamedType('mediaType', char.IA5String()),
49
+ namedtype.NamedType('logotypeHash', univ.SequenceOf(
50
+ componentType=HashAlgAndValue()).subtype(
51
+ sizeSpec=constraint.ValueSizeConstraint(1, MAX))),
52
+ namedtype.NamedType('logotypeURI', univ.SequenceOf(
53
+ componentType=char.IA5String()).subtype(
54
+ sizeSpec=constraint.ValueSizeConstraint(1, MAX)))
55
+ )
56
+
57
+
58
+ class LogotypeAudioInfo(univ.Sequence):
59
+ pass
60
+
61
+ LogotypeAudioInfo.componentType = namedtype.NamedTypes(
62
+ namedtype.NamedType('fileSize', univ.Integer()),
63
+ namedtype.NamedType('playTime', univ.Integer()),
64
+ namedtype.NamedType('channels', univ.Integer()),
65
+ namedtype.OptionalNamedType('sampleRate', univ.Integer().subtype(
66
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))),
67
+ namedtype.OptionalNamedType('language', char.IA5String().subtype(
68
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4)))
69
+ )
70
+
71
+
72
+ class LogotypeAudio(univ.Sequence):
73
+ pass
74
+
75
+ LogotypeAudio.componentType = namedtype.NamedTypes(
76
+ namedtype.NamedType('audioDetails', LogotypeDetails()),
77
+ namedtype.OptionalNamedType('audioInfo', LogotypeAudioInfo())
78
+ )
79
+
80
+
81
+ class LogotypeImageType(univ.Integer):
82
+ pass
83
+
84
+ LogotypeImageType.namedValues = namedval.NamedValues(
85
+ ('grayScale', 0),
86
+ ('color', 1)
87
+ )
88
+
89
+
90
+ class LogotypeImageResolution(univ.Choice):
91
+ pass
92
+
93
+ LogotypeImageResolution.componentType = namedtype.NamedTypes(
94
+ namedtype.NamedType('numBits',
95
+ univ.Integer().subtype(implicitTag=tag.Tag(
96
+ tag.tagClassContext, tag.tagFormatSimple, 1))),
97
+ namedtype.NamedType('tableSize',
98
+ univ.Integer().subtype(implicitTag=tag.Tag(
99
+ tag.tagClassContext, tag.tagFormatSimple, 2)))
100
+ )
101
+
102
+
103
+ class LogotypeImageInfo(univ.Sequence):
104
+ pass
105
+
106
+ LogotypeImageInfo.componentType = namedtype.NamedTypes(
107
+ namedtype.DefaultedNamedType('type', LogotypeImageType().subtype(
108
+ implicitTag=tag.Tag(tag.tagClassContext,
109
+ tag.tagFormatSimple, 0)).subtype(value='color')),
110
+ namedtype.NamedType('fileSize', univ.Integer()),
111
+ namedtype.NamedType('xSize', univ.Integer()),
112
+ namedtype.NamedType('ySize', univ.Integer()),
113
+ namedtype.OptionalNamedType('resolution', LogotypeImageResolution()),
114
+ namedtype.OptionalNamedType('language', char.IA5String().subtype(
115
+ implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 4)))
116
+ )
117
+
118
+
119
+ class LogotypeImage(univ.Sequence):
120
+ pass
121
+
122
+ LogotypeImage.componentType = namedtype.NamedTypes(
123
+ namedtype.NamedType('imageDetails', LogotypeDetails()),
124
+ namedtype.OptionalNamedType('imageInfo', LogotypeImageInfo())
125
+ )
126
+
127
+
128
+ class LogotypeData(univ.Sequence):
129
+ pass
130
+
131
+ LogotypeData.componentType = namedtype.NamedTypes(
132
+ namedtype.OptionalNamedType('image', univ.SequenceOf(
133
+ componentType=LogotypeImage())),
134
+ namedtype.OptionalNamedType('audio', univ.SequenceOf(
135
+ componentType=LogotypeAudio()).subtype(
136
+ implicitTag=tag.Tag(tag.tagClassContext,
137
+ tag.tagFormatSimple, 1)))
138
+ )
139
+
140
+ LogotypeData.subtypeSpec = constraint.ConstraintsUnion(
141
+ constraint.WithComponentsConstraint(
142
+ ('image', constraint.ComponentPresentConstraint())),
143
+ constraint.WithComponentsConstraint(
144
+ ('audio', constraint.ComponentPresentConstraint()))
145
+ )
146
+
147
+
148
+ class LogotypeReference(univ.Sequence):
149
+ pass
150
+
151
+ LogotypeReference.componentType = namedtype.NamedTypes(
152
+ namedtype.NamedType('refStructHash', univ.SequenceOf(
153
+ componentType=HashAlgAndValue()).subtype(
154
+ sizeSpec=constraint.ValueSizeConstraint(1, MAX))),
155
+ namedtype.NamedType('refStructURI', univ.SequenceOf(
156
+ componentType=char.IA5String()).subtype(
157
+ sizeSpec=constraint.ValueSizeConstraint(1, MAX)))
158
+ )
159
+
160
+
161
+ class LogotypeInfo(univ.Choice):
162
+ pass
163
+
164
+ LogotypeInfo.componentType = namedtype.NamedTypes(
165
+ namedtype.NamedType('direct',
166
+ LogotypeData().subtype(implicitTag=tag.Tag(tag.tagClassContext,
167
+ tag.tagFormatConstructed, 0))),
168
+ namedtype.NamedType('indirect', LogotypeReference().subtype(
169
+ implicitTag=tag.Tag(tag.tagClassContext,
170
+ tag.tagFormatConstructed, 1)))
171
+ )
172
+
173
+ # Other logotype type and associated object identifiers
174
+
175
+ id_logo_background = univ.ObjectIdentifier('1.3.6.1.5.5.7.20.2')
176
+
177
+ id_logo_loyalty = univ.ObjectIdentifier('1.3.6.1.5.5.7.20.1')
178
+
179
+ id_logo_certImage = rfc6170.id_logo_certImage
180
+
181
+
182
+ class OtherLogotypeInfo(univ.Sequence):
183
+ pass
184
+
185
+ OtherLogotypeInfo.componentType = namedtype.NamedTypes(
186
+ namedtype.NamedType('logotypeType', univ.ObjectIdentifier()),
187
+ namedtype.NamedType('info', LogotypeInfo())
188
+ )
189
+
190
+
191
+ # Logotype Certificate Extension
192
+
193
+ id_pe_logotype = univ.ObjectIdentifier('1.3.6.1.5.5.7.1.12')
194
+
195
+
196
+ class LogotypeExtn(univ.Sequence):
197
+ pass
198
+
199
+ LogotypeExtn.componentType = namedtype.NamedTypes(
200
+ namedtype.OptionalNamedType('communityLogos', univ.SequenceOf(
201
+ componentType=LogotypeInfo()).subtype(
202
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
203
+ namedtype.OptionalNamedType('issuerLogo', LogotypeInfo().subtype(
204
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))),
205
+ namedtype.OptionalNamedType('subjectLogo', LogotypeInfo().subtype(
206
+ explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2))),
207
+ namedtype.OptionalNamedType('otherLogos', univ.SequenceOf(
208
+ componentType=OtherLogotypeInfo()).subtype(explicitTag=tag.Tag(
209
+ tag.tagClassContext, tag.tagFormatSimple, 3)))
210
+ )
211
+
212
+ LogotypeExtn.subtypeSpec = constraint.ConstraintsUnion(
213
+ constraint.WithComponentsConstraint(
214
+ ('communityLogos', constraint.ComponentPresentConstraint())),
215
+ constraint.WithComponentsConstraint(
216
+ ('issuerLogo', constraint.ComponentPresentConstraint())),
217
+ constraint.WithComponentsConstraint(
218
+ ('subjectLogo', constraint.ComponentPresentConstraint())),
219
+ constraint.WithComponentsConstraint(
220
+ ('otherLogos', constraint.ComponentPresentConstraint()))
221
+ )
222
+
223
+
224
+ # Update the Certificate Extensions Map
225
+
226
+ _certificateExtensionsMapUpdate = {
227
+ id_pe_logotype: LogotypeExtn(),
228
+ }
229
+
230
+ certificateExtensionsMap.update(_certificateExtensionsMapUpdate)
@@ -0,0 +1,207 @@
1
+ #
2
+ # This file is part of pyasn1-alt-modules software.
3
+ #
4
+ # Created by Russ Housley with assistance from asn1ate v.0.6.0.
5
+ # Modified by Russ Housley to add WithComponentsConstraints to
6
+ # enforce the requirements that are indicated in comments.
7
+ # Modified by Russ Housley to include the opentypemap manager.
8
+ # Modified by CBonnell to align the SemanticsInformation
9
+ # definition with https://www.rfc-editor.org/errata/eid7802.
10
+ #
11
+ # Copyright (c) 2019-2024, Vigil Security, LLC
12
+ # License: http://vigilsec.com/pyasn1-alt-modules-license.txt
13
+ #
14
+ # Qualified Certificates
15
+ #
16
+ # ASN.1 source from:
17
+ # https://www.rfc-editor.org/rfc/rfc3739.txt
18
+ # https://www.rfc-editor.org/errata/eid7802
19
+ #
20
+
21
+ from pyasn1.type import char
22
+ from pyasn1.type import constraint
23
+ from pyasn1.type import namedtype
24
+ from pyasn1.type import namedval
25
+ from pyasn1.type import opentype
26
+ from pyasn1.type import univ
27
+ from pyasn1.type import useful
28
+
29
+ from pyasn1_alt_modules import rfc5280
30
+ from pyasn1_alt_modules import opentypemap
31
+
32
+ certificateAttributesMap = opentypemap.get('certificateAttributesMap')
33
+
34
+ certificateExtensionsMap = opentypemap.get('certificateExtensionsMap')
35
+
36
+ qcStatementsMap = opentypemap.get('qcStatementsMap')
37
+
38
+ MAX = float('inf')
39
+
40
+
41
+ # Imports from RFC 5280
42
+
43
+ AlgorithmIdentifier = rfc5280.AlgorithmIdentifier
44
+
45
+ AttributeType = rfc5280.AttributeType
46
+
47
+ DirectoryString = rfc5280.DirectoryString
48
+
49
+ GeneralName = rfc5280.GeneralName
50
+
51
+ id_pkix = rfc5280.id_pkix
52
+
53
+ id_pe = rfc5280.id_pe
54
+
55
+
56
+ # Arc for QC personal data attributes
57
+
58
+ id_pda = id_pkix + (9, )
59
+
60
+
61
+ # Arc for QC statements
62
+
63
+ id_qcs = id_pkix + (11, )
64
+
65
+
66
+ # Personal data attributes
67
+
68
+ id_pda_dateOfBirth = id_pda + (1, )
69
+
70
+ class DateOfBirth(useful.GeneralizedTime):
71
+ pass
72
+
73
+
74
+ id_pda_placeOfBirth = id_pda + (2, )
75
+
76
+ class PlaceOfBirth(DirectoryString):
77
+ pass
78
+
79
+
80
+ id_pda_gender = id_pda + (3, )
81
+
82
+ class Gender(char.PrintableString):
83
+ subtypeSpec = constraint.ConstraintsIntersection(
84
+ constraint.ValueSizeConstraint(1, 1),
85
+ constraint.SingleValueConstraint('M', 'F', 'm', 'f')
86
+ )
87
+
88
+
89
+ id_pda_countryOfCitizenship = id_pda + (4, )
90
+
91
+ class CountryOfCitizenship(char.PrintableString):
92
+ subtypeSpec = constraint.ValueSizeConstraint(2, 2)
93
+ # ISO 3166 Country Code
94
+
95
+
96
+ id_pda_countryOfResidence = id_pda + (5, )
97
+
98
+ class CountryOfResidence(char.PrintableString):
99
+ subtypeSpec = constraint.ValueSizeConstraint(2, 2)
100
+ # ISO 3166 Country Code
101
+
102
+
103
+ # Biometric info certificate extension
104
+
105
+ id_pe_biometricInfo = id_pe + (2, )
106
+
107
+
108
+ class PredefinedBiometricType(univ.Integer):
109
+ namedValues = namedval.NamedValues(
110
+ ('picture', 0),
111
+ ('handwritten-signature', 1)
112
+ )
113
+ subtypeSpec = constraint.SingleValueConstraint(0, 1)
114
+
115
+
116
+ class TypeOfBiometricData(univ.Choice):
117
+ componentType = namedtype.NamedTypes(
118
+ namedtype.NamedType('predefinedBiometricType', PredefinedBiometricType()),
119
+ namedtype.NamedType('biometricDataOid', univ.ObjectIdentifier())
120
+ )
121
+
122
+
123
+ class BiometricData(univ.Sequence):
124
+ componentType = namedtype.NamedTypes(
125
+ namedtype.NamedType('typeOfBiometricData', TypeOfBiometricData()),
126
+ namedtype.NamedType('hashAlgorithm', AlgorithmIdentifier()),
127
+ namedtype.NamedType('biometricDataHash', univ.OctetString()),
128
+ namedtype.OptionalNamedType('sourceDataUri', char.IA5String())
129
+ )
130
+
131
+
132
+ class BiometricSyntax(univ.SequenceOf):
133
+ componentType = BiometricData()
134
+
135
+
136
+ # QC Statements certificate extension
137
+ # NOTE: This extension does not allow to mix critical and
138
+ # non-critical Qualified Certificate Statements. Either all
139
+ # statements must be critical or all statements must be
140
+ # non-critical.
141
+
142
+ id_pe_qcStatements = id_pe + (3, )
143
+
144
+
145
+ class NameRegistrationAuthorities(univ.SequenceOf):
146
+ componentType = GeneralName()
147
+ subtypeSpec=constraint.ValueSizeConstraint(1, MAX)
148
+
149
+
150
+ class QCStatement(univ.Sequence):
151
+ componentType = namedtype.NamedTypes(
152
+ namedtype.NamedType('statementId', univ.ObjectIdentifier()),
153
+ namedtype.OptionalNamedType('statementInfo', univ.Any(),
154
+ openType=opentype.OpenType('statementId', qcStatementsMap))
155
+ )
156
+
157
+
158
+ class QCStatements(univ.SequenceOf):
159
+ componentType = QCStatement()
160
+
161
+
162
+ class SemanticsInformation(univ.Sequence):
163
+ componentType = namedtype.NamedTypes(
164
+ namedtype.OptionalNamedType('semanticsIdentifier',
165
+ univ.ObjectIdentifier()),
166
+ namedtype.OptionalNamedType('nameRegistrationAuthorities',
167
+ NameRegistrationAuthorities())
168
+ )
169
+ subtypeSpec = constraint.ConstraintsUnion(
170
+ constraint.WithComponentsConstraint(
171
+ ('semanticsIdentifier', constraint.ComponentPresentConstraint())),
172
+ constraint.WithComponentsConstraint(
173
+ ('nameRegistrationAuthorities', constraint.ComponentPresentConstraint()))
174
+ )
175
+
176
+
177
+ id_qcs = id_pkix + (11, )
178
+
179
+
180
+ id_qcs_pkixQCSyntax_v1 = id_qcs + (1, )
181
+
182
+
183
+ id_qcs_pkixQCSyntax_v2 = id_qcs + (2, )
184
+
185
+
186
+ # Update the Certificate Extensions Map
187
+
188
+ _certificateExtensionsMapUpdate = {
189
+ id_pe_biometricInfo: BiometricSyntax(),
190
+ id_pe_qcStatements: QCStatements(),
191
+ }
192
+
193
+ certificateExtensionsMap.update(_certificateExtensionsMapUpdate)
194
+
195
+
196
+ # Update the Certificate Attribute Map
197
+
198
+ _certificateAttributesMapUpdate = {
199
+ id_pda_dateOfBirth: DateOfBirth(),
200
+ id_pda_placeOfBirth: PlaceOfBirth(),
201
+ id_pda_gender: Gender(),
202
+ id_pda_countryOfCitizenship: CountryOfCitizenship(),
203
+ id_pda_countryOfResidence: CountryOfResidence(),
204
+ }
205
+
206
+ certificateAttributesMap.update(_certificateAttributesMapUpdate)
207
+