DLMS-SPODES 0.87.13__py3-none-any.whl → 0.87.16__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.
Files changed (100) hide show
  1. DLMS_SPODES/Values/EN/__init__.py +1 -1
  2. DLMS_SPODES/Values/EN/actors.py +8 -8
  3. DLMS_SPODES/Values/EN/relation_to_obis_names.py +387 -387
  4. DLMS_SPODES/Values/RU/__init__.py +1 -1
  5. DLMS_SPODES/Values/RU/actors.py +8 -8
  6. DLMS_SPODES/Values/RU/relation_to_obis_names.py +396 -396
  7. DLMS_SPODES/__init__.py +6 -6
  8. DLMS_SPODES/configEN.ini +126 -126
  9. DLMS_SPODES/config_parser.py +53 -53
  10. DLMS_SPODES/cosem_interface_classes/__class_init__.py +3 -3
  11. DLMS_SPODES/cosem_interface_classes/__init__.py +1 -1
  12. DLMS_SPODES/cosem_interface_classes/a_parameter.py +20 -20
  13. DLMS_SPODES/cosem_interface_classes/activity_calendar.py +254 -254
  14. DLMS_SPODES/cosem_interface_classes/arbitrator.py +105 -105
  15. DLMS_SPODES/cosem_interface_classes/association_ln/abstract.py +34 -34
  16. DLMS_SPODES/cosem_interface_classes/association_ln/authentication_mechanism_name.py +25 -25
  17. DLMS_SPODES/cosem_interface_classes/association_ln/mechanism_id.py +25 -25
  18. DLMS_SPODES/cosem_interface_classes/association_ln/method.py +5 -5
  19. DLMS_SPODES/cosem_interface_classes/association_ln/ver0.py +485 -485
  20. DLMS_SPODES/cosem_interface_classes/association_ln/ver1.py +133 -133
  21. DLMS_SPODES/cosem_interface_classes/association_ln/ver2.py +36 -36
  22. DLMS_SPODES/cosem_interface_classes/association_ln/ver3.py +4 -4
  23. DLMS_SPODES/cosem_interface_classes/association_sn/ver0.py +12 -12
  24. DLMS_SPODES/cosem_interface_classes/attr_indexes.py +12 -12
  25. DLMS_SPODES/cosem_interface_classes/clock.py +131 -131
  26. DLMS_SPODES/cosem_interface_classes/collection.py +2122 -2122
  27. DLMS_SPODES/cosem_interface_classes/cosem_interface_class.py +583 -583
  28. DLMS_SPODES/cosem_interface_classes/data.py +21 -21
  29. DLMS_SPODES/cosem_interface_classes/demand_register/ver0.py +59 -59
  30. DLMS_SPODES/cosem_interface_classes/disconnect_control.py +74 -74
  31. DLMS_SPODES/cosem_interface_classes/extended_register.py +27 -27
  32. DLMS_SPODES/cosem_interface_classes/gprs_modem_setup.py +43 -43
  33. DLMS_SPODES/cosem_interface_classes/gsm_diagnostic/ver0.py +103 -103
  34. DLMS_SPODES/cosem_interface_classes/gsm_diagnostic/ver1.py +40 -40
  35. DLMS_SPODES/cosem_interface_classes/gsm_diagnostic/ver2.py +9 -9
  36. DLMS_SPODES/cosem_interface_classes/iec_hdlc_setup/ver0.py +11 -11
  37. DLMS_SPODES/cosem_interface_classes/iec_hdlc_setup/ver1.py +53 -53
  38. DLMS_SPODES/cosem_interface_classes/iec_local_port_setup.py +11 -11
  39. DLMS_SPODES/cosem_interface_classes/image_transfer/image_transfer_status.py +15 -15
  40. DLMS_SPODES/cosem_interface_classes/image_transfer/ver0.py +126 -126
  41. DLMS_SPODES/cosem_interface_classes/implementations/__init__.py +3 -3
  42. DLMS_SPODES/cosem_interface_classes/implementations/arbitrator.py +19 -19
  43. DLMS_SPODES/cosem_interface_classes/implementations/data.py +487 -487
  44. DLMS_SPODES/cosem_interface_classes/implementations/profile_generic.py +83 -83
  45. DLMS_SPODES/cosem_interface_classes/ipv4_setup.py +72 -72
  46. DLMS_SPODES/cosem_interface_classes/limiter.py +111 -111
  47. DLMS_SPODES/cosem_interface_classes/ln_pattern.py +333 -333
  48. DLMS_SPODES/cosem_interface_classes/modem_configuration/ver0.py +65 -65
  49. DLMS_SPODES/cosem_interface_classes/modem_configuration/ver1.py +39 -39
  50. DLMS_SPODES/cosem_interface_classes/ntp_setup/ver0.py +67 -67
  51. DLMS_SPODES/cosem_interface_classes/obis.py +23 -23
  52. DLMS_SPODES/cosem_interface_classes/overview.py +197 -197
  53. DLMS_SPODES/cosem_interface_classes/parameter.py +547 -547
  54. DLMS_SPODES/cosem_interface_classes/parameters.py +172 -172
  55. DLMS_SPODES/cosem_interface_classes/profile_generic/ver0.py +122 -122
  56. DLMS_SPODES/cosem_interface_classes/profile_generic/ver1.py +277 -277
  57. DLMS_SPODES/cosem_interface_classes/push_setup/ver0.py +12 -12
  58. DLMS_SPODES/cosem_interface_classes/push_setup/ver1.py +10 -10
  59. DLMS_SPODES/cosem_interface_classes/push_setup/ver2.py +166 -166
  60. DLMS_SPODES/cosem_interface_classes/register.py +45 -45
  61. DLMS_SPODES/cosem_interface_classes/register_activation/ver0.py +80 -80
  62. DLMS_SPODES/cosem_interface_classes/register_monitor.py +46 -46
  63. DLMS_SPODES/cosem_interface_classes/reports.py +70 -70
  64. DLMS_SPODES/cosem_interface_classes/schedule.py +176 -176
  65. DLMS_SPODES/cosem_interface_classes/script_table.py +87 -87
  66. DLMS_SPODES/cosem_interface_classes/security_setup/ver0.py +68 -68
  67. DLMS_SPODES/cosem_interface_classes/security_setup/ver1.py +158 -158
  68. DLMS_SPODES/cosem_interface_classes/single_action_schedule.py +50 -50
  69. DLMS_SPODES/cosem_interface_classes/special_days_table.py +84 -84
  70. DLMS_SPODES/cosem_interface_classes/tcp_udp_setup.py +42 -42
  71. DLMS_SPODES/cosem_pdu.py +93 -93
  72. DLMS_SPODES/enums.py +625 -625
  73. DLMS_SPODES/exceptions.py +106 -106
  74. DLMS_SPODES/firmwares.py +99 -99
  75. DLMS_SPODES/hdlc/frame.py +875 -875
  76. DLMS_SPODES/hdlc/sub_layer.py +54 -54
  77. DLMS_SPODES/literals.py +17 -17
  78. DLMS_SPODES/obis/__init__.py +1 -1
  79. DLMS_SPODES/obis/media_id.py +931 -931
  80. DLMS_SPODES/pardata.py +22 -22
  81. DLMS_SPODES/pdu_enums.py +98 -98
  82. DLMS_SPODES/relation_to_OBIS.py +465 -463
  83. DLMS_SPODES/settings.py +551 -551
  84. DLMS_SPODES/types/choices.py +142 -142
  85. DLMS_SPODES/types/common_data_types.py +2401 -2401
  86. DLMS_SPODES/types/cosem_service_types.py +109 -109
  87. DLMS_SPODES/types/implementations/arrays.py +25 -25
  88. DLMS_SPODES/types/implementations/bitstrings.py +97 -97
  89. DLMS_SPODES/types/implementations/double_long_usingneds.py +35 -35
  90. DLMS_SPODES/types/implementations/enums.py +57 -57
  91. DLMS_SPODES/types/implementations/integers.py +11 -11
  92. DLMS_SPODES/types/implementations/long_unsigneds.py +127 -127
  93. DLMS_SPODES/types/implementations/octet_string.py +11 -11
  94. DLMS_SPODES/types/implementations/structs.py +64 -64
  95. DLMS_SPODES/types/useful_types.py +677 -677
  96. {dlms_spodes-0.87.13.dist-info → dlms_spodes-0.87.16.dist-info}/METADATA +30 -30
  97. dlms_spodes-0.87.16.dist-info/RECORD +117 -0
  98. {dlms_spodes-0.87.13.dist-info → dlms_spodes-0.87.16.dist-info}/WHEEL +1 -1
  99. dlms_spodes-0.87.13.dist-info/RECORD +0 -117
  100. {dlms_spodes-0.87.13.dist-info → dlms_spodes-0.87.16.dist-info}/top_level.txt +0 -0
@@ -1,87 +1,87 @@
1
- from .__class_init__ import *
2
- from ..types import choices
3
- from .overview import VERSION_0
4
-
5
-
6
- class ServiceId(cdt.Enum, elements=(1, 2)):
7
- """defines which action to be applied to the referenced object."""
8
-
9
-
10
- class ActionSpecification(cdt.Structure):
11
- """ Specifies the different scripts, i.e. the lists of actions. The first attribute (logical_name) has index 1, the first specific method has
12
- index 1 as well. NOTE The action_specification is limited to activate methods that do not produce any response (from the server to the client). """
13
- service_id: ServiceId
14
- class_id: cdt.LongUnsigned
15
- logical_name: cst.LogicalName
16
- index: cdt.Integer
17
- parameter: choices.common_dt
18
-
19
-
20
- class Actions(cdt.Array):
21
- """ Specifies the list of action specification """
22
- TYPE = ActionSpecification
23
-
24
-
25
- class Script(cdt.Structure):
26
- """ Specifies the different scripts. The script_identifier 0 is reserved. If specified with an execute method, it results in a null script (no actions to perform)"""
27
- script_identifier: cdt.LongUnsigned
28
- actions: Actions
29
-
30
-
31
- class Scripts(cdt.Array):
32
- """ Specifies the lists of actions """
33
- TYPE = Script
34
- __get_item__: Script
35
-
36
- def new_element(self) -> Script:
37
- """return default Script with vacant script_identifier"""
38
- # todo: make common function by ID element
39
- el: Script
40
- day_ids: list[int] = [int(el.script_identifier) for el in self.values]
41
- for i in range(0xffff):
42
- if i not in day_ids:
43
- return Script((i, None))
44
- raise ValueError(F"in {self} all <script_identifier> is busy")
45
-
46
-
47
- class ScriptTable(ic.COSEMInterfaceClasses):
48
- """Script table"""
49
- CLASS_ID = ClassID.SCRIPT_TABLE
50
- VERSION = VERSION_0
51
- A_ELEMENTS = ic.ICAElement("scripts", Scripts),
52
- M_ELEMENTS = ic.ICMElement("execute", cdt.LongUnsigned),
53
-
54
- def characteristics_init(self):
55
- self.set_attr(2, None)
56
- self._cbs_attr_post_init.update({2: self.__set_script_identifier_cbs})
57
-
58
- @property
59
- def scripts(self) -> Scripts:
60
- return self.get_attr(2)
61
-
62
- @property
63
- def execute(self) -> cdt.LongUnsigned:
64
- return self.get_meth(1)
65
-
66
- def __set_script_identifier_cbs(self):
67
- pass
68
- # try:
69
- # indexes: Callable = self.entries.get_indexes
70
- # self.enable_disable.firstIndexA.set_callback(indexes)
71
- # self.enable_disable.firstIndexB.set_callback(indexes)
72
- # self.enable_disable.lastIndexA.set_callback(indexes)
73
- # self.enable_disable.lastIndexB.set_callback(indexes)
74
- # self.insert.index.set_callback(indexes)
75
- # self.delete.firstIndex.set_callback(indexes)
76
- # self.delete.lastIndex.set_callback(indexes)
77
- # print('set delete')
78
- # except KeyError: # At init time
79
- # print('set delete NO:')
80
-
81
-
82
- if __name__ == '__main__':
83
- a = b'\x01\x04\x02\x02\x12\x00\x01\x01\x01\x02\x05\x16\x01\x12\x00F\t\x06\x00\x00`\x03\n\xff\x0f\x04\x16\x00\x02\x02\x12\x00\x02\x01\x01\x02\x05\x16\x02\x12\x00F\t\x06\x00\x00`\x03\n\xff\x0f\x01\x03\x00\x02\x02\x12\x00\x03\x01\x01\x02\x05\x16\x01\x12\x00F\t\x06\x00\x00`\x03\n\xff\x0f\x04\x16\x01\x02\x02\x12\x00\x04\x01\x01\x02\x05\x16\x02\x12\x00F\t\x06\x00\x00`\x03\n\xff\x0f\x01\x03\x01'
84
- b = Scripts(a)
85
- a = ScriptTable('0.0.10.0.0.255')
86
- pass
87
- print(a)
1
+ from .__class_init__ import *
2
+ from ..types import choices
3
+ from .overview import VERSION_0
4
+
5
+
6
+ class ServiceId(cdt.Enum, elements=(1, 2)):
7
+ """defines which action to be applied to the referenced object."""
8
+
9
+
10
+ class ActionSpecification(cdt.Structure):
11
+ """ Specifies the different scripts, i.e. the lists of actions. The first attribute (logical_name) has index 1, the first specific method has
12
+ index 1 as well. NOTE The action_specification is limited to activate methods that do not produce any response (from the server to the client). """
13
+ service_id: ServiceId
14
+ class_id: cdt.LongUnsigned
15
+ logical_name: cst.LogicalName
16
+ index: cdt.Integer
17
+ parameter: choices.common_dt
18
+
19
+
20
+ class Actions(cdt.Array):
21
+ """ Specifies the list of action specification """
22
+ TYPE = ActionSpecification
23
+
24
+
25
+ class Script(cdt.Structure):
26
+ """ Specifies the different scripts. The script_identifier 0 is reserved. If specified with an execute method, it results in a null script (no actions to perform)"""
27
+ script_identifier: cdt.LongUnsigned
28
+ actions: Actions
29
+
30
+
31
+ class Scripts(cdt.Array):
32
+ """ Specifies the lists of actions """
33
+ TYPE = Script
34
+ __get_item__: Script
35
+
36
+ def new_element(self) -> Script:
37
+ """return default Script with vacant script_identifier"""
38
+ # todo: make common function by ID element
39
+ el: Script
40
+ day_ids: list[int] = [int(el.script_identifier) for el in self.values]
41
+ for i in range(0xffff):
42
+ if i not in day_ids:
43
+ return Script((i, None))
44
+ raise ValueError(F"in {self} all <script_identifier> is busy")
45
+
46
+
47
+ class ScriptTable(ic.COSEMInterfaceClasses):
48
+ """Script table"""
49
+ CLASS_ID = ClassID.SCRIPT_TABLE
50
+ VERSION = VERSION_0
51
+ A_ELEMENTS = ic.ICAElement("scripts", Scripts),
52
+ M_ELEMENTS = ic.ICMElement("execute", cdt.LongUnsigned),
53
+
54
+ def characteristics_init(self):
55
+ self.set_attr(2, None)
56
+ self._cbs_attr_post_init.update({2: self.__set_script_identifier_cbs})
57
+
58
+ @property
59
+ def scripts(self) -> Scripts:
60
+ return self.get_attr(2)
61
+
62
+ @property
63
+ def execute(self) -> cdt.LongUnsigned:
64
+ return self.get_meth(1)
65
+
66
+ def __set_script_identifier_cbs(self):
67
+ pass
68
+ # try:
69
+ # indexes: Callable = self.entries.get_indexes
70
+ # self.enable_disable.firstIndexA.set_callback(indexes)
71
+ # self.enable_disable.firstIndexB.set_callback(indexes)
72
+ # self.enable_disable.lastIndexA.set_callback(indexes)
73
+ # self.enable_disable.lastIndexB.set_callback(indexes)
74
+ # self.insert.index.set_callback(indexes)
75
+ # self.delete.firstIndex.set_callback(indexes)
76
+ # self.delete.lastIndex.set_callback(indexes)
77
+ # print('set delete')
78
+ # except KeyError: # At init time
79
+ # print('set delete NO:')
80
+
81
+
82
+ if __name__ == '__main__':
83
+ a = b'\x01\x04\x02\x02\x12\x00\x01\x01\x01\x02\x05\x16\x01\x12\x00F\t\x06\x00\x00`\x03\n\xff\x0f\x04\x16\x00\x02\x02\x12\x00\x02\x01\x01\x02\x05\x16\x02\x12\x00F\t\x06\x00\x00`\x03\n\xff\x0f\x01\x03\x00\x02\x02\x12\x00\x03\x01\x01\x02\x05\x16\x01\x12\x00F\t\x06\x00\x00`\x03\n\xff\x0f\x04\x16\x01\x02\x02\x12\x00\x04\x01\x01\x02\x05\x16\x02\x12\x00F\t\x06\x00\x00`\x03\n\xff\x0f\x01\x03\x01'
84
+ b = Scripts(a)
85
+ a = ScriptTable('0.0.10.0.0.255')
86
+ pass
87
+ print(a)
@@ -1,68 +1,68 @@
1
- from ..__class_init__ import *
2
- from ..overview import VERSION_0
3
-
4
-
5
- class SecurityPolicy(cdt.Enum, elements=tuple(range(16))):
6
- """ Enforces authentication and/or encrypting algorithm provided with security_suite """
7
-
8
-
9
- class SecuritySuite(cdt.Enum, elements=tuple(range(16))):
10
- """Specifies authentication, encryption and key transport algorithm"""
11
- AES_GCM_128_AUT_ENCR_AND_AES_128_KEY_WRAP = 0
12
-
13
-
14
- class KeyID(cdt.Enum, elements=(0, 1, 2)):
15
- """Use only in KeyData structure"""
16
-
17
-
18
- class KeyData(cdt.Structure):
19
- """ TODO: """
20
- key_id: KeyID
21
- key_wrapped: cdt.OctetString
22
-
23
-
24
- class GlobalKeyTransfer(cdt.Array):
25
- """ Array of key_data """
26
- TYPE = KeyData
27
-
28
-
29
- class SecuritySetup(ic.COSEMInterfaceClasses):
30
- """ Instances of the “Security setup” IC contain the necessary information on the security suite in use and the security policy applicable between the server and a client
31
- and/or third party indentify by their respective system titles. They also provide methods to increase the level of security and to manage symmetric keys, asymmetric key pairs
32
- and certificates """
33
- CLASS_ID = ClassID.SECURITY_SETUP
34
- VERSION = VERSION_0
35
- A_ELEMENTS = (ic.ICAElement("security_policy", SecurityPolicy, 0, 3, 0),
36
- ic.ICAElement("security_suite", SecuritySuite, 0, 0, 0),
37
- ic.ICAElement("client_system_title", cdt.OctetString, classifier=ic.Classifier.DYNAMIC),
38
- ic.ICAElement("server_system_title", cdt.OctetString))
39
-
40
- M_ELEMENTS = (ic.ICMElement("security_activate", SecurityPolicy),
41
- ic.ICMElement("global_key_transfer", GlobalKeyTransfer))
42
-
43
- def characteristics_init(self):
44
- """nothing do it"""
45
-
46
- @property
47
- def security_policy(self) -> SecurityPolicy:
48
- return self.get_attr(2)
49
-
50
- @property
51
- def security_suite(self) -> SecuritySuite:
52
- return self.get_attr(3)
53
-
54
- @property
55
- def client_system_title(self) -> cdt.OctetString:
56
- return self .get_attr(4)
57
-
58
- @property
59
- def server_system_title(self) -> cdt.OctetString:
60
- return self .get_attr(5)
61
-
62
- @property
63
- def security_activate(self) -> SecurityPolicy:
64
- return self .get_meth(1)
65
-
66
- @property
67
- def global_key_transfer(self) -> GlobalKeyTransfer:
68
- return self .get_meth(2)
1
+ from ..__class_init__ import *
2
+ from ..overview import VERSION_0
3
+
4
+
5
+ class SecurityPolicy(cdt.Enum, elements=tuple(range(16))):
6
+ """ Enforces authentication and/or encrypting algorithm provided with security_suite """
7
+
8
+
9
+ class SecuritySuite(cdt.Enum, elements=tuple(range(16))):
10
+ """Specifies authentication, encryption and key transport algorithm"""
11
+ AES_GCM_128_AUT_ENCR_AND_AES_128_KEY_WRAP = 0
12
+
13
+
14
+ class KeyID(cdt.Enum, elements=(0, 1, 2)):
15
+ """Use only in KeyData structure"""
16
+
17
+
18
+ class KeyData(cdt.Structure):
19
+ """ TODO: """
20
+ key_id: KeyID
21
+ key_wrapped: cdt.OctetString
22
+
23
+
24
+ class GlobalKeyTransfer(cdt.Array):
25
+ """ Array of key_data """
26
+ TYPE = KeyData
27
+
28
+
29
+ class SecuritySetup(ic.COSEMInterfaceClasses):
30
+ """ Instances of the “Security setup” IC contain the necessary information on the security suite in use and the security policy applicable between the server and a client
31
+ and/or third party indentify by their respective system titles. They also provide methods to increase the level of security and to manage symmetric keys, asymmetric key pairs
32
+ and certificates """
33
+ CLASS_ID = ClassID.SECURITY_SETUP
34
+ VERSION = VERSION_0
35
+ A_ELEMENTS = (ic.ICAElement("security_policy", SecurityPolicy, 0, 3, 0),
36
+ ic.ICAElement("security_suite", SecuritySuite, 0, 0, 0),
37
+ ic.ICAElement("client_system_title", cdt.OctetString, classifier=ic.Classifier.DYNAMIC),
38
+ ic.ICAElement("server_system_title", cdt.OctetString))
39
+
40
+ M_ELEMENTS = (ic.ICMElement("security_activate", SecurityPolicy),
41
+ ic.ICMElement("global_key_transfer", GlobalKeyTransfer))
42
+
43
+ def characteristics_init(self):
44
+ """nothing do it"""
45
+
46
+ @property
47
+ def security_policy(self) -> SecurityPolicy:
48
+ return self.get_attr(2)
49
+
50
+ @property
51
+ def security_suite(self) -> SecuritySuite:
52
+ return self.get_attr(3)
53
+
54
+ @property
55
+ def client_system_title(self) -> cdt.OctetString:
56
+ return self .get_attr(4)
57
+
58
+ @property
59
+ def server_system_title(self) -> cdt.OctetString:
60
+ return self .get_attr(5)
61
+
62
+ @property
63
+ def security_activate(self) -> SecurityPolicy:
64
+ return self .get_meth(1)
65
+
66
+ @property
67
+ def global_key_transfer(self) -> GlobalKeyTransfer:
68
+ return self .get_meth(2)
@@ -1,158 +1,158 @@
1
- from . import ver0
2
- from ..__class_init__ import *
3
- from ..overview import VERSION_1
4
- from ...types import choices
5
-
6
-
7
- class SecurityPolicyVer1(cdt.IntegerFlag, cdt.Enum):
8
- """ security_policy"""
9
-
10
-
11
- class CertificateEntity(cdt.Enum, elements=(0, 1, 2, 3)):
12
- """TODO:"""
13
-
14
-
15
- class CertificateType(cdt.Enum, elements=(0, 1, 2, 3)):
16
- """TODO:"""
17
-
18
-
19
- class SecuritySuite(ver0.SecuritySuite, elements=(0, 1, 2)):
20
- """Version 0 extension"""
21
- AES_GCM_128_AUT_ENCR_ECDSA_P_256_DIG_SIGN_ECDH_P_256_KEY_AGR_SHA_256_HASH_V44_COMPR_AND_AES_128_KEY_WRAP = 1
22
- AES_GCM_256_AUT_ENCR_ECDSA_P_384_DIG_SIGN_ECDH_P_384_KEY_AGR_SHA_384_HASH_V44_COMPR_AND_AES_256_KEY_WRAP = 2
23
-
24
-
25
- class CertificateInfo(cdt.Structure):
26
- """ TODO: """
27
- certificate_entity: CertificateEntity
28
- certificate_type: CertificateType
29
- serial_number: cdt.OctetString
30
- issuer: cdt.OctetString
31
- subject: cdt.OctetString
32
- subject_alt_name: cdt.OctetString
33
-
34
-
35
- class Certificates(cdt.Array):
36
- """Carries information on the X.509 v3 Certificates available and stored in the server"""
37
- TYPE = CertificateInfo
38
-
39
-
40
- class KeyID(cdt.Enum, elements=(0, 1, 2, 3)):
41
- """Version 0 extension"""
42
-
43
-
44
- class KeyTransferData(cdt.Structure):
45
- """ TODO: """
46
- key_id: KeyID
47
- key_wrapped: cdt.OctetString
48
-
49
-
50
- class KeyTransfer(cdt.Array):
51
- """ Array of key_transfer_data """
52
- TYPE = KeyTransferData
53
-
54
-
55
- class KeyAgreementData(cdt.Structure):
56
- """ TODO: """
57
- key_id: KeyID
58
- key_data: cdt.OctetString
59
-
60
-
61
- class KeyAgreement(cdt.Array):
62
- """ Array of key_agreement_data """
63
- TYPE = KeyAgreementData
64
-
65
-
66
- class KeyPair(cdt.Enum, elements=(0, 1, 2)):
67
- """TODO:"""
68
-
69
-
70
- class CertificateIdentificationByEntity(cdt.Structure):
71
- """ TODO: """
72
- certificate_entity: CertificateEntity
73
- certificate_type: CertificateType
74
- system_title: cdt.OctetString
75
-
76
-
77
- class CertificateIdentificationBySerial(cdt.Structure):
78
- """ TODO: """
79
- serial_number: cdt.OctetString
80
- issuer: cdt.OctetString
81
-
82
-
83
- class CertificateIdentificationType(cdt.Enum, elements=(0, 1)):
84
- """TODO:"""
85
-
86
-
87
- class CertificationIdentificationOption(ut.CHOICE):
88
- TYPE = cdt.Structure
89
- ELEMENTS = {0: ut.SequenceElement('by entity', CertificateIdentificationByEntity),
90
- 1: ut.SequenceElement('by serial', CertificateIdentificationBySerial)}
91
-
92
-
93
- certification_identification_option = CertificationIdentificationOption()
94
-
95
-
96
- class CertificateIdentification(choices.StructureMixin, cdt.Structure):
97
- """Override several methods of cdt.Structure. It limited Structure."""
98
- certificate_identification_type: CertificateIdentificationType
99
- certification_identification_options: certification_identification_option
100
-
101
-
102
- class SecuritySetup(ver0.SecuritySetup):
103
- VERSION = VERSION_1
104
- A_ELEMENTS = (ic.ICAElement("security_policy", SecurityPolicyVer1),
105
- ic.ICAElement("security_suite", SecuritySuite),
106
- ver0.SecuritySetup.getAElement(3).unwrap(),
107
- ver0.SecuritySetup.getAElement(4).unwrap(),
108
- ver0.SecuritySetup.getAElement(5).unwrap(),
109
- ic.ICAElement("certificates", Certificates, classifier=ic.Classifier.DYNAMIC))
110
-
111
- M_ELEMENTS = (ic.ICMElement("security_activate", SecurityPolicyVer1),
112
- ic.ICMElement("key_transfer", KeyTransfer),
113
- ic.ICMElement("key_agreement", KeyAgreement),
114
- ic.ICMElement("generate_key_pair", KeyPair),
115
- ic.ICMElement("generate_certificate_request", KeyPair),
116
- ic.ICMElement("import_certificate", cdt.OctetString),
117
- ic.ICMElement("export_certificate", CertificateIdentification),
118
- ic.ICMElement("remove_certificate", CertificateIdentification))
119
-
120
- def characteristics_init(self):
121
- self.set_attr(2, None)
122
- self.set_attr(3, None)
123
- self.set_attr(6, None)
124
-
125
- @property
126
- def security_policy(self) -> SecurityPolicyVer1:
127
- return self.get_attr(2)
128
-
129
- @property
130
- def security_suite(self) -> SecuritySuite:
131
- return self.get_attr(3)
132
-
133
- @property
134
- def certificates(self) -> Certificates:
135
- return self.get_attr(6)
136
-
137
- @property
138
- def security_activate(self) -> SecurityPolicyVer1:
139
- return self.get_meth(1)
140
-
141
- @property
142
- def key_transfer(self) -> KeyTransferData:
143
- return self .get_meth(2)
144
-
145
- def key_agreement(self) -> KeyAgreement:
146
- return self .get_meth(3)
147
-
148
- def generate_certificate_request(self) -> KeyPair:
149
- return self .get_meth(4)
150
-
151
- def import_certificate(self) -> cdt.OctetString:
152
- return self .get_meth(5)
153
-
154
- def export_certificate(self) -> CertificateIdentification:
155
- return self .get_meth(6)
156
-
157
- def remove_certificate(self) -> CertificateIdentification:
158
- return self .get_meth(7)
1
+ from . import ver0
2
+ from ..__class_init__ import *
3
+ from ..overview import VERSION_1
4
+ from ...types import choices
5
+
6
+
7
+ class SecurityPolicyVer1(cdt.IntegerFlag, cdt.Enum):
8
+ """ security_policy"""
9
+
10
+
11
+ class CertificateEntity(cdt.Enum, elements=(0, 1, 2, 3)):
12
+ """TODO:"""
13
+
14
+
15
+ class CertificateType(cdt.Enum, elements=(0, 1, 2, 3)):
16
+ """TODO:"""
17
+
18
+
19
+ class SecuritySuite(ver0.SecuritySuite, elements=(0, 1, 2)):
20
+ """Version 0 extension"""
21
+ AES_GCM_128_AUT_ENCR_ECDSA_P_256_DIG_SIGN_ECDH_P_256_KEY_AGR_SHA_256_HASH_V44_COMPR_AND_AES_128_KEY_WRAP = 1
22
+ AES_GCM_256_AUT_ENCR_ECDSA_P_384_DIG_SIGN_ECDH_P_384_KEY_AGR_SHA_384_HASH_V44_COMPR_AND_AES_256_KEY_WRAP = 2
23
+
24
+
25
+ class CertificateInfo(cdt.Structure):
26
+ """ TODO: """
27
+ certificate_entity: CertificateEntity
28
+ certificate_type: CertificateType
29
+ serial_number: cdt.OctetString
30
+ issuer: cdt.OctetString
31
+ subject: cdt.OctetString
32
+ subject_alt_name: cdt.OctetString
33
+
34
+
35
+ class Certificates(cdt.Array):
36
+ """Carries information on the X.509 v3 Certificates available and stored in the server"""
37
+ TYPE = CertificateInfo
38
+
39
+
40
+ class KeyID(cdt.Enum, elements=(0, 1, 2, 3)):
41
+ """Version 0 extension"""
42
+
43
+
44
+ class KeyTransferData(cdt.Structure):
45
+ """ TODO: """
46
+ key_id: KeyID
47
+ key_wrapped: cdt.OctetString
48
+
49
+
50
+ class KeyTransfer(cdt.Array):
51
+ """ Array of key_transfer_data """
52
+ TYPE = KeyTransferData
53
+
54
+
55
+ class KeyAgreementData(cdt.Structure):
56
+ """ TODO: """
57
+ key_id: KeyID
58
+ key_data: cdt.OctetString
59
+
60
+
61
+ class KeyAgreement(cdt.Array):
62
+ """ Array of key_agreement_data """
63
+ TYPE = KeyAgreementData
64
+
65
+
66
+ class KeyPair(cdt.Enum, elements=(0, 1, 2)):
67
+ """TODO:"""
68
+
69
+
70
+ class CertificateIdentificationByEntity(cdt.Structure):
71
+ """ TODO: """
72
+ certificate_entity: CertificateEntity
73
+ certificate_type: CertificateType
74
+ system_title: cdt.OctetString
75
+
76
+
77
+ class CertificateIdentificationBySerial(cdt.Structure):
78
+ """ TODO: """
79
+ serial_number: cdt.OctetString
80
+ issuer: cdt.OctetString
81
+
82
+
83
+ class CertificateIdentificationType(cdt.Enum, elements=(0, 1)):
84
+ """TODO:"""
85
+
86
+
87
+ class CertificationIdentificationOption(ut.CHOICE):
88
+ TYPE = cdt.Structure
89
+ ELEMENTS = {0: ut.SequenceElement('by entity', CertificateIdentificationByEntity),
90
+ 1: ut.SequenceElement('by serial', CertificateIdentificationBySerial)}
91
+
92
+
93
+ certification_identification_option = CertificationIdentificationOption()
94
+
95
+
96
+ class CertificateIdentification(choices.StructureMixin, cdt.Structure):
97
+ """Override several methods of cdt.Structure. It limited Structure."""
98
+ certificate_identification_type: CertificateIdentificationType
99
+ certification_identification_options: certification_identification_option
100
+
101
+
102
+ class SecuritySetup(ver0.SecuritySetup):
103
+ VERSION = VERSION_1
104
+ A_ELEMENTS = (ic.ICAElement("security_policy", SecurityPolicyVer1),
105
+ ic.ICAElement("security_suite", SecuritySuite),
106
+ ver0.SecuritySetup.getAElement(3).unwrap(),
107
+ ver0.SecuritySetup.getAElement(4).unwrap(),
108
+ ver0.SecuritySetup.getAElement(5).unwrap(),
109
+ ic.ICAElement("certificates", Certificates, classifier=ic.Classifier.DYNAMIC))
110
+
111
+ M_ELEMENTS = (ic.ICMElement("security_activate", SecurityPolicyVer1),
112
+ ic.ICMElement("key_transfer", KeyTransfer),
113
+ ic.ICMElement("key_agreement", KeyAgreement),
114
+ ic.ICMElement("generate_key_pair", KeyPair),
115
+ ic.ICMElement("generate_certificate_request", KeyPair),
116
+ ic.ICMElement("import_certificate", cdt.OctetString),
117
+ ic.ICMElement("export_certificate", CertificateIdentification),
118
+ ic.ICMElement("remove_certificate", CertificateIdentification))
119
+
120
+ def characteristics_init(self):
121
+ self.set_attr(2, None)
122
+ self.set_attr(3, None)
123
+ self.set_attr(6, None)
124
+
125
+ @property
126
+ def security_policy(self) -> SecurityPolicyVer1:
127
+ return self.get_attr(2)
128
+
129
+ @property
130
+ def security_suite(self) -> SecuritySuite:
131
+ return self.get_attr(3)
132
+
133
+ @property
134
+ def certificates(self) -> Certificates:
135
+ return self.get_attr(6)
136
+
137
+ @property
138
+ def security_activate(self) -> SecurityPolicyVer1:
139
+ return self.get_meth(1)
140
+
141
+ @property
142
+ def key_transfer(self) -> KeyTransferData:
143
+ return self .get_meth(2)
144
+
145
+ def key_agreement(self) -> KeyAgreement:
146
+ return self .get_meth(3)
147
+
148
+ def generate_certificate_request(self) -> KeyPair:
149
+ return self .get_meth(4)
150
+
151
+ def import_certificate(self) -> cdt.OctetString:
152
+ return self .get_meth(5)
153
+
154
+ def export_certificate(self) -> CertificateIdentification:
155
+ return self .get_meth(6)
156
+
157
+ def remove_certificate(self) -> CertificateIdentification:
158
+ return self .get_meth(7)