From 98a7d393aa74d97732cf442fa1ee9d252cd550d4 Mon Sep 17 00:00:00 2001 From: Patrick Roelke Date: Thu, 30 Nov 2023 09:56:27 +0100 Subject: [PATCH] feat: add 1.6 security extension datatypes (#531) Add missing datatypes from 1.6 security extension whitepaper. --- CHANGELOG.md | 3 +++ ocpp/v16/datatypes.py | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f3158914..f811b9b31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Change log + +- [#531] (https://github.com/mobilityhouse/ocpp/pull/531) Add 1.6 security extension datatypes +======= - [#528](https://github.com/mobilityhouse/ocpp/issues/528) v2.0.1 CertificateHashDataChainType childCertificateHashData requires the default of None - [#510](https://github.com/mobilityhouse/ocpp/issues/510) v2.0.1 UnitOfMeasureType - Enums missing and update docstring to allow use for variableCharacteristics - [#508](https://github.com/mobilityhouse/ocpp/issues/508) Exception - OccurrenceConstraintViolationError doc string correction diff --git a/ocpp/v16/datatypes.py b/ocpp/v16/datatypes.py index 1f249e477..aa652f80d 100644 --- a/ocpp/v16/datatypes.py +++ b/ocpp/v16/datatypes.py @@ -7,6 +7,7 @@ ChargingProfilePurposeType, ChargingRateUnitType, CiStringType, + HashAlgorithm, Location, Measurand, Phase, @@ -121,3 +122,45 @@ class MeterValue: timestamp: str sampled_value: List[SampledValue] + + +# Security Extension + + +@dataclass +class CertificateHashData: + """ + CertificateHashDataType is used by: + DeleteCertificate.req, GetInstalledCertificateIds.conf + """ + + hash_algorithm: HashAlgorithm + issuer_name_hash: str + issuer_key_hash: str + serial_number: str + + +@dataclass +class Firmware: + """ + Represents a copy of the firmware that can be loaded/updated on the Charge Point. + FirmwareType is used by: SignedUpdateFirmware.req + """ + + location: str + retrieve_date_time: str + signing_certificate: str + install_date_time: Optional[str] = None + signature: Optional[str] = None + + +@dataclass +class LogParameters: + """ + Class for detailed information the retrieval of logging entries. + LogParametersType is used by: GetLog.req + """ + + remote_location: str + oldest_timestamp: Optional[str] = None + latest_timestamp: Optional[str] = None