From 60bde7d382f11da942ec4f0ba03f66196eafd0ae Mon Sep 17 00:00:00 2001 From: Isidro Arias Date: Tue, 14 Nov 2023 17:16:16 +0100 Subject: [PATCH] GeneralDedCiphering --- dlms_cosem/connection.py | 1 + dlms_cosem/protocol/xdlms/__init__.py | 1 + dlms_cosem/protocol/xdlms/general_ded_cipher.py | 12 ++++++++++++ 3 files changed, 14 insertions(+) create mode 100644 dlms_cosem/protocol/xdlms/general_ded_cipher.py diff --git a/dlms_cosem/connection.py b/dlms_cosem/connection.py index f230544..207a1b2 100644 --- a/dlms_cosem/connection.py +++ b/dlms_cosem/connection.py @@ -36,6 +36,7 @@ class XDlmsApduFactory: 40: xdlms.GlobalCipherInitiateResponse, 216: xdlms.ExceptionResponse, 219: xdlms.GeneralGlobalCipher, + 220: xdlms.GeneralDedCipher, # ACSE APDUs: 96: acse.ApplicationAssociationRequest, 97: acse.ApplicationAssociationResponse, diff --git a/dlms_cosem/protocol/xdlms/__init__.py b/dlms_cosem/protocol/xdlms/__init__.py index ff759e1..b8ed85d 100644 --- a/dlms_cosem/protocol/xdlms/__init__.py +++ b/dlms_cosem/protocol/xdlms/__init__.py @@ -11,6 +11,7 @@ from dlms_cosem.protocol.xdlms.data_notification import DataNotification from dlms_cosem.protocol.xdlms.exception_response import ExceptionResponse from dlms_cosem.protocol.xdlms.general_global_cipher import GeneralGlobalCipher +from dlms_cosem.protocol.xdlms.general_ded_cipher import GeneralDedCipher from dlms_cosem.protocol.xdlms.get import ( GetRequestFactory, GetRequestNext, diff --git a/dlms_cosem/protocol/xdlms/general_ded_cipher.py b/dlms_cosem/protocol/xdlms/general_ded_cipher.py new file mode 100644 index 0000000..43a9f6e --- /dev/null +++ b/dlms_cosem/protocol/xdlms/general_ded_cipher.py @@ -0,0 +1,12 @@ +from dlms_cosem.protocol.xdlms.base import AbstractXDlmsApdu +from dlms_cosem.protocol.xdlms.general_global_cipher import GeneralGlobalCipher + +# TODO: move implementation from GeneralGlobalCipher to KeySpecificCiphering +KeySpecificCipher = type( + "KeySpecificCipher", (AbstractXDlmsApdu,), dict(GeneralGlobalCipher.__dict__) +) + + +class GeneralDedCipher(KeySpecificCipher): + TAG = 220 + NAME = "general-ded-cipher"