Key management methods, devices, energy storage systems and media for energy storage systems
By using a hardware security module to generate a root key and derive a master key in the energy storage system, a four-level key architecture is formed, which solves the problem of insufficient security in key management schemes, realizes key domain isolation and secure cross-module communication, and improves the security and reliability of the system.
Patent Information
- Application Number
- CN202611309525.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-26
- Publication Date
- 2026-11-17
AI Technical Summary
The key management scheme of energy storage system has problems such as insufficient key storage security, simple key architecture hierarchy, single rotation mechanism and lack of cross-module security collaboration, resulting in insufficient system security.
A hardware security module is used to generate the root key, and the master key is derived through the module identifier to form a four-level key security architecture, including the master key, working key and session key, to achieve key domain isolation and secure communication across modules.
It improves the security of key management in energy storage systems, limits the risk of key leakage, prevents the spread of lateral movement attacks, enhances the security of key management during module migration and replacement, and improves the reliability and security of cross-module communication.
Smart Images

Figure CN123122813A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of energy storage technology, specifically to key management methods, devices, energy storage systems, and media for energy storage systems. Background Technology
[0002] Energy storage systems typically consist of multiple core modules that require secure communication and data exchange. Key management is a crucial technology for ensuring system security. However, the key architecture of related technologies is simple and lacks sufficient security. Summary of the Invention
[0003] This application provides a key management method, apparatus, energy storage system, and medium for an energy storage system to improve the security of key management in the energy storage system.
[0004] Firstly, a key management method for an energy storage system is provided, the energy storage system including a hardware security module and multiple functional modules; the method includes: Generate the root key; Obtain the module identifier of the target functional module, and derive the master key of the target functional module based on the root key and the module identifier; The working key of the target functional module is derived from the master key; The session key for the target functional module is derived from the working key.
[0005] Secondly, a key management device for an energy storage system is provided, the energy storage system including a hardware security module and multiple functional modules; the device includes: The generation module is used to generate the root key; The acquisition module is used to obtain the module identifier of the target functional module; The first derived module is used to derive the master key of the target functional module based on the root key and the module identifier; The second derived module is used to derive the working key of the target functional module based on the master key; The third derived module is used to derive the session key of the target functional module based on the working key.
[0006] Thirdly, an energy storage system is provided, including multiple functional modules, a hardware security module, and a key management device as described in the second aspect.
[0007] Fourthly, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, causes the processor to perform the method described in the first aspect.
[0008] Beneficial Effects: This application provides a key management method, apparatus, energy storage system, and medium for an energy storage system. The key management method generates a root key through a hardware security module. Based on the root key and the module identifier of the target functional module, a master key for the target functional module is derived. Then, a working key for the target functional module is derived from the master key. Finally, a session key for the target functional module is derived from the working key, thus obtaining a four-level key security architecture. By using the module identifier as the context input for master key derivation, key domain isolation between different functional modules can be achieved, limiting the risk of key leakage from a single functional module to that module, thereby improving the security of key management in the energy storage system. Attached Figure Description
[0009] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0010] Figure 1 This is a flowchart of a key management method for an energy storage system provided in an embodiment of this application; Figure 2 This is a schematic diagram of a key derivation process provided in an embodiment of this application; Figure 3 This is a schematic diagram of a four-level derived structure provided in an embodiment of this application; Figure 4 This is a flowchart of another key management method for an energy storage system provided in an embodiment of this application; Figure 5 This is a schematic diagram of a cascaded rotation propagation chain provided in an embodiment of this application; Figure 6 This is a schematic diagram of the overall process of key rotation checking and cascading rotation provided in an embodiment of this application; Figure 7 This is a schematic diagram of the overall process for key corruption detection and recovery provided in an embodiment of this application; Figure 8 This is a schematic diagram of the overall process of deriving a four-level key architecture for an energy storage system provided in an embodiment of this application; Figure 9 This is a schematic diagram of the key management device for an energy storage system provided in an embodiment of this application. Detailed Implementation
[0011] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0012] In the description of this application, it should be understood that the terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicating orientation or positional relationships based on the orientation or positional relationships shown in the accompanying drawings, are used only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this application. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more of the stated features. In the description of this application, "a plurality of" means two or more, unless otherwise explicitly specified.
[0013] "A and / or B" includes the following three combinations: A only, B only, and a combination of A and B.
[0014] The use of "applies to" or "configured to" in this application implies open and inclusive language, which does not exclude the applicability to or configuration to devices performing additional tasks or steps. Additionally, the use of "based on" implies openness and inclusivity, because processes, steps, calculations, or other actions "based on" one or more of the stated conditions or values may in practice be based on additional conditions or values beyond those stated.
[0015] In this application, the term "exemplary" is used to mean "used as an example, illustration, or description." Any embodiment described as "exemplary" in this application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to make and use this application. Details are set forth in the following description for purposes of explanation. It should be understood that those skilled in the art will recognize that this application can be made without using these specific details. In other instances, well-known structures and processes are not described in detail to avoid obscuring the description of this application with unnecessary detail. Therefore, this application is not intended to be limited to the embodiments shown, but is consistent with the broadest scope of the principles and features disclosed in this application.
[0016] The applicant's research revealed that, with the widespread application of energy storage systems in the new energy field, these systems typically consist of multiple core modules, including a Battery Management System (BMS), a Power Conversion System (PCS), and an Energy Management System (EMS). Secure communication and data exchange between these modules are required, making key management a crucial technology for ensuring system security. However, existing key management schemes for energy storage systems suffer from the following problems: First, the key storage security is insufficient. Some solutions store the root key in a non-volatile storage medium at the software level, relying on an encrypted partition created by Linux Unified Key Setup (LUKS), which lacks hardware-level physical protection.
[0017] Second, the key architecture is simple. Related technologies typically employ a three-layer architecture of root key, working key, and temporary key, lacking an intermediate master key layer, which results in inflexible key derivation logic.
[0018] Third, the rotation mechanism is simplistic. Key updates for related technologies are primarily based on operational parameters (such as runtime thresholds, charge / discharge count thresholds, and encrypted data volume thresholds), lacking the ability to respond instantly to security incidents.
[0019] Fourth, there is a lack of cross-module secure collaboration. Each module manages its keys independently, and there is a lack of a unified secure channel establishment mechanism for communication between modules.
[0020] In view of this, embodiments of this application provide a key management method, apparatus, energy storage system, and medium for an energy storage system. A root key is generated through a hardware security module. A master key for the target functional module is derived from the root key and the module identifier of the target functional module. Then, a working key for the target functional module is derived from the master key. Finally, a session key for the target functional module is derived from the working key, thus obtaining a four-level key security architecture. By using the module identifier as the context input for master key derivation, key domain isolation between different functional modules can be achieved, limiting the risk of key leakage from a single functional module to that module, thereby improving the security of key management in the energy storage system.
[0021] In this embodiment, the energy storage system includes multiple functional modules, which can be one or more of BMS, PCS, and EMS. The specific modules can be configured according to actual conditions and are not specifically limited here. In this embodiment, a four-level key security architecture or a four-level derived structure is formed from the root key to the master key, from the master key to the working key, and then from the working key to the session key. The key management method of the energy storage system provided in this embodiment is executed by the hardware security module.
[0022] Figure 1 This is a flowchart illustrating a key management method for an energy storage system provided in an embodiment of this application. (See also...) Figure 1 The key management method of the energy storage system includes the following steps S110 to S140.
[0023] Step S110: Generate the root key.
[0024] The root key is stored inside the hardware security module and cannot be exported.
[0025] A Hardware Security Module (HSM) is a physical device used to securely generate, store, and manage digital keys. It possesses anti-tampering and anti-side-channel attack capabilities and supports the Chinese national cryptographic algorithms SM2 / SM3 / SM4. SM3 is a Chinese cryptographic hash algorithm (national standard, GM / T 0004-2012), similar to SHA-256. It compresses an input of arbitrary length into a fixed 256-bit output (hash value). It is mainly used in scenarios such as digital signatures, integrity verification, and message authentication codes, and has security features such as collision resistance (it is difficult to find different inputs that produce the same output). For example, this application embodiment uses the Chinese national cryptographic algorithm SM3 as an example for illustration, and will not be elaborated further below.
[0026] The root key (K_Root) is the first level in the four-level key security architecture. The root key is permanently stored inside the hardware security module, generated by a physical random number generator, and is never exported.
[0027] Step S120: Obtain the module identifier of the target functional module, and derive the master key of the target functional module based on the root key and the module identifier.
[0028] The target functional module can be any module in the energy storage system, such as core modules like BMS, PCS, and EMS. Different functional modules have different module identifiers. Each module in an energy storage system has its own unique module identifier (Module_ID), which can be, for example, the serial number of the equipment or product.
[0029] The master key (K_Master) is the second level in the four-level key security architecture. The master key is derived from the root key through a hardware security module. During derivation, a module identifier is introduced as context, enabling key domain isolation. Even if the root key is leaked, the master keys of different functional modules cannot be mutually derived. This ensures that the leak of any functional module does not affect other functional modules, thus limiting the risk of key leakage to a single module and preventing the spread of lateral attacks. This single-point leak prevents further spread and improves the security of key management in energy storage systems.
[0030] Different functional modules correspond to different master keys, thus enabling strong binding of master keys to specific functional modules. For example, the BMS master key is derived from the root key and the module identifier corresponding to the BMS, thereby strongly binding the BMS to the corresponding master key; similarly, the PCS master key is derived from the root key and the module identifier corresponding to the PCS, thereby strongly binding the PCS to the corresponding master key. This ensures that a complete key reconfiguration is required when migrating or replacing modules, thereby enhancing the security of key management.
[0031] Step S130: Derive the working key of the target functional module based on the master key.
[0032] The working key (K_Work) is the third layer in the four-level key security architecture. The working key is derived from the master key via a key derivation algorithm used by the hardware security module. This algorithm can employ the SM3 Key Derivation Function (KDF). Specifically, the working key of the target functional module is derived from its master key using SM3_KDF. For example, the working key of the BMS is derived from the master key of the BMS, the working key of the PCS is derived from the master key of the PCS, and the working key of the EMS is derived from the master key of the EMS. Because the working key is located between the master key and the session key, it forms an intermediate buffer layer for key derivation. This eliminates the need to directly call the master key for frequent session key derivations, reducing the exposure frequency of the master key and the risk of side-channel attacks, thus improving the security of key management.
[0033] For example, the derivation formula for the working key of each functional module is as follows: K_Module_Work=SM3_KDF(K_Module_Master, "WORK_KEY" || Sequence_ID); Wherein, K_Module_Work represents the working key of each functional module; K_Module_Master represents the master key of each functional module; Sequence_ID represents the product or device serial number of each functional module; "WORK_KEY" represents the domain separation identifier corresponding to the working key level, representing the level label and domain separation identifier of the working key.
[0034] Step S140: Derive the session key of the target functional module based on the working key.
[0035] The session key (K_Session) is the fourth level in the four-level key security architecture. The session key is derived from the working key and a random number using a key derivation algorithm via a hardware security module. Specifically, the session key for the target functional module is derived using SM3_KDF from the working key and random number of the target functional module. For example, the session key for the BMS is derived from the working key and random number of the BMS, the session key for the PCS is derived from the working key and random number of the PCS, and the session key for the EMS is derived from the working key and random number of the EMS. Because the session key is derived from the working key and random number, it is generated independently for each communication session, implementing a one-time pad secure communication mode. This greatly reduces the risk of key interception or cracking, ensuring that the leakage of a key in any communication session will not affect other sessions, thus improving the security of key management.
[0036] For example, the derivation formula for the session key of each functional module is as follows: K_Session=SM3_KDF(K_Module_Work, "SESSION_KEY" || Nonce); Wherein, K_Session represents the session key of each functional module; K_Module_Work represents the working key of each functional module; "SESSION_KEY" represents the domain separation identifier corresponding to the session key level, representing the level label and domain separation identifier of the session key; Nonce represents a random number.
[0037] In the technical solution of this application embodiment, the key management method of the energy storage system is implemented as follows: First, the hardware security module generates a root key; then, the hardware security module obtains the module identifier of the target functional module, and derives the master key of the target functional module based on the root key and the module identifier; second, the hardware security module derives the working key of the target functional module based on the master key; finally, the hardware security module derives the session key of the target functional module based on the working key. Therefore, it can be seen that by generating a root key through a hardware security module, deriving the master key of the target functional module based on the root key and the module identifier of the target functional module, then deriving the working key of the target functional module based on the master key, and finally deriving the session key of the target functional module based on the working key, a four-level key architecture can be obtained, forming a top-down four-level key derivation chain. This four-level key derivation can achieve hierarchical key security management. By using the module identifier of the target functional module as context input during master key derivation, key domain isolation can be achieved. Even if the root key is leaked, the master keys of different functional modules cannot be derived from each other, and the leak of any functional module does not affect other functional modules. The risk of key leakage can be limited to a single module, preventing the spread of lateral attacks and achieving single-point leakage without propagation, thereby improving the security of key management in energy storage systems.
[0038] In some embodiments, step S120 may include steps S121 and S122.
[0039] Step S121: Obtain the timestamp and preset field separation identifier when the master key is derived; The preset domain separation identifier (“MODULE_MASTER”) is the domain separation identifier corresponding to the master key, representing the hierarchical label and domain separation identifier of the master key. For example, the timestamp when the master key is derived can be the time of the master key's derivation, the derivation period, etc., which can be set according to the actual situation, and no specific limitation is made here.
[0040] Step S122: Use the root key, preset field separation identifier, module identifier and timestamp as input parameters of the key derivation algorithm, and use the key derivation algorithm to derive the master key of the target functional module.
[0041] Specifically, the master key derived from the same functional module based on different timestamps is different. Since the module identifier of the same functional module is the same and unchanging, and the root key and preset field separation identifier are also unchanged, the master key derived from the same functional module at different timestamps is different, thus enhancing the security of key management.
[0042] Specifically, the master key of the target functional module is derived from the root key using SM3_KDF, with the module identifier and timestamp of the target functional module used as context input parameters during the derivation. For example, from the root key, the master key of the BMS is derived by using the module identifier of the BMS, the timestamp during derivation, and the preset field separation identifier as input parameters of SM3_KDF; the master key of the PCS is derived by using the module identifier of the PCS, the timestamp during derivation, and the preset field separation identifier as input parameters of SM3_KDF; and the master key of the EMS is derived by using the module identifier of the EMS, the timestamp during derivation, and the preset field separation identifier as input parameters of SM3_KDF. This achieves key domain isolation, ensuring that the master keys of different functional modules cannot be derived from each other even if the root key is leaked. This prevents the leakage of any functional module from affecting other functional modules, thus limiting the risk of key leakage to a single module, preventing the spread of lateral attacks, and achieving single-point leakage without propagation, which is beneficial to improving the security of key management in energy storage systems. Furthermore, by strongly binding the master key to a specific functional module, a complete key reconfiguration is required when a module is migrated or replaced, thereby enhancing the security of key management.
[0043] Figure 2 This is a schematic diagram of a key derivation process provided in an embodiment of this application. For example, see [link to relevant documentation]. Figure 2 The key derivation process is as follows: First, the HSM hardware security module is initialized. Then, a root key (K_Root) is generated within the HSM. Next, the HSM determines whether this is the first time key derivation has been initiated. If so, the root key share is backed up to each functional module. If it is not the first time, the module identifier of the target functional module is obtained, and the master key of the target functional module is derived according to the master key derivation formula. For example, when the target functional module is BMS, the master key of BMS is BMS_Master; when the target functional module is PCS, the master key of PCS is PCS_Master; when the target functional module is EMS, the master key of EMS is EMS_Master. Then, the HSM derives the working key of the target functional module according to the working key derivation formula. For example, when the target functional module is BMS, the working key of BMS is BMS_Work; when the target functional module is PCS, the working key of PCS is PCS_Work; when the target functional module is EMS, the working key of EMS is EMS_Work. Secondly, the HSM derives the temporary session key for the target functional module based on the session key derivation formula, and derives a shared session key across modules when two modules need to establish secure communication. Finally, the entire key system is ready, and the system begins operation.
[0044] Figure 3 This is a schematic diagram of a four-level derived structure provided in an embodiment of this application. In some embodiments, the root key is stored inside the hardware security module, and the lifespan of the root key corresponds to the lifespan of the hardware security module; the master key is stored in the hardware security module or an encrypted storage area; the working key is stored in protected memory; the session key is stored in temporary memory; the lifespan of the master key is longer than the lifespan of the working key, and the lifespan of the working key is longer than the lifespan of the session key.
[0045] The root key is permanently stored within the hardware security module and never exported; its lifespan is the same as that of the hardware security module. The master key is stored in the hardware security module or an encrypted secure storage area, with a lifespan of several months to several years (the specific number of months or years can be set according to actual needs and is not specifically limited here). The working key is stored in protected memory, with a lifespan of several hours to several days (the specific number of hours or days can be set according to actual needs and is not specifically limited here). The session key is stored only in temporary memory, with a lifespan in minutes (the specific number of minutes can be set according to actual needs and is not specifically limited here). Therefore, by setting different storage locations, lifespans, and derivation algorithms for each level of key, both security and flexibility are balanced.
[0046] Figure 4 This is a flowchart of another key management method for an energy storage system provided in this application embodiment. In some embodiments, when secure communication is required between two functional modules, a shared session key is established through HSM arbitration. The establishment process includes an application phase, a verification phase, a key derivation phase, a distribution phase, a decryption phase, and a channel establishment phase. (See also...) Figure 4 The key management method for the energy storage system further includes the following steps S210 and S220.
[0047] Step S210: In response to the need to establish secure communication between the two functional modules, obtain the first working key of the initiating functional module and the second working key of the target functional module. For example, suppose that secure communication needs to be established between the two functional modules EMS and PCS (i.e., a cross-module secure channel protocol needs to be established). Let EMS be the initiating functional module and PCS be the target functional module. HSM obtains the first working key corresponding to EMS and the second working key corresponding to PCS.
[0048] In some embodiments, the key management method for the energy storage system further includes the following steps: Before obtaining the first working key and the second working key, receive the communication key request instruction sent by the initiator's functional module.
[0049] The communication key request instruction includes the module identifier of the initiator's functional module, the module identifier of the target's functional module, and a random number.
[0050] Specifically, when two functional modules need to communicate securely, during the application phase, the initiating functional module sends a communication key request command to the hardware security module. During the verification phase, upon receiving the communication key request command, the hardware security module verifies whether both the initiating functional module's first working key and the target functional module's second working key are valid. This allows for the subsequent derivation of a shared session key based on the valid working keys of the two functional modules, improving the reliability and effectiveness of cross-module secure communication. For example, if the initiating functional module EMS sends a communication key request command to the hardware security module, the hardware security module, upon receiving the command, will verify whether the working keys of both EMS and PCS are valid.
[0051] Step S220: In response to the fact that both the first working key and the second working key are in a valid state, a shared session key is generated based on the first working key and the second working key.
[0052] Specifically, during the key derivation phase, if the hardware security module verifies that the working keys of both the initiating and target functional modules are valid, a shared session key is generated based on the first and second working keys. In this cross-module secure channel protocol, the hardware security module acts as a trusted third party, avoiding a complex key negotiation process. Furthermore, since the shared session key is derived from the working keys of both parties, any change to the working key of either functional module will automatically invalidate the shared session key, thereby improving the security and reliability of cross-module key communication.
[0053] In some embodiments, the communication key request instruction includes a first identifier of the initiating functional module, a second identifier of the target functional module, and a random number; wherein, the first identifier is the module identifier of the initiating functional module, and the second identifier is the module identifier of the target functional module.
[0054] The above step S220 may also include the following steps: A shared session key is generated using a key derivation algorithm based on the first identifier, the second identifier, the random number, the first working key, and the second working key.
[0055] The formula for generating the shared session key is: K_Shared = SM3_KDF(K_Work_A||K_Work_B, “CROSS_MODULE” || ModuleA_ID ||ModuleB_ID || Nonce); Wherein, K_Shared represents the shared session key; K_Work_A represents the first working key of the initiating functional module; K_Work_B represents the second working key of the target functional module; "CROSS_MODULE" represents the domain separation identifier for cross-module communication; ModuleA_ID represents the first identifier of the initiating functional module; ModuleB_ID represents the second identifier of the target functional module; and Nonce represents a random number.
[0056] In the key derivation phase, the hardware security module further utilizes a key derivation algorithm to derive a shared session key from the first and second working keys. Using the first identifier of the initiating functional module, the second identifier of the target functional module, and a random number as input parameters, the shared session key is derived. Thus, by arbitrating cross-module communication through the hardware security module and establishing a shared session key between modules, security risks during key negotiation and distribution can be reduced, improving the security and reliability of key management.
[0057] In some embodiments, continue reading Figure 4 The key management method for the energy storage system further includes the following steps S230 and S240.
[0058] Step S230: After generating the shared session key, encrypt the shared session key according to the first working key and distribute it to the initiating functional module; During the distribution phase, the hardware security module encrypts the shared session key using the working keys of the initiating functional module and the target functional module, respectively, and then distributes it to both parties.
[0059] Step S240: Encrypt the shared session key according to the second working key and distribute it to the target functional module, so that the initiating functional module can decrypt the shared session key using the first working key, and the target functional module can decrypt the shared session key using the second working key, so as to establish secure communication between the initiating functional module and the target functional module.
[0060] During the distribution phase, the hardware security module encrypts the shared session key using the initiating functional module's working key and distributes it to the initiating functional module. It also encrypts the shared session key using the target functional module's working key and distributes it to the target functional module. During the decryption phase, the initiating functional module decrypts the shared session key using its own working key to obtain the shared session key, and the target functional module decrypts the shared session key using its own working key to obtain the shared session key. Therefore, during the channel establishment phase, both parties can use the shared session key to establish secure communication for encrypted communication, improving the security and reliability of cross-module communication.
[0061] In some embodiments, the root key is not rotated during the lifecycle of the hardware security module; the key management method of the energy storage system may further include the following step S300: In response to the determination that the target key needs to be rotated, the target key is rotated or destroyed and then re-derived according to the key level of the target key, and the lower-level keys derived from the target key are also rotated or destroyed and then re-derived; the target key includes the master key, working key or session key.
[0062] The root key is permanently stored within the hardware security module and is never rotated. The master key, working key, and session key may require rotation, meaning the target key includes at least one of the master key, working key, and session key. When the target key is the master key, its subordinate working keys and session keys are rotated together via a cascading mechanism; when the target key is a working key, its subordinate session keys are destroyed and rebuilt. The target key's key level may be second, third, or fourth level.
[0063] When an energy storage system decides to rotate keys at a certain level, the hardware security module first generates new key material for that level; then, according to cascading rules, it recursively rotates all dependent lower-level keys; simultaneously, it broadcasts key update messages to relevant modules; finally, the energy storage system securely destroys the old keys and records them in the audit log. When it is determined that a target key needs to be rotated, if the target key's key level is at the second or third level, the hardware security module rotates or destroys the target key and then re-derives it, and also rotates or destroys and re-derives the lower-level keys derived from the target key. If the target key's key level is at the fourth level, the hardware security module destroys the target key and then re-derives it. This establishes an automatic triggering relationship between upper-level and lower-level key rotations. For example, when the master key is rotated once, it automatically triggers the rotation of its associated working keys and the reconstruction of the session keys corresponding to each working key, thereby ensuring the consistency of the entire key chain, reducing security vulnerabilities caused by the upper level being updated while the lower level is still using the old key, and improving the security and reliability of key management.
[0064] In some embodiments, step S300 may further include the following steps: In response to the target key being the master key, the master key and the working key directly derived from the master key are rotated, and the session key derived from the working key is destroyed and re-derived.
[0065] The master key is at the second key level. When it is determined that the master key needs to be rotated, the hardware security module rotates the master key and all working keys directly derived from it, and destroys and re-derives session keys derived from these working keys. During this process, if there are shared session keys across modules, the corresponding shared session keys also need to be destroyed and re-derived, meaning the cross-module secure channel needs to be rebuilt. This allows for the automatic triggering of cascading key rotations at lower levels when the master key is rotated, such as automatically triggering the rotation of all its derived working keys, and further triggering the destruction and reconstruction of all session keys, thus improving the consistency of the entire key chain.
[0066] For example, taking an energy storage system comprising three core modules—BMS, PCS, and EMS—the master keys BMS_Master, PCS_Master, and EMS_Master are derived from the root key and the module identifiers of each module. The master key BMS_Master is used to derive multiple working keys for the BMS (e.g., BMS_Work1, BMS_Work2, and BMS_Work3), the master key PCS_Master is used to derive multiple working keys for the PCS (e.g., PCS_Work1 and PCS_Work2), and the master key EMS_Master is used to derive multiple working keys for the EMS (e.g., EMS_Work1, EMS_Work2, EMS_Work3, and EMS_Work4).
[0067] Assuming the BMS master key BMS_Master needs to be rotated, BMS_Master and all working keys directly derived from it (BMS_Work1, BMS_Work2, and BMS_Work3) will be rotated. This will automatically trigger the destruction and re-deriving of session keys derived from BMS_Work1, BMS_Work2, and BMS_Work3 (session keys will be re-derived from the new working keys after the rotation). If there are shared session keys across modules, these shared session keys also need to be destroyed and re-derived; that is, the cross-module secure channel needs to be rebuilt. This allows for the automatic rotation of three working keys and the reconstruction of more than ten session keys when the master key is rotated, improving the consistency of the entire key chain. Automatic channel reconstruction reduces manual intervention, minimizes errors, and enhances automation capabilities.
[0068] In some embodiments, step S300 may further include the following steps: In response to the target key being the working key, the working key is rotated, and the session key derived from the working key is destroyed and re-derived.
[0069] The working key operates at the third key level. When it's determined that the working key needs to be rotated, the hardware security module rotates the working key and destroys all session keys derived from it before regenerating new ones. During this process, if there are shared session keys across modules, these shared session keys also need to be destroyed and regenerated, meaning the cross-module secure channel needs to be rebuilt. This allows for the automatic destruction of all subordinate session keys and the immediate regeneration of new session keys when the working key is rotated, improving the consistency of the entire key chain. Furthermore, automatic channel reconstruction reduces manual intervention, minimizes errors, and enhances automation capabilities.
[0070] For example, if a working key PCS_Work2 of a PCS needs to be rotated, then PCS_Work2 will be rotated, all session keys derived from PCS_Work2 will be destroyed, and a new session key will be immediately derived from the new PCS_Work2 after the rotation.
[0071] In some embodiments, step S300 may further include the following steps: In response to the target key being a session key, the session key is destroyed and a new one is derived.
[0072] The session key has a fourth-level key hierarchy. When it is determined that the session key needs to be rotated, the hardware security module destroys the session key and then regenerates a new one. During this process, if there are shared session keys across modules, the corresponding shared session keys also need to be destroyed and regenerated, meaning the cross-module secure channel needs to be rebuilt. This ensures that when the session key rotates, only the current session itself is destroyed and rebuilt, without affecting the higher-level keys, thus improving the security and reliability of key management.
[0073] Figure 5 This is a schematic diagram of a cascaded rotation propagation chain provided in an embodiment of this application. For example, see [link to relevant documentation]. Figure 5 The propagation chain of cascading rotation includes: master key rotation automatically triggers cascading working key rotation, working key rotation automatically triggers session key destruction and reconstruction, session key destruction and reconstruction, and corresponding cross-module security channel reconstruction.
[0074] In some embodiments, the key management method of the energy storage system further includes the following steps S410 and S420.
[0075] Step S410: In response to the need for the target key to be rotated, the new key after rotation and the old key before rotation are effectively coexisted by a preset coexistence period; The preset coexistence period is used to provide a coexistence period for the new and old keys during key rotation. During the preset coexistence period, the old key can still be used for decryption. For example, the preset coexistence period is 24 hours, but it can also be set to other values. The specific setting can be determined according to actual needs, and no specific limitation is made here.
[0076] Step S420: After the preset coexistence period ends, destroy the old key.
[0077] Specifically, when the target key needs to be rotated, the hardware security module distributes the new key to the corresponding target functional module. A preset coexistence period set by the energy storage system ensures that the new key and the old key can coexist effectively. After the preset coexistence period ends, the energy storage system destroys the old key. This allows both the old and new keys to be valid during the rotation process without interrupting services. Furthermore, the old key can still be decrypted during the coexistence period, facilitating the recording of historical data from the energy storage system. Destroying the old key after the coexistence period reduces the security risks associated with indefinite retention of old keys and improves the security of key management.
[0078] For example, the following Embodiment 1 uses a grid-side large-capacity energy storage system as an example to illustrate the implementation process of its cascaded switching and cross-module safety channels.
[0079] Example 1 Assume a 100MW / 200MWh grid-side energy storage power station comprising multiple energy storage units, each consisting of three modules: BMS, PCS, and EMS. The power station uses an HSM supporting Chinese national cryptographic algorithms. Each module is implemented based on a high-performance microcontroller unit (MCU), a digital signal processor (DSP), and an industrial control computer, respectively. The communication network is gigabit Ethernet. Key cascading and rotation, as well as secure cross-module communication, are required to ensure the secure transmission of grid dispatch commands. The configuration parameters of the energy storage power station are shown in Table 1.
[0080] Table 1: Configuration Parameters of Energy Storage Power Station
[0081] The implementation process of key cascading and rotation and cross-module secure communication in this energy storage power station includes the following steps: Step 1: System Initialization and Level 4 Key Derivation. During initialization, the HSM generates a root key, and then, based on the preset field separation identifier "MODULE_MASTER" context, module identifier (e.g., "BMS_UNIT01"), and initialization timestamp, derives master keys for the three modules of each energy storage unit. Working keys are then derived sequentially based on the master keys, and these working keys are encrypted and distributed to each module. The initialization phase includes the following steps: The first step is to power on the HSM hardware module and perform a self-test; The second step is to generate the root key K_Root and store it in the HSM secure storage area. The third step is the derivation of the master keys for each module (BMS, PCS, EMS), and the derivation formula is as follows: K_Module_Master=SM3_KDF(K_Root, "MODULE_MASTER" || Module_ID ||Timestamp); The fourth step is to derive the working keys for each module (BMS, PCS, EMS). The derivation formula is as follows: K_Module_Work = SM3_KDF(K_Module_Master, "WORK_KEY" || Sequence_ID); The fifth step is to dynamically generate the session key, whose derivation formula is as follows: K_Session = SM3_KDF(K_Module_Work, "SESSION_KEY" || Nonce).
[0082] Step 2: Establish a cross-module secure channel. For example, when the EMS needs to issue a power grid dispatch command to the PCS (i.e., secure communication between the EMS and PCS needs to be established), the EMS requests a communication key from the HSM for communication with the PCS. After verifying the validity of the working keys of both parties, the HSM derives a shared session key, encrypts it using its own working key, and distributes it. Both parties decrypt to obtain the shared session key, and then the EMS uses the shared session key to encrypt the dispatch command and send it to the PCS. The PCS decrypts and executes it. For example, if the EMS needs to issue a power grid dispatch command (active power regulation) to the PCS, establishing a secure channel through HSM arbitration specifically includes the following steps: The first step is that module A initiates a communication request with module B, that is, EMS requests a communication key from HSM for PCS.
[0083] The second step is for the HSM to verify the validity of the working keys of both parties, that is, to verify whether the working keys of both parties are in a valid state.
[0084] The third step is to generate a shared session key after verifying that both parties' working keys are valid.
[0085] The fourth step is for HSM to encrypt and distribute the shared session key separately, encrypting the shared session key with the working key of each module before distributing it.
[0086] Fifth step: Both parties decrypt to obtain the shared session key.
[0087] The sixth step involves EMS using a shared session key for secure communication, meaning that EMS issues scheduling instructions through a secure channel.
[0088] Step 3: Annual Master Key Rotation (Cascading). During the annual master key rotation, the hardware security module automatically derives a new master key (using a new timestamp), and then immediately triggers the rotation of all working keys (serial number increment). The energy storage system destroys all session keys based on the old working key. The energy storage system sets a 24-hour coexistence period for the old and new keys (i.e., a preset coexistence period), during which the old key can still decrypt historical data. After the preset coexistence period ends, the old key is completely deleted. The entire cascading rotation process is completed automatically without manual intervention, which is beneficial for achieving key chain consistency. Furthermore, the cross-module secure channel is automatically rebuilt by the HSM after rotation. For example, taking time-triggered rotation as an example, assuming the master key needs to be rotated after one year of use, the rotation process includes the following steps: The first step is for the hardware security module to determine the rotating key level based on the time-triggered conditions and derive a new master key (modular context binding).
[0089] The second step involves the hardware security module generating new key material for cascading rotation, which derives a new working key from the new master key.
[0090] The third step involves the hardware security module performing a cascading rotation, which derives a new working key and destroys the old session key.
[0091] The fourth step is for the hardware security module to distribute the new key to the target functional module. The new key after the rotation and the old key before the rotation will coexist for a preset coexistence period (24 hours), and the old key can still be decrypted.
[0092] The fifth step is to destroy the old key by deleting it after the preset coexistence period ends.
[0093] The sixth step is for the energy storage system to record audit logs of the cascading rotation.
[0094] Therefore, by rotating the master key once through the hardware security module when the master key needs to be rotated, the rotation of three working keys and the reconstruction of more than ten session keys can be automatically driven, which is conducive to achieving the consistency of the entire key chain. By arbitrating cross-module communication with HSM, the security risks in the key negotiation and distribution process can be reduced, and the security and reliability of cross-module communication can be improved. Furthermore, by making the keys of each module independent through modular context binding, the leakage of any module will not affect other modules, achieving single point leakage without propagation, which is conducive to improving the security and reliability of key management.
[0095] In some embodiments, step S300 may further include the following steps: In response to the detection of at least one of a security anomaly event, a periodic triggering event, and a key update request event, it is determined that the target key needs to be rotated.
[0096] The triggering events for the target key to be rotated include security event triggers (such as security anomalies), time-based triggers (such as periodic triggers), and key update request event triggers. Security event triggers include: key leakage risks (e.g., side-channel attacks, trusted execution environment anomalies, key access mode anomalies), HSM anomalies (e.g., self-test failures, temperature / voltage anomalies, random number generator anomalies), system intrusions (e.g., unauthorized access, firmware tampering, malware execution), and consecutive module authentication failures reaching a threshold. Time-based triggers include: master key timed rotation cycle, working key timed rotation cycle, and session key timeout. Time-based triggers execute corresponding cascading rotations according to preset cycles.
[0097] Among them, the detection of security anomalies, periodic triggered events, and key update request events can be performed by the security monitoring module. The security monitoring module can be integrated into the HSM chip or it can be a separate module set up in the energy storage system alongside the HSM. The specific configuration can be determined according to the actual situation, and no specific limitations are made here.
[0098] In this embodiment, a key rotation check is used to determine whether key rotation is necessary. The key rotation check can be performed by a security monitoring module. The key rotation check includes time-triggered checks, event-triggered checks, and module request checks. In the time-triggered check, if a periodic triggering event is detected, the target key needs to be rotated. In the event-triggered check, if a security anomaly is detected, the target key needs to be rotated. In the module request check, if a key update request is detected, the target key needs to be rotated. Therefore, this embodiment combines proactive security event response (millisecond-level instant triggering) with periodic proactive maintenance (preset periodic triggering), while also supporting manual update triggering by maintenance personnel as needed. These three triggering conditions complement each other, ensuring that keys can be rotated promptly in any scenario requiring an update. This satisfies security compliance requirements and provides immediate response capabilities to sudden security threats, reducing the shortcomings of related technologies that rely solely on operational parameter thresholds for triggering and cannot respond to security events in a timely manner, thus improving the immediate response capability to security events.
[0099] Figure 6 This is a schematic diagram illustrating the overall process of key rotation checking and cascading rotation provided in an embodiment of this application. For example, see [link to relevant documentation]. Figure 6The overall implementation process of key rotation checking and cascading rotation is as follows: First, key rotation checking determines whether rotation needs to be triggered. For example, time-triggered checks (e.g., timed rotation cycles) detect periodic triggering events, event-triggered checks (e.g., security event detection) detect security anomalies, and module request checks (e.g., module key updates) detect key update request events. If at least one of these three types is detected, rotation needs to be triggered. After determining that rotation needs to be triggered, the trigger type is further determined (i.e., the key level of the target key to be rotated). Trigger types include master key rotation, working key rotation, and session key destruction and reconstruction. After determining the trigger type, cascading rotation is further determined based on the trigger type. If rotation is required, the trigger type is either master key or working key. If the trigger type is master key, all lower-level working key rotations are triggered; if the trigger type is working key, all lower-level session key destruction and reconstruction are triggered. Then, key updates are performed to generate new keys. The new keys are distributed to the target functional modules or target components. The old key is destroyed and a key rotation log is recorded, thus completing the key rotation.
[0100] In some embodiments, the key management method for the energy storage system further includes the following step S500: In response to the detection of a security anomaly, the target key is determined based on the risk level of the security anomaly.
[0101] Different levels of security anomalies trigger different levels of key rotation. Based on the risk level of the detected security anomalies, the target key to be rotated can be determined, enabling differentiated responses to security anomalies. This reduces the resource waste caused by full rotation for all security events, allowing the system to deploy the most comprehensive protection (full rotation) when high-risk events occur, and to take a lightweight response (partial rotation) when low-risk events occur, thereby improving the accuracy of security response and the efficiency of resource utilization.
[0102] In some embodiments, the risk level includes a high-risk event level, a medium-risk event level, and a low-risk event level; the above step S500 may also include the following steps S510 to S530.
[0103] Step S510: In response to the security anomaly being classified as a high-risk event, determine the target key as the master key; Step S520: In response to the security anomaly being classified as a medium-risk event, the target key is determined to be the working key; Step S530: In response to the security anomaly being classified as a low-risk event, the target key is determined to be the session key.
[0104] Among them, the risk levels of safety anomalies are divided into high-risk, medium-risk, and low-risk event levels.
[0105] High-risk events include: detection of side-channel attack indications (e.g., power consumption analysis, electromagnetic analysis, timing attacks, etc.), failure of HSM critical self-test (e.g., random number generator malfunction, hardware integrity verification failure, temperature / voltage exceeding safety thresholds and suspected attack), detection of key leakage (e.g., key appearing in unauthorized memory areas, abnormal key access patterns), successful system intrusion (e.g., unauthorized acquisition of root / administrator privileges, firmware tampering, malicious code execution), and breach of the Trusted Execution Environment (TEE) security boundary.
[0106] Medium-risk events include: consecutive failures of inter-module authentication reaching a threshold (e.g., 5 consecutive authentication failures, suspected brute-force attack), detection of abnormal communication patterns (e.g., unauthorized connection attempts, signs of replay attacks), non-critical self-test alarms of HSM (e.g., non-security-related temperature / voltage fluctuations, non-core function abnormalities), and firmware signature verification abnormalities that have not been tampered with (e.g., verification retry, version rollback attempts).
[0107] Low-risk events include: a single session being abnormally disconnected or timed out, a single authentication failure (e.g., failure to reach the continuity threshold), detection of non-persistent abnormal messages (e.g., incorrect formatting, duplicate random numbers, etc.), and normal expiration of the session key lifecycle.
[0108] Different risk levels correspond to different rotation levels. High-risk events have the largest impact but the lowest probability of occurrence, while low-risk events have the smallest impact but the most frequent response times, thus achieving a balance between security and system overhead. Specifically, when a security anomaly is classified as a high-risk event, a master key rotation is triggered, automatically cascading to rotate both the working key and session key. When a security anomaly is classified as a medium-risk event, a working key rotation is triggered, automatically cascading to rotate the session key. When a security anomaly is classified as a low-risk event, only the session key rotation is triggered. Therefore, by dividing the risk level into three levels—high-risk, medium-risk, and low-risk—and using the master key, working key, and session key as target keys respectively, a precise mapping relationship between the three risk levels and the three key levels is established. High-risk events trigger the highest level below the root key (i.e., the master key and cascade all its subordinate levels), achieving comprehensive security isolation; medium-risk events trigger the middle level (i.e., the working key and session key), blocking lateral movement without shaking the foundation; and low-risk events only trigger the lowest level (i.e., the session key). This allows for the rapid elimination of security threats at minimal cost, forming a clear and executable risk-driven rotation decision chain, which is conducive to improving the accuracy of security response and the reliability of key management.
[0109] For example, the following Embodiment 2 uses an industrial and commercial energy storage system as an example to illustrate the implementation process of real-time rotation triggered by a safety event.
[0110] Example 2 Assume a 500kW / 1MWh commercial and industrial energy storage system is deployed in an industrial park. The system integrates an Intrusion Detection System (IDS) and Health Monitoring System (HSM). If a security anomaly is detected during system operation, a key rotation needs to be triggered immediately. The configuration parameters of this commercial and industrial energy storage system are shown in Table 2.
[0111] Table 2: Configuration Parameters for Industrial and Commercial Energy Storage Systems
[0112] The implementation process of instantaneous key rotation for this industrial and commercial energy storage system includes the following steps: Step 1: Security Incident Detection and Classification. A security monitoring module is configured to continuously monitor HSM temperature, random number generator health status, hardware integrity, key access frequency, signs of side-channel attacks, unauthorized access, firmware tampering, and the number of module authentication failures.
[0113] The security monitoring module continuously detects HSM anomalies, key access frequency, signs of side-channel attacks, unauthorized access, firmware tampering, and the number of module authentication failures. For example, during system operation, the security monitoring module continuously detects the following events: First, HSM anomaly detection, including temperature anomalies, abnormal health status of the random number generator, and hardware integrity anomalies.
[0114] Second, key leakage risk detection.
[0115] Third, system intrusion detection.
[0116] Fourth, module authentication fails, such as five consecutive authentication failures.
[0117] When a key leakage risk is detected (i.e., a security anomaly is detected), the rotation scope (i.e., the target key to be rotated) needs to be determined according to the event level (i.e., the risk level of the security anomaly). For high-risk events, the master key, working key, and session key are rotated; for medium-risk events, the working key and session key are rotated; and for low-risk events, only the session key is rotated.
[0118] Step 2: Immediate Rotation Triggered by High-Risk Events. Suppose that during a certain operation, the system detects an abnormal key access pattern (e.g., frequency far exceeding the normal range) and determines it as a high-risk event, then the working key and session key need to be rotated.
[0119] The energy storage system immediately initiates a rotation process, which involves the HSM generating new working keys (using new sequence numbers and timestamps) for the BMS, PCS, and EMS. Then, all session keys are cascaded and destroyed, and session keys are immediately rebuilt based on the new working keys. Simultaneously, all cross-module secure channels are re-established through HSM arbitration. The energy storage system also records event details and rotation actions through audit logs.
[0120] Step 3: Emergency Response to HSM Anomalies (High-Risk Events). This includes the following steps: The first step is to detect an anomaly in the HSM random number generator (which is a high-risk event) and perform a full rotation (i.e., rotate the master key, working key, and session key) to isolate it from the HSM.
[0121] The second step is for the energy storage system to immediately isolate the HSM and stop accepting new key generation requests.
[0122] The third step is to derive a new working key from the existing master key using deterministic derivation (which does not rely on random numbers).
[0123] The fourth step is to complete the cascading rotation and full session key channel reconstruction.
[0124] The fifth step is to send an alert to the administrator, suggesting that the HSM hardware be replaced.
[0125] Step 6: After the HSM returns to normal, the energy storage system is deisolated and all master keys and subordinate keys are re-derived from the root key to achieve a complete rotation.
[0126] Therefore, proactive security detection and real-time rotation, with response times in the millisecond range rather than passively waiting for accumulated operational parameters, improves the accuracy of security responses and the reliability of key management. During rotation, cascading rotation ensures the complete consistency of the key chain. In the event of an anomaly in the HSM (Hardware Management System) portion, deterministic derivation is used as an emergency measure to maintain basic system security. Furthermore, cross-module secure channels are automatically rebuilt after rotation to ensure business continuity.
[0127] In some embodiments, the key management method of the energy storage system further includes the following steps S610 and S620.
[0128] Step S610: In response to the corruption of the master key, and having collected at least a preset number of shares from the shares of the master key distributed in multiple physical storage locations, the master key is reconstructed using a secret sharing recovery algorithm; In response to the corruption of the working key, and having collected at least a preset number of shares from the shares of the working key distributed in multiple physical storage locations, the working key is reconstructed using a secret sharing recovery algorithm. After the master key is derived, the energy storage system uses Shamir secret sharing to split the master key into multiple (e.g., N) shares for backup, which are then distributed and stored in different physical locations (e.g., within the HSM, locally on each module, and in the cloud). When recovery is needed, the energy storage system automatically collects the available shares. Shamir refers to the Shamir secret sharing scheme, a cryptographic method that splits a secret (such as a password or key) into multiple "fragments" and distributes them among multiple people. At least t fragments (a threshold value) are required to recover the original secret; fewer than t fragments will not yield any information. This method is commonly used to improve the security and disaster recovery capabilities of key management.
[0129] Similarly, after the working key is derived, the energy storage system uses Shamir secret sharing to split the working key into multiple (e.g., 5) shares for backup. For example, these 5 shares are stored respectively on the cloud HSM, local BMS Flash, local PCSFlash, cloud backup server, and the Original Equipment Manufacturer (OEM) security server. When the working key is lost due to damage to the local Flash of a device's BMS, the system automatically collects the available shares.
[0130] Step S620: In response to the number of shares of the master key being less than a preset number, a new master key is derived from the root key; in response to the number of shares of the working key being less than a preset number, a new working key is derived from the master key.
[0131] Because the HSM is protected at the hardware level, it is permanently indestructible, and the root key is never recovered. For the master key, when it is damaged, the HSM preferentially uses Shamir secret sharing for recovery. That is, when recovery is needed, the HSM collects at least a predetermined number (e.g., K, K≤N) of shares from the master key's shares distributed across multiple physical storage locations and reconstructs the master key using a secret sharing recovery algorithm (e.g., using Lagrange interpolation). If the number of shares collected from the master key's shares distributed across multiple physical storage locations is insufficient (e.g., less than the predetermined number K), it is downgraded to deriving a new master key from the root key. For the working key, when it is damaged, the HSM preferentially uses Shamir secret sharing for recovery. That is, when recovery is needed, it collects at least a predetermined number (e.g., K, K≤N) of shares from the working key's shares distributed across multiple physical storage locations and reconstructs the working key using a secret sharing recovery algorithm (e.g., using Lagrange interpolation). If the number of shares collected from the working key's shares distributed across multiple physical storage locations is insufficient (e.g., less than the predetermined number K), it is downgraded to deriving a new working key from the master key. Therefore, when the master key or working key is damaged, the HSM collects at least a preset number of key shares distributed across multiple physical storage locations and reconstructs the key using a secret sharing recovery algorithm, achieving high-availability recovery of the damaged key. This ensures that even if some shares are lost due to storage media failure, the key can be fully recovered as long as the preset number of collected shares is reached. Simultaneously, when the number of collectable shares is insufficient, the master key is re-derived from the root key, and the working key is re-derived from the master key, forming a complete degradation recovery chain. This allows the system to self-heal even in extreme cases (such as the simultaneous loss of multiple shares). Thus, by setting multi-level recovery strategies and degradation schemes, the system can continue to operate even when the key is damaged or the HSM is abnormal, improving the system's disaster recovery capabilities and operational reliability.
[0132] In some embodiments, the key management method for the energy storage system further includes the following steps: In response to a corrupted session key, the session key is destroyed and a new session key is derived from the working key.
[0133] When a session key is corrupted, the HSM (Host Secret Management System) directly destroys it and regenerates it (i.e., regenerates it based on the working key and a new random number). Thus, by directly destroying the old session key and regenerating a new one from the working key when the session key is corrupted, lightweight and fast session key recovery is achieved without involving Shamir share collection and secret share reconstruction; it can be completed with just one KDF (Knowledge Defender) operation, improving recovery speed. Furthermore, this recovery operation only affects the session key itself, without affecting the working key or master key, enabling rapid communication recovery without impacting the upper-level key system, thus improving the reliability of key management.
[0134] Figure 7 This is a schematic diagram illustrating the overall process of key corruption detection and recovery provided in an embodiment of this application. For example, see [link to relevant documentation]. Figure 7 The overall process for key corruption detection and recovery is as follows: First, the energy storage system performs key corruption detection, such as integrity verification (Keyed-hash Message Authentication Code (HMAC) / signature verification). Then, it determines whether the key is corrupted. If it is not corrupted, it continues to operate normally. If it is corrupted, it further determines the corruption type. Corruption types include master key corruption, working key corruption, or session key corruption. If the corruption type is master key corruption, Shamir recovery is required, i.e., the Shamir recovery protocol is initiated, and the energy storage system collects K secret shares (i.e., key shares). The energy storage system determines whether K key shares have been collected. If so, the HMAC reconstructs the master key using Lagrange interpolation and cascades and updates all working keys and session keys. If K key shares have not been collected, the HMAC derives a new master key from the root key and cascades and updates all working keys and session keys based on the new master key. After the update, it verifies the key recovery result (i.e., integrity verification). If the recovery is successful, the recovery is complete. If recovery fails, a new key is generated using a downgrade strategy. The energy storage system will record the security event log and notify the administrator for manual intervention.
[0135] If the corruption type is working key corruption, Shamir recovery is required. This involves initiating the Shamir recovery protocol, where the energy storage system collects K secret shares (i.e., key shares). The energy storage system determines whether K key shares have been collected. If so, the HSM reconstructs the working key using Lagrange interpolation and updates all session keys in a cascading manner. If no K key shares have been collected, the HSM derives a new working key from the master key and updates all session keys in a cascading manner based on the new working key. After the update, the key recovery result is verified (i.e., integrity check). If the recovery is successful, the recovery is complete. If the recovery fails, a degradation strategy is used to derive a new key, and the energy storage system records the security event log and notifies the administrator for manual intervention.
[0136] If the corruption type is a session key, the HSM immediately rebuilds the session key. After the update, it verifies the key recovery result (i.e., integrity check). If the recovery is successful, the recovery is complete. If the recovery fails, a degradation strategy is used to derive a new key, and the energy storage system records the security event log and notifies the administrator for manual intervention.
[0137] For example, the following Embodiment 3 uses a distributed residential energy storage cluster as an example to illustrate the implementation process of its modular key context binding and key recovery.
[0138] Example 3 Assume a residential energy storage brand manages 5000 distributed residential energy storage systems (10kW / 20kWh each). Each device includes two modules: BMS and PCS. There is no local EMS; the cloud platform acts as the EMS. Key management service is provided in the form of cloud-based KMS service, with key protection provided by a cloud-based hardware security module. Each device communicates with the cloud via 4G / WiFi. Clustered key management and remote key recovery are required. The parameter configuration of this distributed residential energy storage system is shown in Table 3.
[0139] Table 3: Parameter Configuration Table for Distributed Residential Energy Storage Systems
[0140] For example, the specific implementation process of clustered key management and remote key recovery in this distributed residential energy storage system includes the following steps: Step 1: Cluster Initialization and Modular Key Context Binding. During initialization, the cloud-based HSM derives an independent BMS master key and PCS master key for each device based on its unique serial number (e.g., "ESS-2026-HH-0001"). In the derivation formula, Module_ID is either "BMS_" plus the device serial number or "PCS_" plus the device serial number. This ensures that the keys for different devices are completely independent, and even if the working key of one device is leaked, it is impossible to deduce the keys for any other device.
[0141] Step 2: Working Key Derivation and Shamir Backup. After the working key is derived, the energy storage system uses Shamir secret sharing to split the working key into 5 shares, with a preset quantity of 3. These 5 shares are stored respectively on: cloud HSM, local BMS Flash, local PCS Flash, cloud backup server, and OEM security server. When the working key is lost due to damage to the local Flash of a device's BMS, the energy storage system automatically collects the available shares.
[0142] Step 3: Recovery of Damaged Working Key. Assuming the local BMS share is damaged, but the cloud HSM share, local PCS share, and cloud backup share are all intact, three shares can be collected, and the working key can be successfully recovered using Lagrange interpolation. If, due to extreme circumstances, there are insufficient shares (e.g., multiple shares are lost simultaneously), a new working key is derived using the master key, and new Shamir shares are regenerated and distributed.
[0143] Step 4: Key domain isolation verification, the specific implementation process is as follows: Simulated attack scenario: Assume that the BMS working key of device 0001 has been leaked.
[0144] The attacker attempted to deduce the key for device 0002 using K_BMS_Work_0001.
[0145] Attempt 1: Deriving the BMS working key for device 0002 – failed; K_BMS_Work_0002 = SM3_KDF(K_BMS_Master_0002, "WORK_KEY" || SEQ_001); K_BMS_Master_0002 is required, but K_BMS_Master_0002 is derived from a separate KDF and is unrelated to K_BMS_Work_0001.
[0146] Attempt 2: Deriving the PCS working key for device 0001 – failed; K_PCS_Work_0001 = SM3_KDF(K_PCS_Master_0001, "WORK_KEY" || SEQ_001); K_PCS_Master_0001 is required, which is derived from K_Root and "PCS_"||Device_ID and is independent of the BMS key.
[0147] Conclusion: Modular key context binding ensures that a single point of leakage does not spread.
[0148] The embodiments of this application demonstrate that key isolation in a cluster environment using modular context binding can be achieved: keys for 5000 devices are bound by device serial numbers, ensuring they are independent of each other. Simultaneously, distributed Shamir backup provides high availability; even if a single module storage fails, the key can still be recovered from shares in other locations.
[0149] Figure 8 This is a schematic diagram illustrating the overall process of deriving a four-level key architecture for an energy storage system according to an embodiment of this application. For example, taking an energy storage system comprising three modules: BMS, PCS, and EMS, see [reference needed]. Figure 8The overall process of deriving the four-level key architecture of this energy storage system is as follows: The first-level L0 root key (K_Root) is physically and randomly generated by the hardware security module, permanently stored in the HSM, cannot be exported, and is not rotated. The master key is the second-level L1 key, which is derived from the root key (K_Root), the module identifier of the BMS, and the timestamp when the BMS master key is derived. The BMS master key (K_BMS_Master) is derived using SM3_KDF according to the master key derivation formula (SM3_KDF(K_Root,"MODULE_MASTER"||"BMS"||TS)). The BMS master key is stored in the HSM and rotated annually. Based on the root key (K_Root), the module identifier of the PCS, and the timestamp when the PCS master key was derived, the master key (K_PCS_Master) of the PCS is derived using SM3_KDF according to the master key derivation formula (SM3_KDF(K_Root, "MODULE_MASTER"||"PCS"||TS)). The PCS master key is stored in the HSM and rotated annually. Similarly, based on the root key (K_Root), the module identifier of the EMS, and the timestamp when the EMS master key was derived, the master key (K_EMS_Master) of the EMS is derived using SM3_KDF according to the master key derivation formula (SM3_KDF(K_Root, "MODULE_MASTER"||"EMS"||TS)). The EMS master key is stored in the HSM and rotated annually. These three master keys are bound by a modular context, are independent of each other, and cannot be mutually derived, ensuring that a single point of leakage does not propagate, thus improving the security of key management in the energy storage system.
[0150] The working key is a Level 3 (L2) key. The HSM uses the master key to encrypt the working key and distributes it to each module. Each module decrypts it and stores it in a secure storage area. Specifically, based on the BMS master key (K_BMS_Master), the BMS working key (K_BMS_Work) is derived using SM3_KDF according to the working key derivation formula (SM3_KDF(K_BMS_Master, "WORK_KEY"||SEQ)). The BMS working key is stored in a secure storage area and rotated quarterly. Based on the PCS master key (K_PCS_Master), the PCS working key (K_PCS_Work) is derived using SM3_KDF according to the working key derivation formula (SM3_KDF(K_PCS_Master, "WORK_KEY"||SEQ)). The PCS working key is stored in a secure storage area and rotated quarterly. Based on the EMS master key (K_EMS_Master), the working key (K_EMS_Work) is derived using SM3_KDF according to the working key derivation formula (SM3_KDF(K_EMS_Master, "WORK_KEY"||SEQ)). The EMS working key is stored in a secure storage area and rotated quarterly. After the working key is derived, it is split into 5 shares for backup using Shamir secret sharing, for example, backed up on HSM, BMS Flash, PCS Flash, the cloud, and OEM.
[0151] The session key is Level 4 (L3), and the intra-module session key is derived unilaterally. For example, based on the BMS's working key (K_BMS_Work), the intra-module session key (K_Session_BMS) of the BMS is derived using SM3_KDF according to the session key derivation formula (SM3_KDF(K_BMS_Work,"SESSION_KEY"||Nonce)). The BMS uses its intra-module session key for internal communication and stores the session key in RAM, destroying it after use. Based on the PCS's working key (K_PCS_Work), the intra-module session key (K_Session_PCS) of the PCS is derived using SM3_KDF according to the session key derivation formula (SM3_KDF(K_PCS_Work, "SESSION_KEY"||Nonce)). The PCS uses its intra-module session key for internal communication and stores the session key in RAM, destroying it after use. Based on the EMS working key (K_EMS_Work), the EMS module intra-module session key (K_Session_EMS) is derived using SM3_KDF according to the session key derivation formula (SM3_KDF(K_EMS_Work, "SESSION_KEY"||Nonce)). The EMS uses the intra-module session key to realize internal communication and stores the session key in RAM, which is destroyed after use.
[0152] When a cross-module shared session key needs to be established, the HSM arbitrates, and the working keys of both parties are jointly derived. The establishment process is as follows: First, Module A (i.e., the initiating functional module) requests the key. Then, the HSM verifies the working keys of both parties (i.e., the initiating functional module and the target functional module). Next, the HSM derives the shared session key. Then, the HSM encrypts the shared session key using Module A's working key and distributes it to Module A; the HSM also encrypts the shared session key using Module B's (i.e., the target functional module) working key and distributes it to Module B. Finally, a secure channel is established.
[0153] It is understood that the key management method for energy storage systems provided in this application generates a root key through a hardware security module, derives a master key for the target functional module based on the root key and the module identifier of the target functional module, then derives a working key for the target functional module based on the master key, and finally derives a session key for the target functional module based on the working key, thereby obtaining a four-level key security architecture. Hierarchical key security management can be achieved through four-level key derivation. By using the module identifier of the target functional module as context input during master key derivation, key domain isolation can be achieved. Even if the root key is leaked, the master keys of different functional modules still cannot be derived from each other, and the risk of key leakage can be limited to a single module to prevent the spread of lateral attacks, thereby improving the security of key management in energy storage systems.
[0154] Figure 9 This is a schematic block diagram of a key management device for an energy storage system provided in an embodiment of this application. This application also provides a key management device for an energy storage system, see below. Figure 9 The key management device 10 of the energy storage system includes: a generation module 11 for generating a root key; an acquisition module 12 for acquiring the module identifier of a target functional module; a first derivation module 13 for deriving the master key of the target functional module based on the root key and the module identifier; a second derivation module 14 for deriving the working key of the target functional module based on the master key; and a third derivation module 15 for deriving the session key of the target functional module based on the working key.
[0155] The technical solution of this application provides a key management device for an energy storage system. A root key is generated through a hardware security module. A master key for the target functional module is derived from the root key and the module identifier of the target functional module. Then, a working key for the target functional module is derived from the master key. Finally, a session key for the target functional module is derived from the working key, thus obtaining a four-level key security architecture. This four-level key derivation enables hierarchical key security management. By using the module identifier of the target functional module as context input during master key derivation, key domain isolation can be achieved. Even if the root key is leaked, the master keys of different functional modules cannot be mutually derived, and the risk of key leakage can be limited to a single module, preventing the spread of lateral attacks, thereby improving the security of key management in the energy storage system.
[0156] In some embodiments, the first derived module 13 is further configured to: Obtain the timestamp and preset field separation identifier used when the master key is derived; The root key, preset field separation identifier, module identifier, and timestamp are used as input parameters for the key derivation algorithm to derive the master key of the target functional module. The master key derived from the same functional module based on different timestamps will be different.
[0157] In some embodiments, the key management device 10 of the energy storage system is further configured to: In response to the need to establish secure communication between the two functional modules, the first working key of the initiating functional module and the second working key of the target functional module are obtained. In response to the fact that both the first working key and the second working key are in a valid state, a shared session key is generated based on the first working key and the second working key.
[0158] In some embodiments, the key management device 10 of the energy storage system is further configured to: Before obtaining the first working key and the second working key, receive the communication key request instruction sent by the initiator's functional module.
[0159] In some embodiments, the communication key request instruction includes a first identifier of the initiating functional module, a second identifier of the target functional module, and a random number; the key management device 10 of the energy storage system is further configured to: A shared session key is generated using a key derivation algorithm based on the first identifier, the second identifier, the random number, the first working key, and the second working key.
[0160] In some embodiments, the key management device 10 of the energy storage system is further configured to: After generating the shared session key, the shared session key is encrypted according to the first working key and distributed to the initiating functional module; The shared session key is encrypted using the second working key and distributed to the target functional module, so that the initiating functional module can decrypt the shared session key using the first working key, and the target functional module can decrypt the shared session key using the second working key, thereby establishing secure communication between the initiating functional module and the target functional module.
[0161] In some embodiments, the root key is not rotated during the lifecycle of the hardware security module; the key management device 10 of the energy storage system is also used for: In response to the determination that the target key needs to be rotated, the target key is rotated or destroyed and then re-derived according to the key level of the target key, and the lower-level keys derived from the target key are also rotated or destroyed and then re-derived; the target key includes the master key, working key or session key.
[0162] In some embodiments, the key management device 10 of the energy storage system is further configured to: In response to the target key being the master key, the master key and the working key directly derived from the master key are rotated, and the session key derived from the working key is destroyed and re-derived.
[0163] In some embodiments, the key management device 10 of the energy storage system is further configured to: In response to the target key being the working key, the working key is rotated, and the session key derived from the working key is destroyed and re-derived.
[0164] In some embodiments, the key management device 10 of the energy storage system is further configured to: In response to the target key being a session key, the session key is destroyed and a new one is derived.
[0165] In some embodiments, the key management device 10 of the energy storage system is further configured to: In response to the detection of at least one of a security anomaly event, a periodic triggering event, and a key update request event, it is determined that the target key needs to be rotated.
[0166] In some embodiments, the key management device 10 of the energy storage system is further configured to: In response to the detection of a security anomaly, the target key is determined based on the risk level of the security anomaly.
[0167] In some embodiments, the risk levels include high-risk event levels, medium-risk event levels, and low-risk event levels; the key management device 10 of the energy storage system is further used for: In response to a security anomaly being classified as a high-risk event, the target key is determined to be the master key. In response to a security anomaly classified as a medium-risk event, the target key is determined to be the working key. In response to a security anomaly classified as a low-risk event, the target key is determined to be the session key.
[0168] In some embodiments, the key management device 10 of the energy storage system is further configured to: In response to the need to rotate the target key, a preset coexistence period is used to ensure that the new key after rotation and the old key before rotation can coexist effectively. The old key is destroyed after the preset coexistence period ends.
[0169] In some embodiments, the key management device 10 of the energy storage system is further configured to: In response to a corrupted master key, and having collected at least a predetermined number of shares from the master key shares distributed across multiple physical storage locations, the master key is reconstructed using a secret sharing recovery algorithm; in response to a corrupted working key, and having collected at least a predetermined number of shares from the working key shares distributed across multiple physical storage locations, the working key is reconstructed using a secret sharing recovery algorithm. If the number of shares of the master key is less than the preset number, a new master key is derived from the root key; if the number of shares of the working key is less than the preset number, a new working key is derived from the master key.
[0170] In some embodiments, the key management device 10 of the energy storage system is further configured to: In response to a corrupted session key, the session key is destroyed and a new session key is derived from the working key.
[0171] In some embodiments, the root key is stored inside the hardware security module, and the lifespan of the root key corresponds to the lifespan of the hardware security module. The master key is stored in a hardware security module or an encrypted storage area; The working key is stored in protected memory; Session keys are stored in temporary memory. The lifespan of the master key is longer than that of the working key, and the lifespan of the working key is longer than that of the session key.
[0172] This application also provides an energy storage system. The energy storage system includes multiple functional modules, a hardware security module, and a key management device as provided in any embodiment of this application.
[0173] The energy storage system in this application embodiment can be an industrial and commercial energy storage system, a distributed residential energy storage cluster (or energy storage system), a grid-side large-capacity energy storage system (or a grid-side energy storage power station), etc., and can support a variety of energy storage scenarios such as grid-level, residential cluster, and industrial and commercial. The modular design makes it easy to expand.
[0174] This embodiment also provides a computer-readable storage medium having a computer program stored thereon, the computer program being loaded by a processor to perform the steps of any of the methods in the above embodiments.
[0175] In the embodiments of this application, the storage medium may be a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM), etc.
[0176] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0177] The foregoing has provided a detailed description of a key management method, apparatus, energy storage system, and medium for an energy storage system according to embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A key management method for an energy storage system, characterized in that, The energy storage system includes a hardware security module and multiple functional modules; the method is executed by the hardware security module, and the method includes: Generate the root key; Obtain the module identifier of the target functional module, and derive the master key of the target functional module based on the root key and the module identifier; The working key of the target functional module is derived from the master key; The session key of the target functional module is derived from the working key.
2. The method according to claim 1, characterized in that, The step of deriving the master key of the target functional module based on the root key and the module identifier includes: Obtain the timestamp and preset field separation identifier used when the master key is derived; The root key, the preset field separation identifier, the module identifier, and the timestamp are used as input parameters for the key derivation algorithm to derive the master key of the target functional module; wherein, the master key derived from the same functional module based on different timestamps is different.
3. The method according to claim 1, characterized in that, The method further includes: In response to the need to establish secure communication between the two functional modules, the first working key of the initiating functional module and the second working key of the target functional module are obtained. In response to the fact that both the first working key and the second working key are in a valid state, a shared session key is generated based on the first working key and the second working key.
4. The method according to claim 3, characterized in that, The method further includes: Before obtaining the first working key and the second working key, a communication key request instruction sent by the initiator functional module is received.
5. The method according to claim 4, characterized in that, The communication key request instruction includes a first identifier of the initiating party's functional module, a second identifier of the target party's functional module, and a random number; The step of generating a shared session key based on the first working key and the second working key includes: The shared session key is generated using a key derivation algorithm based on the first identifier, the second identifier, the random number, the first working key, and the second working key.
6. The method according to claim 3, characterized in that, The method further includes: After generating the shared session key, the shared session key is encrypted according to the first working key and distributed to the initiating functional module; The shared session key is encrypted using the second working key and distributed to the target functional module, so that the initiating functional module decrypts the shared session key using the first working key, and the target functional module decrypts the shared session key using the second working key, thereby establishing secure communication between the initiating functional module and the target functional module.
7. The method according to claim 1, characterized in that, The root key is not rotated during the lifecycle of the hardware security module; the method further includes: In response to the determination that the target key needs to be rotated, the target key is rotated or destroyed and then re-derived according to the key level of the target key, and the lower-level keys derived from the target key are rotated or destroyed and then re-derived; the target key includes a master key, a working key or a session key.
8. The method according to claim 7, characterized in that, The key rotation according to the key hierarchy of the target key includes: In response to the target key being the master key, the master key and the working key directly derived from the master key are rotated, and the session key derived from the working key is destroyed and re-derived.
9. The method according to claim 7, characterized in that, The key rotation according to the key hierarchy of the target key includes: In response to the target key being the working key, the working key is rotated, and the session key derived from the working key is destroyed and re-derived.
10. The method according to claim 7, characterized in that, The key rotation according to the key hierarchy of the target key includes: In response to the target key being the session key, the session key is destroyed and a new one is derived.
11. The method according to claim 7, characterized in that, The determination of the target key needs to be rotated, including: In response to the detection of at least one of a security anomaly event, a periodic triggering event, and a key update request event, it is determined that the target key needs to be rotated.
12. The method according to claim 11, characterized in that, The method further includes: In response to the detection of the security anomaly, the target key is determined based on the risk level of the security anomaly.
13. The method according to claim 12, characterized in that, The risk levels include high-risk event level, medium-risk event level and low-risk event level; Determining the target key based on the risk level of the security anomaly includes: In response to the security anomaly being classified as a high-risk event, the target key is determined to be the master key; In response to the security anomaly being classified as a medium-risk event, the target key is determined to be the working key; In response to the security anomaly being classified as a low-risk event, the target key is determined to be the session key.
14. The method according to claim 7, characterized in that, The method further includes: In response to the need for the target key to be rotated, a preset coexistence period is used to ensure that the new key after rotation and the old key before rotation can coexist effectively. After the preset coexistence period ends, the old key is destroyed.
15. The method according to claim 1, characterized in that, The method further includes: In response to a corrupted master key, and having collected at least a predetermined number of shares of the master key distributed across multiple physical storage locations, the master key is reconstructed using a secret sharing recovery algorithm; in response to a corrupted working key, and having collected at least the predetermined number of shares of the working key distributed across multiple physical storage locations, the working key is reconstructed using the secret sharing recovery algorithm. In response to the number of shares of the master key being less than the preset number, a new master key is derived from the root key; in response to the number of shares of the working key being less than the preset number, a new working key is derived from the master key.
16. The method according to claim 1, characterized in that, The method further includes: In response to the corruption of the session key, the session key is destroyed and a new session key is derived from the working key.
17. The method according to claim 1, characterized in that, The root key is stored inside the hardware security module, and the lifespan of the root key corresponds to the lifespan of the hardware security module. The master key is stored in the hardware security module or encrypted storage area; The working key is stored in protected memory; The session key is stored in temporary memory. The lifespan of the master key is longer than the lifespan of the working key, and the lifespan of the working key is longer than the lifespan of the session key.
18. A key management device for an energy storage system, characterized in that, The energy storage system includes a hardware security module and multiple functional modules; the device includes: The generation module is used to generate the root key; The acquisition module is used to obtain the module identifier of the target functional module; The first derived module is used to derive the master key of the target functional module based on the root key and the module identifier; The second derivation module is used to derive the working key of the target functional module based on the master key; The third derivation module is used to derive the session key of the target functional module based on the working key.
19. An energy storage system, characterized in that, It includes multiple functional modules, a hardware security module, and a key management device as described in claim 18.
20. A computer-readable storage medium, characterized in that, It stores a computer program thereon, which, when executed by a processor, causes the processor to perform the method as described in any one of claims 1 to 17.
