Skip to main content

ocpp_kit/standard/
security_events_1_6.rs

1// @generated by `cargo xtask appendix` from the OCPP 1.6 Security Whitepaper, edition 4
2// (2026-02-05), section 8.
3//
4// Only the interoperability surface is reproduced: names and criticality. The whitepaper's
5// prose descriptions are not copied, and the whitepaper itself is not redistributed.
6// DO NOT EDIT — re-run the generator instead.
7
8//! The security events of the OCPP 1.6 Security Whitepaper, and which are critical.
9//!
10//! Section 8: "Security events that are critical should be pushed to the Central
11//! System" with `SecurityEventNotification`. The names are 1.6's — `…AtCentralSystem`,
12//! not 2.x's `…AtCsms` — and so is the criticality: `InvalidFirmwareSignature` is not
13//! critical here, while it is in 2.x.
14
15ocpp_enum! {
16    /// A security event from the standardized list.
17    ///
18    /// The list is explicitly non-exhaustive: a vendor-specific event is carried in
19    /// `UnknownValue`, and the specification asks that a standardized event be used
20    /// wherever one matches.
21    SecurityEvent {
22        /// `FirmwareUpdated`.
23        FirmwareUpdated = "FirmwareUpdated",
24        /// `FailedToAuthenticateAtCentralSystem`.
25        FailedToAuthenticateAtCentralSystem = "FailedToAuthenticateAtCentralSystem",
26        /// `CentralSystemFailedToAuthenticate`.
27        CentralSystemFailedToAuthenticate = "CentralSystemFailedToAuthenticate",
28        /// `SettingSystemTime`.
29        SettingSystemTime = "SettingSystemTime",
30        /// `StartupOfTheDevice`.
31        StartupOfTheDevice = "StartupOfTheDevice",
32        /// `ResetOrReboot`.
33        ResetOrReboot = "ResetOrReboot",
34        /// `SecurityLogWasCleared`.
35        SecurityLogWasCleared = "SecurityLogWasCleared",
36        /// `ReconfigurationOfSecurityParameters`.
37        ReconfigurationOfSecurityParameters = "ReconfigurationOfSecurityParameters",
38        /// `MemoryExhaustion`.
39        MemoryExhaustion = "MemoryExhaustion",
40        /// `InvalidMessages`.
41        InvalidMessages = "InvalidMessages",
42        /// `AttemptedReplayAttacks`.
43        AttemptedReplayAttacks = "AttemptedReplayAttacks",
44        /// `TamperDetectionActivated`.
45        TamperDetectionActivated = "TamperDetectionActivated",
46        /// `InvalidFirmwareSignature`.
47        InvalidFirmwareSignature = "InvalidFirmwareSignature",
48        /// `InvalidFirmwareSigningCertificate`.
49        InvalidFirmwareSigningCertificate = "InvalidFirmwareSigningCertificate",
50        /// `InvalidCentralSystemCertificate`.
51        InvalidCentralSystemCertificate = "InvalidCentralSystemCertificate",
52        /// `InvalidChargePointCertificate`.
53        InvalidChargePointCertificate = "InvalidChargePointCertificate",
54        /// `InvalidTLSVersion`.
55        InvalidTLSVersion = "InvalidTLSVersion",
56        /// `InvalidTLSCipherSuite`.
57        InvalidTLSCipherSuite = "InvalidTLSCipherSuite",
58        /// `MaintenanceLoginAccepted`.
59        MaintenanceLoginAccepted = "MaintenanceLoginAccepted",
60        /// `MaintenanceLoginFailed`.
61        MaintenanceLoginFailed = "MaintenanceLoginFailed",
62        /// `DiscardedRenewedClientCertificate`.
63        DiscardedRenewedClientCertificate = "DiscardedRenewedClientCertificate",
64    }
65}
66
67impl SecurityEvent {
68    /// Whether the event must be pushed to the CSMS as well as logged.
69    ///
70    /// A vendor-specific event is treated as critical: the safe default is to report it.
71    #[must_use]
72    #[allow(clippy::match_same_arms)]
73    pub fn is_critical(&self) -> bool {
74        match self {
75            Self::FirmwareUpdated => true,
76            Self::FailedToAuthenticateAtCentralSystem => false,
77            Self::CentralSystemFailedToAuthenticate => false,
78            Self::SettingSystemTime => true,
79            Self::StartupOfTheDevice => true,
80            Self::ResetOrReboot => true,
81            Self::SecurityLogWasCleared => true,
82            Self::ReconfigurationOfSecurityParameters => false,
83            Self::MemoryExhaustion => true,
84            Self::InvalidMessages => false,
85            Self::AttemptedReplayAttacks => false,
86            Self::TamperDetectionActivated => true,
87            Self::InvalidFirmwareSignature => false,
88            Self::InvalidFirmwareSigningCertificate => true,
89            Self::InvalidCentralSystemCertificate => true,
90            Self::InvalidChargePointCertificate => true,
91            Self::InvalidTLSVersion => true,
92            Self::InvalidTLSCipherSuite => true,
93            Self::MaintenanceLoginAccepted => true,
94            Self::MaintenanceLoginFailed => true,
95            Self::DiscardedRenewedClientCertificate => true,
96            Self::UnknownValue(_) => true,
97        }
98    }
99
100    /// Every event the specification defines as critical.
101    #[must_use]
102    pub fn critical() -> alloc::vec::Vec<Self> {
103        Self::VARIANTS
104            .iter()
105            .map(|name| Self::from_wire(name))
106            .filter(Self::is_critical)
107            .collect()
108    }
109}