Power system micro-service message asynchronous processing method and device, computer device, storage medium and computer program product
By encrypting, segmenting, hashing, concatenating, and signing microservice messages in the power system, the security issues of asynchronous microservice message processing are resolved, achieving higher security and reliability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN COMTOP INFORMATION TECH
- Filing Date
- 2025-01-20
- Publication Date
- 2026-08-04
AI Technical Summary
The lack of security protection measures in the asynchronous message processing of existing power system microservices makes them vulnerable to network attacks, resulting in low security.
After encrypting the message to be processed, it is divided into multiple message blocks, hashed and concatenated to generate a root hash value and sign it. After signing with the private key, it is sent to the message middleware. The second microservice uses the public key to verify the signature and decrypt it.
It improves the security of asynchronous message processing in microservices, ensures the reliability and integrity of message sources, avoids security vulnerabilities in direct sending and receiving methods, and enhances protection against network attacks.
Smart Images

Figure CN119835075B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of power grid technology, and in particular to a method, apparatus, computer equipment, computer-readable storage medium, and computer program product for asynchronous processing of microservice messages in power systems. Background Technology
[0002] Currently, in order to ensure the stable operation of the power system, it is crucial to realize asynchronous message processing of microservices in the power system.
[0003] In traditional technologies, asynchronous message processing in microservices typically employs direct sending and receiving methods. However, this approach lacks security measures and is vulnerable to network attacks, resulting in low security for asynchronous message processing in microservices. Summary of the Invention
[0004] Therefore, it is necessary to provide a method, apparatus, computer equipment, computer-readable storage medium, and computer program product for asynchronous processing of microservice messages in power systems, which can improve the security of asynchronous microservice message processing, in response to the above-mentioned technical problems.
[0005] Firstly, this application provides an asynchronous message processing method for microservices in a power system, applied to a first microservice in a power system, including:
[0006] The pending message sent to the second microservice of the power system is encrypted to obtain an encrypted message.
[0007] The encrypted message is segmented to obtain multiple message blocks of the encrypted message;
[0008] Perform a hash operation on each message block to obtain the hash value of each message block;
[0009] The hash values of each message block are concatenated to obtain a concatenated hash value;
[0010] The concatenated hash value is subjected to another hash operation to obtain the root hash value of the encrypted message;
[0011] The root hash value is signed using the private key of the first microservice to obtain the digital signature of the encrypted message;
[0012] The encrypted message and the digital signature are sent to the message middleware; the second microservice is used to verify the digital signature obtained from the message middleware based on the public key of the first microservice, and if the verification result of the digital signature is successful, to decrypt the encrypted message obtained from the message middleware to obtain the message to be processed.
[0013] In one embodiment, the private and public keys of the first microservice are obtained in the following manner:
[0014] A developer terminal associated with the power system generates a private key to be verified for the first microservice, verifies the private key to obtain a processed private key, and generates a public key to be verified for the first microservice, verifies the public key to obtain a processed public key, and sends the processed private key and the processed public key to a certificate authority. The certificate authority verifies the processed private key again to obtain the private key of the first microservice, and verifies the processed public key again to obtain the public key of the first microservice.
[0015] In one embodiment, encrypting the pending message sent to the second microservice of the power system to obtain an encrypted message includes:
[0016] The pending messages sent to the second microservice of the power system are subjected to feature extraction processing to obtain the feature vector of the pending messages;
[0017] The feature vector is input into the trained sensitivity prediction model to obtain the predicted sensitivity of the message to be processed.
[0018] Based on the prediction sensitivity, the prediction probability of the message to be processed under each preset encryption method is determined;
[0019] From each of the preset encryption methods, the preset encryption method with the highest predicted probability is selected as the target encryption method for the message to be processed;
[0020] The message to be processed is encrypted according to the target encryption method to obtain the encrypted message.
[0021] In one embodiment, the step of segmenting the encrypted message to obtain multiple message blocks of the encrypted message includes:
[0022] Obtain the current length information of the encrypted message;
[0023] If the current length information is greater than the preset length information, the preset correspondence between the length information and the segmentation method is queried according to the current length information to obtain the segmentation method corresponding to the current length information, which is used as the current segmentation method of the encrypted message; the preset length information is determined through the performance information of the power system.
[0024] According to the current segmentation method, the encrypted message is segmented to obtain multiple message blocks of the encrypted message.
[0025] In one embodiment, the process of concatenating the hash values of each message block to obtain a concatenated hash value includes:
[0026] Obtain the location information of each message block;
[0027] Based on the location information of each message block, the splicing order of each message block is determined;
[0028] The hash values of each message block are concatenated according to the concatenation order to obtain the concatenated hash value.
[0029] In one embodiment, before encrypting the pending message sent to the second microservice of the power system to obtain the encrypted message, the method further includes:
[0030] Identify the target power devices associated with the second microservice;
[0031] Obtain the operating information, load information, and environmental information of the target power equipment;
[0032] The operation information, the load information, and the environment information are preprocessed to obtain preprocessed operation information, preprocessed load information, and preprocessed environment information.
[0033] According to a preset combination method, the preprocessed running information, the preprocessed load information, and the preprocessed environment information are combined to obtain combined information, which is used as the message to be processed.
[0034] Secondly, this application also provides an asynchronous message processing device for microservices in a power system, applied to a first microservice in a power system, comprising:
[0035] The message encryption module is used to encrypt the pending messages sent to the second microservice of the power system to obtain encrypted messages;
[0036] The message segmentation module is used to segment the encrypted message to obtain multiple message blocks of the encrypted message;
[0037] The message block processing module is used to perform hash operations on each message block to obtain the hash value of each message block;
[0038] The hash value concatenation module is used to concatenate the hash values of each message block to obtain a concatenated hash value.
[0039] The hash value processing module is used to perform a second hash operation on the concatenated hash value to obtain the root hash value of the encrypted message;
[0040] The hash value signing module is used to sign the root hash value using the private key of the first microservice to obtain the digital signature of the encrypted message.
[0041] The information sending module is used to send the encrypted message and the digital signature to the message middleware; the second microservice is used to verify the digital signature obtained from the message middleware based on the public key of the first microservice, and if the verification result of the digital signature is successful, to decrypt the encrypted message obtained from the message middleware to obtain the message to be processed.
[0042] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0043] The pending message sent to the second microservice of the power system is encrypted to obtain an encrypted message.
[0044] The encrypted message is segmented to obtain multiple message blocks of the encrypted message;
[0045] Perform a hash operation on each message block to obtain the hash value of each message block;
[0046] The hash values of each message block are concatenated to obtain a concatenated hash value;
[0047] The concatenated hash value is subjected to another hash operation to obtain the root hash value of the encrypted message;
[0048] The root hash value is signed using the private key of the first microservice to obtain the digital signature of the encrypted message;
[0049] The encrypted message and the digital signature are sent to the message middleware; the second microservice is used to verify the digital signature obtained from the message middleware based on the public key of the first microservice, and if the verification result of the digital signature is successful, to decrypt the encrypted message obtained from the message middleware to obtain the message to be processed.
[0050] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:
[0051] The pending message sent to the second microservice of the power system is encrypted to obtain an encrypted message.
[0052] The encrypted message is segmented to obtain multiple message blocks of the encrypted message;
[0053] Perform a hash operation on each message block to obtain the hash value of each message block;
[0054] The hash values of each message block are concatenated to obtain a concatenated hash value;
[0055] The concatenated hash value is subjected to another hash operation to obtain the root hash value of the encrypted message;
[0056] The root hash value is signed using the private key of the first microservice to obtain the digital signature of the encrypted message;
[0057] The encrypted message and the digital signature are sent to the message middleware; the second microservice is used to verify the digital signature obtained from the message middleware based on the public key of the first microservice, and if the verification result of the digital signature is successful, to decrypt the encrypted message obtained from the message middleware to obtain the message to be processed.
[0058] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:
[0059] The pending message sent to the second microservice of the power system is encrypted to obtain an encrypted message.
[0060] The encrypted message is segmented to obtain multiple message blocks of the encrypted message;
[0061] Perform a hash operation on each message block to obtain the hash value of each message block;
[0062] The hash values of each message block are concatenated to obtain a concatenated hash value;
[0063] The concatenated hash value is subjected to another hash operation to obtain the root hash value of the encrypted message;
[0064] The root hash value is signed using the private key of the first microservice to obtain the digital signature of the encrypted message;
[0065] The encrypted message and the digital signature are sent to the message middleware; the second microservice is used to verify the digital signature obtained from the message middleware based on the public key of the first microservice, and if the verification result of the digital signature is successful, to decrypt the encrypted message obtained from the message middleware to obtain the message to be processed.
[0066] The aforementioned asynchronous message processing method, apparatus, computer equipment, storage medium, and computer program product for power system microservices first encrypts the message to be processed sent to the second microservice of the power system to obtain an encrypted message. The encrypted message is then segmented into multiple message blocks. Each message block is hashed to obtain a hash value, and these hash values are concatenated to obtain a concatenated hash value. The concatenated hash value is then hashed again to obtain the root hash value of the encrypted message. Next, the root hash value is signed using the private key of the first microservice to obtain a digital signature of the encrypted message. Finally, the encrypted message and the digital signature are sent to a message middleware. The second microservice verifies the digital signature obtained from the message middleware based on the public key of the first microservice. If the verification result of the digital signature is successful, the encrypted message obtained from the message middleware is decrypted to obtain the message to be processed. In this way, during the asynchronous message processing of microservices, the first microservice performs a series of processes on the message to be processed, including encryption, segmentation, hashing, concatenation, re-hashing, and signing, to obtain a digital signature. This ensures the reliability and integrity of the message's source. By sending the encrypted message and digital signature to the message middleware, the encrypted message and digital signature can be securely stored, allowing the second microservice to process the encrypted message more securely. This improves the security of encrypted message processing and, consequently, the security of asynchronous message processing in microservices. Furthermore, by employing multiple different types of security processing methods for the message to be processed, the entire process avoids the shortcomings of direct sending and receiving methods, which lack security protection and are vulnerable to network attacks, leading to lower security in asynchronous message processing of microservices. This further enhances the security of asynchronous message processing in microservices. Attached Figure Description
[0067] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0068] Figure 1 This is an application environment diagram of the asynchronous message processing method for microservices in a power system in one embodiment;
[0069] Figure 2 This is a flowchart illustrating an asynchronous message processing method for a power system microservice in one embodiment.
[0070] Figure 3 This is a flowchart illustrating an asynchronous message processing method for power system microservices in another embodiment.
[0071] Figure 4 This is a flowchart illustrating an asynchronous message passing and processing method between microservices in a power system, as shown in one embodiment.
[0072] Figure 5 This is a structural block diagram of a power system microservice message asynchronous processing device in one embodiment;
[0073] Figure 6 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0074] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0075] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0076] The asynchronous message processing method for power system microservices provided in this application can be applied to, for example... Figure 1 In the application environment shown, the first microservice 102 of the power system communicates with the second microservice 104 of the power system via a network. Specifically, refer to... Figure 1The first microservice 102 of the power system encrypts the message to be processed sent to the second microservice 104 of the power system, obtaining an encrypted message. The encrypted message is then segmented into multiple message blocks. Each message block is hashed to obtain a hash value. These hash values are concatenated to obtain a concatenated hash value. This concatenated hash value is then hashed again to obtain the root hash value of the encrypted message. Using the private key of the first microservice, the root hash value is signed to obtain a digital signature for the encrypted message. The encrypted message and the digital signature are then sent to a message middleware. The second microservice 104 of the power system verifies the digital signature obtained from the message middleware based on the public key of the first microservice 102. If the verification result is successful, the encrypted message obtained from the message middleware is decrypted to obtain the message to be processed. Here, the first microservice 102 of the power system refers to the microservice used to generate the message to be processed, and the second microservice 104 of the power system refers to the microservice used to process the message to be processed. In a real-world scenario, the first microservice 102 of the power system refers to microservice A, and the second microservice 104 of the power system refers to microservice B. It should be noted that both the first microservice 102 and the second microservice 104 of the power system are microservices within the power system, specifically referring to multiple small, independent, and collaborative service units decomposed from monolithic power system software.
[0077] In one exemplary embodiment, such as Figure 2 As shown, an asynchronous message processing method for microservices in a power system is provided, which is applied to... Figure 1 Taking the first microservice of the power system as an example, this embodiment of the method includes the following steps:
[0078] Step S201: Encrypt the pending message sent to the second microservice of the power system to obtain the encrypted message.
[0079] Among them, the pending message is used to represent the message content that needs to be processed by the second microservice of the power system.
[0080] The encrypted message refers to the message to be processed after being encrypted.
[0081] For example, the first microservice of the power system determines the target encryption method for the message to be processed sent to the second microservice of the power system from each preset encryption method; then, the first microservice of the power system encrypts the message to be processed according to the target encryption method to obtain the encrypted message.
[0082] Step S202: The encrypted message is segmented to obtain multiple message blocks of the encrypted message.
[0083] The message block is used to represent the encrypted message after it has been segmented.
[0084] For example, the first microservice of the power system determines the current segmentation method of the encrypted message; then, the first microservice of the power system segments the encrypted message according to the current segmentation method to obtain multiple message blocks of the encrypted message.
[0085] Step S203: Perform a hash operation on each message block to obtain the hash value of each message block.
[0086] The hash value is obtained by performing a hash operation on the message block.
[0087] For example, the first microservice of the power system formats each message block to obtain each formatted message block; then, the first microservice of the power system performs SHA-256 (SecureHash Algorithm 256 – bit) hash operation on each formatted message block to obtain the hash value of each formatted message block, which is used as the hash value of each message block.
[0088] Step S204: Concatenate the hash values of each message block to obtain the concatenated hash value.
[0089] The concatenated hash value is used to represent the hash value obtained by concatenating the hash values of each message block.
[0090] For example, the first microservice of the power system determines the concatenation order of each message block; then, the first microservice of the power system concatenates the hash values of each message block according to the concatenation order to obtain the concatenated hash value.
[0091] Step S205: Perform a second hash operation on the concatenated hash value to obtain the root hash value of the encrypted message.
[0092] The root hash value is used to represent the hash value obtained by performing a second hash operation on the concatenated hash value.
[0093] For example, the first microservice of the power system performs another SHA-256 hash operation on the concatenated hash value to obtain the processed concatenated hash value, which is used as the root hash value of the encrypted message.
[0094] Step S206: Using the private key of the first microservice, the root hash value is signed to obtain the digital signature of the encrypted message.
[0095] The private key of the first microservice is used to represent the secret key of the first microservice.
[0096] Digital signatures are used to represent the signature value of encrypted messages.
[0097] For example, in response to a signature instruction for the root hash value, the first microservice of the power system uses its private key and an RSA (Rivest-Shamir-Adleman, an asymmetric encryption algorithm) algorithm to sign the root hash value, obtaining a digital signature of the root hash value, which serves as the digital signature of the encrypted message.
[0098] Step S207: Send the encrypted message and digital signature to the message middleware; The second microservice is used to verify the digital signature obtained from the message middleware based on the public key of the first microservice, and decrypt the encrypted message obtained from the message middleware if the verification result of the digital signature is successful, to obtain the message to be processed.
[0099] Among them, message middleware refers to the software infrastructure that transmits encrypted messages, such as RabbitMQ (a message broker software) and Kafka (a distributed streaming platform).
[0100] In this context, the public key of the first microservice is used to represent the public key of the first microservice.
[0101] The verification result is used to represent the result information obtained by verifying the digital signature obtained from the message middleware.
[0102] For example, the first microservice of the power system sends the encrypted message and digital signature to the message middleware; the second microservice of the power system subscribes to and receives the encrypted message and digital signature from the message middleware, and verifies the digital signature based on the public key of the first microservice; if the verification result of the digital signature is successful, the second microservice of the power system decrypts the encrypted message obtained from the message middleware to obtain the message to be processed.
[0103] In the aforementioned asynchronous message processing method for power system microservices, the message to be processed sent to the second microservice of the power system is first encrypted to obtain an encrypted message. The encrypted message is then segmented to obtain multiple message blocks. Each message block is hashed to obtain a hash value, and the hash values of each message block are concatenated to obtain a concatenated hash value. Next, the concatenated hash value is hashed again to obtain the root hash value of the encrypted message. Then, the root hash value is signed using the private key of the first microservice to obtain a digital signature of the encrypted message. Finally, the encrypted message and the digital signature are sent to the message middleware. The second microservice verifies the digital signature obtained from the message middleware based on the public key of the first microservice. If the verification result of the digital signature is successful, the encrypted message obtained from the message middleware is decrypted to obtain the message to be processed. In this way, during the asynchronous message processing of microservices, the first microservice performs a series of processes on the message to be processed, including encryption, segmentation, hashing, concatenation, re-hashing, and signing, to obtain a digital signature. This ensures the reliability and integrity of the message's source. By sending the encrypted message and digital signature to the message middleware, the encrypted message and digital signature can be securely stored, allowing the second microservice to process the encrypted message more securely. This improves the security of encrypted message processing and, consequently, the security of asynchronous message processing in microservices. Furthermore, by employing multiple different types of security processing methods for the message to be processed, the entire process avoids the shortcomings of direct sending and receiving methods, which lack security protection and are vulnerable to network attacks, leading to lower security in asynchronous message processing of microservices. This further enhances the security of asynchronous message processing in microservices.
[0104] In an exemplary embodiment, the private key and public key of the first microservice are obtained as follows: a private key to be verified for the first microservice is generated through a developer terminal associated with the power system; the private key to be verified is verified to obtain a processed private key; a public key to be verified for the first microservice is generated; the public key to be verified is verified to obtain a processed public key; and the processed private key and processed public key are sent to a certificate authority. The certificate authority is used to verify the processed private key again to obtain the private key of the first microservice, and to verify the processed public key again to obtain the public key of the first microservice.
[0105] The developer terminal is used to generate and verify the private key and public key to be verified for the first microservice.
[0106] Among them, the private key to be verified refers to the private key that needs to be verified.
[0107] The processed private key refers to the private key to be verified after one verification process.
[0108] The public key to be verified refers to the public key that needs to be verified.
[0109] The processed public key refers to the public key to be verified after one verification process.
[0110] Among them, the Certificate Authority refers to a third-party organization that performs secondary verification on the processed private key and the public key to be verified.
[0111] For example, the first microservice of the power system generates a private key to be verified and a public key to be verified for the first microservice through a developer terminal associated with the power system. The developer terminal verifies the private key to be verified to obtain a processed private key, and verifies the public key to be verified to obtain a processed public key. Then, the developer terminal sends the processed private key and the processed public key to a certificate authority. The certificate authority verifies the processed private key again to obtain the private key of the first microservice, and verifies the processed public key again to obtain the public key of the first microservice.
[0112] In this embodiment, the private key and public key to be verified for the first microservice are dually verified through the developer terminal and the certificate authority, thereby making the private key and public key of the first microservice more legitimate, reducing the risk of the private key and public key being used illegally, and helping to ensure the security of power system communication and data processing.
[0113] In an exemplary embodiment, step S201 above, which encrypts the message to be processed sent to the second microservice of the power system to obtain an encrypted message, specifically includes the following: performing feature extraction processing on the message to be processed sent to the second microservice of the power system to obtain a feature vector of the message to be processed; inputting the feature vector into a trained sensitivity prediction model to obtain the predicted sensitivity of the message to be processed; determining the predicted probability of the message to be processed under each preset encryption method based on the predicted sensitivity; selecting the preset encryption method with the highest predicted probability from each preset encryption method as the target encryption method for the message to be processed; and encrypting the message to be processed according to the target encryption method to obtain an encrypted message.
[0114] Among them, the feature vector is used to represent the representation vector of the message to be processed.
[0115] Among them, the sensitivity prediction model refers to the network model used to obtain the predicted sensitivity of the message to be processed, such as the recurrent neural network model, the convolutional neural network model, etc.
[0116] Among them, the prediction sensitivity is used to represent the predicted value corresponding to the sensitivity of the message to be processed.
[0117] The preset encryption method refers to a pre-defined encryption method, such as AES (Advanced Encryption Standard) or DES (Data Encryption Standard). It should be noted that the preset encryption method depends on the specific circumstances.
[0118] The predicted probability is used to represent the likelihood that the model determines the preset encryption method to be correct.
[0119] The target encryption method refers to the preset encryption method with the highest predicted probability. In a real-world scenario, the target encryption method is AES.
[0120] For example, the first microservice of the power system inputs the message to be processed sent to the second microservice of the power system into a feature extraction model. The feature extraction model performs feature extraction on the message to be processed, obtaining a feature vector. Next, the first microservice inputs the feature vector into a trained sensitivity prediction model, obtaining a predicted sensitivity of the message. Then, the first microservice inputs the predicted sensitivity into a trained encryption method prediction model, determining the predicted probability of the message under each preset encryption method based on the predicted sensitivity. Next, the first microservice selects the preset encryption method with the highest predicted probability from each preset encryption method and uses this preset encryption method as the target encryption method for the message. Finally, the first microservice encrypts the message according to the target encryption method, obtaining the encrypted message.
[0121] In this embodiment, the predicted sensitivity of the message to be processed is obtained through a sensitivity prediction model, and then the prediction probability under each preset encryption method is determined. The encryption method with the highest prediction probability is selected as the target encryption method, thereby making the selection of encryption methods more targeted and better adapting to the security requirements of different messages.
[0122] In an exemplary embodiment, step S202 above, which involves segmenting the encrypted message to obtain multiple message blocks of the encrypted message, specifically includes the following: obtaining the current length information of the encrypted message; if the current length information is greater than a preset length information, querying the preset correspondence between the length information and the segmentation method based on the current length information to obtain the segmentation method corresponding to the current length information, which is used as the current segmentation method of the encrypted message; the preset length information is determined through the performance information of the power system; and segmenting the encrypted message according to the current segmentation method to obtain multiple message blocks of the encrypted message.
[0123] The current length information is used to indicate the length of the encrypted message.
[0124] Among them, the preset length information refers to the pre-set length threshold, which is determined by the performance information of the power system.
[0125] The performance information includes network bandwidth, data read / write speed, and other information.
[0126] The preset correspondence is used to represent the correspondence between length information and segmentation methods. For example, when the length information exhibits a regularity (such as the length information being a fixed value or an integer multiple of a fixed value), the corresponding segmentation method is a fixed-length segmentation method; when the length information does not have a fixed regularity (such as the length information changing due to the diversity of message content, different data sources, or the influence of external factors), the corresponding segmentation method is a variable-length segmentation method.
[0127] The current segmentation method is used to indicate how the encrypted message is segmented.
[0128] For example, the first microservice of the power system retrieves the performance information of the power system from the database; then, the first microservice of the power system queries the correspondence between the performance information and the preset length information based on the performance information to obtain the preset length information corresponding to the performance information of the power system; then, the first microservice of the power system obtains the current length information of the encrypted message, and judges the current length information based on the preset length information to obtain a judgment result; if the judgment result indicates that the current length information is greater than the preset length information, the first microservice of the power system queries the preset correspondence between the length information and the segmentation method based on the current length information to obtain the segmentation method corresponding to the current length information, which is used as the current segmentation method for the encrypted message; then, the first microservice of the power system segments the encrypted message according to the current segmentation method to obtain multiple message blocks of the encrypted message.
[0129] In this embodiment, the preset length information is determined based on the power system performance information, and the current length information of the encrypted message, the preset length information, and the preset correspondence are used to determine the segmentation method that best matches the encrypted message. This enables more effective segmentation of the encrypted message and improves the overall data processing efficiency.
[0130] In an exemplary embodiment, step S204 above, which concatenates the hash values of each message block to obtain a concatenated hash value, specifically includes the following: obtaining the location information of each message block; determining the concatenation order of each message block based on the location information of each message block; and concatenating the hash values of each message block according to the concatenation order to obtain a concatenated hash value.
[0131] The location information is used to indicate the relative position of each message block in the encrypted message.
[0132] The concatenation order is used to indicate the order in which the hash values of each message block are concatenated.
[0133] For example, the first microservice of the power system obtains the structure tag of each message block and parses the structure tag of each message block to obtain the parsing information of each message block. Then, the first microservice of the power system extracts the position information of each message block from the parsing information of each message block. Then, the first microservice of the power system determines the concatenation order of each message block according to the position information of each message block. For example, if the position information of message block A is 1 and the position information of message block B is 2, then message block A should be concatenated before message block B during concatenation. Then, the first microservice of the power system concatenates the hash value of each message block according to the concatenation order to obtain the concatenated hash value.
[0134] In this embodiment, the splicing order is determined by obtaining the location information of each message block, and then the hash values of each message block are spliced together to obtain the spliced hash value. This is beneficial for comprehensively reflecting the entire message content, thereby obtaining a more accurate spliced hash value, which improves the accuracy of determining the spliced hash value and provides a data foundation for the subsequent analysis process.
[0135] In an exemplary embodiment, step S201, before encrypting the message to be processed sent to the second microservice of the power system to obtain the encrypted message, specifically includes the following: determining the target power equipment associated with the second microservice; obtaining the operating information, load information, and environmental information of the target power equipment; preprocessing the operating information, load information, and environmental information to obtain preprocessed operating information, preprocessed load information, and preprocessed environmental information; and combining the preprocessed operating information, preprocessed load information, and preprocessed environmental information according to a preset combination method to obtain combined information, which serves as the message to be processed.
[0136] The target power device is used to represent the power device associated with the second microservice.
[0137] The operational information includes the equipment status and operating parameters of the target power equipment.
[0138] The load information includes real-time load and load changes of the target power equipment.
[0139] The environmental information includes data such as the temperature, humidity, and altitude of the target power equipment.
[0140] Among them, the preprocessed running information refers to the running information after preprocessing.
[0141] Among them, the preprocessed load information refers to the load information after preprocessing.
[0142] Among them, preprocessed environmental information refers to environmental information after preprocessing.
[0143] The preset combination method refers to a pre-defined combination method, such as combining from left to right. It should be noted that the preset combination method depends on the situation.
[0144] Among them, the combined information refers to the information obtained by combining the preprocessed running information, the preprocessed load information, and the preprocessed environmental information.
[0145] For example, the first microservice of the power system obtains the power equipment identification information associated with the second microservice; then, the first microservice of the power system determines the power equipment corresponding to the power equipment identification information based on the power equipment identification information, as the target power equipment associated with the second microservice; then, the first microservice of the power system obtains the operation information, load information, and environmental information of the target power equipment from the database; then, the first microservice of the power system performs noise reduction and normalization processing on the operation information, load information, and environmental information to obtain preprocessed operation information, preprocessed load information, and preprocessed environmental information; then, the first microservice of the power system determines the combination method corresponding to the preprocessed operation information, preprocessed load information, and preprocessed environmental information as a preset combination method, and performs combination processing on the preprocessed operation information, preprocessed load information, and preprocessed environmental information according to the preset combination method to obtain combined information, as a message to be processed.
[0146] In this embodiment, by acquiring the operation, load, and environmental information of the target power equipment and preprocessing and combining this information, the equipment status of the target power equipment can be comprehensively analyzed from multiple key dimensions, thereby making the message to be processed more comprehensive and accurate, which is conducive to improving the accuracy of the determination of the message to be processed.
[0147] In one exemplary embodiment, such as Figure 3 As shown, another asynchronous message processing method for power system microservices is provided, which can be applied to... Figure 1 Taking the first microservice of the power system in China as an example, the following steps are included:
[0148] Step S301: Perform feature extraction processing on the message to be processed sent to the second microservice of the power system to obtain the feature vector of the message to be processed; input the feature vector into the trained sensitivity prediction model to obtain the predicted sensitivity of the message to be processed.
[0149] Step S302: Based on the prediction sensitivity, determine the prediction probability of the message to be processed under each preset encryption method; from each preset encryption method, select the preset encryption method with the highest prediction probability as the target encryption method for the message to be processed.
[0150] Step S303: Encrypt the message to be processed according to the target encryption method to obtain the encrypted message.
[0151] Step S304: Obtain the current length information of the encrypted message.
[0152] Step S305: If the current length information is greater than the preset length information, query the preset correspondence between the length information and the segmentation method according to the current length information to obtain the segmentation method corresponding to the current length information, which is used as the current segmentation method of the encrypted message; the preset length information is determined by the performance information of the power system.
[0153] Step S306: According to the current segmentation method, the encrypted message is segmented to obtain multiple message blocks of the encrypted message.
[0154] Step S307: Perform a hash operation on each message block to obtain the hash value of each message block.
[0155] Step S308: Obtain the location information of each message block; determine the concatenation order of each message block based on the location information of each message block; concatenate the hash values of each message block according to the concatenation order to obtain the concatenated hash value.
[0156] Step S309: Perform a second hash operation on the concatenated hash value to obtain the root hash value of the encrypted message.
[0157] Step S310: Using the private key of the first microservice, the root hash value is signed to obtain the digital signature of the encrypted message.
[0158] Step S311: Send the encrypted message and digital signature to the message middleware; The second microservice is used to verify the digital signature obtained from the message middleware based on the public key of the first microservice, and decrypt the encrypted message obtained from the message middleware if the verification result of the digital signature is successful, to obtain the message to be processed.
[0159] In the aforementioned asynchronous message processing method for power system microservices, during the asynchronous message processing process, the first microservice performs a series of processes on the message to be processed, including encryption, segmentation, hashing, concatenation, re-hashing, and signing, to obtain a digital signature. This ensures the reliability and integrity of the message's source. Furthermore, by sending the encrypted message and digital signature to the message middleware, they can be securely stored, enabling the second microservice to process the encrypted message more securely. This improves the security of encrypted message processing and, consequently, the security of asynchronous message processing. Moreover, by employing various secure processing methods for the message to be processed, the method avoids the vulnerability of direct sending and receiving to network attacks, which lacks security protection and results in lower security for asynchronous message processing. This further enhances the overall security of asynchronous message processing.
[0160] In an exemplary embodiment, to more clearly illustrate the asynchronous message processing method for power system microservices provided in this application, the following specific embodiment will be used to describe the asynchronous message processing method for power system microservices. In one embodiment, as follows... Figure 4 As shown, this application also provides a method for asynchronous message passing and processing between microservices in a power system. During the asynchronous processing of microservice messages, the message to be processed sent to the second microservice of the power system is first encrypted to obtain an encrypted message. The encrypted message is then segmented into multiple message blocks. Each message block is hashed to obtain its hash value, and these hash values are concatenated to obtain a concatenated hash value. The concatenated hash value is then hashed again to obtain the root hash value of the encrypted message. The root hash value is then signed using the private key of the first microservice to obtain a digital signature for the encrypted message. Finally, the encrypted message and the digital signature are sent to a message middleware. The second microservice verifies the digital signature obtained from the message middleware based on the public key of the first microservice. If the verification result is successful, the encrypted message obtained from the message middleware is decrypted to obtain the message to be processed. Specifically, this includes the following:
[0161] Step 1: The developer terminal is responsible for generating a unique set of private keys, with each microservice corresponding to a pair of private and public keys.
[0162] Step 2: After generating the private key, execute the authentication process to verify each private key and its corresponding public key to ensure its security.
[0163] Step 3: Transfer the certified private and public key data to the Certificate Authority and submit a registration application for the developer certificate.
[0164] Step 4: After receiving the data, the certificate authority performs secondary authentication of the public key and issues a developer certificate for each microservice.
[0165] Step 5: Using the HashTree algorithm and rejection sampling technique, generate a valid digital signature for each microservice at the certificate authority and construct the corresponding verification path.
[0166] Step 6: Send the generated digital signature and verification path to a third-party terminal for further certificate application and verification.
[0167] Step 7: After receiving the data, the third-party terminal applies for registration of the third-party developer certificate and issues the certificate using its private key.
[0168] Step 8: The third-party terminal performs signature verification by calculating and restoring the root node of the commitment tree and verifying its legality, while generating developer signature information.
[0169] Step 9: Design an asynchronous message passing process to ensure the efficiency and security of communication between microservices. The specific steps are as follows: (1) Microservice A creates a message and performs encryption and signature processing on the message; (2) Publish the signed message to the message middleware; (3) Microservice B subscribes to and receives the message from the message middleware and performs signature verification; (4) After successful verification, microservice B performs message processing operations; if the verification fails, logs are recorded and the message is discarded.
[0170] Step 10: After microservice B processes the message, it asynchronously sends the result back to microservice A and updates the system status. If an error occurs during processing, the error message is sent to the developer's terminal. Once message processing is complete, the asynchronous message passing process between the power system microservices ends.
[0171] The Certificate Authority (CA) is equipped with a public key and a private key, enabling a secure two-way connection with the authentication and signing public key. After registering and applying for a developer certificate, the CA will issue the developer certificate and pass it to the authentication and signing public key, before returning to the CA for final confirmation.
[0172] The generation of valid signatures employs a HashTree algorithm combined with rejection sampling, and uses the BuildAuth algorithm to construct the verification path. The data structure of a hash tree node is defined as follows: the inner class Node contains an array of arrays representing remainders (next), a numerical value (data), and an isDel flag indicating whether a node has been deleted. The node's constructor initializes the node's properties based on the passed parameters.
[0173] During the construction of the hash tree, the insertion method involves performing a modulo operation on the element to determine the position. If the position is empty, a new node is created. If the node is logically deleted, it is restored. If a value already exists, the recursive search continues.
[0174] The steps of the hash tree insertion method include:
[0175] (1) Perform a modulo operation on the element to be inserted to determine its position in the hash tree.
[0176] (2) If the position is empty, create a new node and insert it.
[0177] (3) If a node is logically deleted, restore the node state and update the data.
[0178] (4) If a node already has data, then recursively search downwards until an empty space or a logically deleted node is found.
[0179] The steps employing the HashTree algorithm combined with rejection sampling include: First, for each microservice, a unique hash value is generated based on its public key; this hash value serves as a leaf node in the hash tree. Next, a Merkle (a tree-like data structure) hash tree is used to organize these leaf nodes. The hash tree construction is achieved through the following algorithmic steps: each non-leaf node is the hash of the concatenation of the hash values of its child nodes, thus progressively building a complete hash tree from the leaf nodes to the root node. During this process, rejection sampling is used to ensure a uniform distribution of hash values among the nodes in the hash tree, thereby improving the efficiency of signature verification.
[0180] The SHA-256 hash algorithm is used to calculate the hash value of each node. The specific steps include: dividing the microservice's public key data into fixed-size blocks, performing a SHA-256 hash operation on each block independently, concatenating these hash values, and performing another SHA-256 hash operation to obtain the final hash value. In this way, each microservice obtains a root hash value, which serves as its digital signature. Finally, to verify the signature, a verification path is constructed—a path from the leaf node to the root node. This path contains all the necessary intermediate hash values, allowing the recipient to independently verify the signature's validity without accessing the entire hash tree. This process not only ensures signature security but also improves the efficiency of signature verification.
[0181] The detailed steps for decompiling an APK (Android Package, a type of installation package) include:
[0182] Use apkdb (a decompilation tool) to decompile the APK file by right-clicking it.
[0183] Use the apktool (a decompilation and refactoring tool) tool, place the two apktool files in a suitable directory, and execute the apktoold (a decompilation command) command via the command line to decompile.
[0184] Change the APK file extension to .zip (a file format), extract the classes.dex file after decompression.
[0185] Use the dex2jar tool (a conversion tool) to convert classes.dex into a jar file (a file format) for further analysis.
[0186] The installation and usage steps for the zipalign (an application package optimization tool) optimization tool include:
[0187] Install the zipalign tool and ensure it is available in your system path.
[0188] Use the zipalign tool to optimize the APK and improve resource indexing efficiency.
[0189] The optimization process includes aligning resource files within the APK to 4-byte boundaries to reduce runtime memory usage.
[0190] After receiving data, the third-party terminal initiates a registration process for a third-party developer certificate. First, the terminal generates a public-private key pair, with the private key used for subsequent certificate issuance. Next, the terminal sends the public key along with the developer's identity information to a Certificate Authority (CA). After verifying the developer's identity, the CA uses its CA private key to digitally sign the third-party developer's public key information, generating a developer certificate. The CA then sends the certificate back to the third-party terminal. Upon receiving the certificate, the terminal uses its pre-generated private key to sign the certificate, ensuring its validity and the terminal's identity. This process can be implemented using the Elliptic Curve Digital Signature Algorithm (ECDSA), where the private key is used for signing and the public key is used to verify the signature's legitimacy.
[0191] In this process, the third-party terminal uses a commitment tree algorithm to reconstruct the root node of the commitment tree and verify its legitimacy when performing signature verification. The terminal first receives the data containing the signature and then reconstructs the commitment tree using the same hash function and construction process. For each data element, the terminal calculates its commitment and inserts it into the commitment tree. By recursively calculating the hash values of the parent nodes until the root node is reached, the terminal can recover the root hash value of the commitment tree. Next, the terminal uses the public key from the third-party developer certificate to verify the signature of the root hash value. If the signature verification is successful, it proves that the data has not been tampered with, and the terminal generates the corresponding developer signature information. This process can be implemented using a hash chain algorithm to ensure the integrity and verifiability of the signature.
[0192] The asynchronous message passing process is designed to ensure the efficiency and security of communication between microservices. The specific steps are as follows: (1) When microservice A creates a message, it first encrypts the message content and then signs the encrypted message using its private key. This step can be encrypted using Advanced Encryption Standard (AES) and digitally signed using the RSA algorithm to ensure the confidentiality of the message content and the non-repudiation of the message source. (2) Microservice A publishes the signed message to a message middleware, such as RabbitMQ or Kafka, which is responsible for the temporary storage and delivery of messages. When publishing a message, microservice A specifies the message topic or queue so that other microservices can subscribe to and receive it. (3) After microservice B subscribes to and receives the message from the message middleware, it first performs signature verification. This step involves using microservice A's public key to verify the legality of the message signature and decrypting the message content using the same encryption algorithm. (4) Once the signature verification is successful, microservice B will perform message processing operations, such as updating database records or triggering other business logic. If verification fails, microservice B will log detailed error messages and discard invalid messages to prevent potential security threats.
[0193] In this process, after processing a message, microservice B asynchronously sends the processing result back to microservice A. This step can be achieved by sending an acknowledgment message or a callback function. Simultaneously, microservice B updates the system state to reflect the latest message processing status. If an error occurs during processing, microservice B will send error information to the developer's terminal, allowing the developer to promptly understand the system status and perform necessary debugging or repairs. Once microservice B completes its result feedback and state update, the asynchronous message passing process between the power system's microservices concludes, ensuring stable system operation and efficient communication.
[0194] The above embodiments can achieve the following technical effects:
[0195] (1) In the process of asynchronous microservice message processing, the first microservice performs a series of processes on the message to be processed, such as encryption, segmentation, hashing, concatenation, re-hashing, and signing, to obtain a digital signature. This ensures the reliability and integrity of the source of the message to be processed. By sending the encrypted message and digital signature to the message middleware, the encrypted message and digital signature can be securely stored, which enables the second microservice to process the encrypted message more securely. This is beneficial to improving the security of encrypted message processing and thus improving the security of asynchronous microservice message processing. Moreover, the whole process avoids the shortcomings of the direct sending and receiving methods, which lack security protection measures and are vulnerable to network attacks, resulting in low security of asynchronous microservice message processing, by using various types of security processing methods on the message to be processed. This further improves the security of asynchronous microservice message processing.
[0196] (2) By employing digital signatures and encryption technology when transmitting messages between microservices, the security of power system microservices is significantly improved. Digital signatures ensure the integrity and non-repudiation of message origin, meaning the receiver can verify that the message was indeed sent by the sender and has not been tampered with during transmission. This security measure effectively prevents malicious attackers from forging or tampering with message content, thereby protecting the stable operation and data security of the power system. In addition, encryption technology guarantees the confidentiality of message content. Even if the message is intercepted during transmission, unauthorized third parties cannot decipher the message content, which is crucial for preventing the leakage of sensitive information. Therefore, the beneficial effect of this method is to provide a secure and reliable environment for communication between power system microservices, enhancing the overall defense capability of the system.
[0197] (3) By designing an efficient asynchronous message passing process, this method greatly improves the communication efficiency between microservices in the power system. Asynchronous message passing allows microservices to send and receive messages without waiting for immediate responses, so that each microservice can handle its own tasks independently without being blocked and waiting for responses from other services. This mechanism reduces the waiting time of system resources, improves resource utilization, and thus enhances the response speed and throughput of the entire power system. In addition, asynchronous message passing can better handle a large number of messages during peak periods, avoiding system bottlenecks caused by synchronous communication. Therefore, the beneficial effect of this method is that it optimizes the communication mode between microservices, making the power system more flexible and efficient in handling complex business logic, thereby improving the overall performance and reliability of the system.
[0198] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0199] Based on the same inventive concept, this application also provides a power system microservice message asynchronous processing apparatus for implementing the above-mentioned power system microservice message asynchronous processing method. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more power system microservice message asynchronous processing apparatus embodiments provided below can be found in the limitations of the power system microservice message asynchronous processing method described above, and will not be repeated here.
[0200] In one exemplary embodiment, such as Figure 5 As shown, an asynchronous message processing device for microservices in a power system is provided, comprising: a message encryption module 501, a message segmentation module 502, a message block processing module 503, a hash value concatenation module 504, a hash value processing module 505, a hash value signature module 506, and an information sending module 507, wherein:
[0201] The message encryption module 501 is used to encrypt the pending messages sent to the second microservice of the power system to obtain encrypted messages.
[0202] The message segmentation module 502 is used to segment the encrypted message to obtain multiple message blocks of the encrypted message.
[0203] The message block processing module 503 is used to perform hash operations on each message block to obtain the hash value of each message block.
[0204] The hash value concatenation module 504 is used to concatenate the hash values of each message block to obtain the concatenated hash value.
[0205] The hash value processing module 505 is used to perform a second hash operation on the concatenated hash value to obtain the root hash value of the encrypted message.
[0206] The hash value signature module 506 is used to sign the root hash value using the private key of the first microservice to obtain a digital signature of the encrypted message.
[0207] The information sending module 507 is used to send the encrypted message and digital signature to the message middleware; the second microservice is used to verify the digital signature obtained from the message middleware based on the public key of the first microservice, and decrypt the encrypted message obtained from the message middleware if the verification result of the digital signature is successful, so as to obtain the message to be processed.
[0208] In an exemplary embodiment, the power system microservice message asynchronous processing device further includes a target verification module, which is used to generate a private key to be verified for a first microservice through a developer terminal associated with the power system, verify the private key to be verified to obtain a processed private key, generate a public key to be verified for the first microservice, verify the public key to be verified to obtain a processed public key, and send the processed private key and the processed public key to a certificate authority; the certificate authority is used to perform a second verification process on the processed private key to obtain the private key of the first microservice, and to perform a second verification process on the processed public key to obtain the public key of the first microservice.
[0209] In an exemplary embodiment, the message encryption module 501 is further configured to perform feature extraction processing on the pending message sent to the second microservice of the power system to obtain the feature vector of the pending message; input the feature vector into the trained sensitivity prediction model to obtain the predicted sensitivity of the pending message; determine the predicted probability of the pending message under each preset encryption method based on the predicted sensitivity; select the preset encryption method with the highest predicted probability from each preset encryption method as the target encryption method of the pending message; and encrypt the pending message according to the target encryption method to obtain the encrypted message.
[0210] In an exemplary embodiment, the message segmentation module 502 is further configured to obtain the current length information of the encrypted message; if the current length information is greater than the preset length information, according to the current length information, query the preset correspondence between the length information and the segmentation method to obtain the segmentation method corresponding to the current length information, which is used as the current segmentation method of the encrypted message; the preset length information is determined by the performance information of the power system; and the encrypted message is segmented according to the current segmentation method to obtain multiple message blocks of the encrypted message.
[0211] In an exemplary embodiment, the hash value concatenation module 504 is further configured to obtain the location information of each message block; determine the concatenation order of each message block based on the location information of each message block; and concatenate the hash values of each message block according to the concatenation order to obtain the concatenated hash value.
[0212] In an exemplary embodiment, the power system microservice message asynchronous processing device further includes a message generation module, used to determine the target power equipment associated with the second microservice; obtain the operation information, load information and environmental information of the target power equipment; preprocess the operation information, load information and environmental information to obtain preprocessed operation information, preprocessed load information and preprocessed environmental information; and combine the preprocessed operation information, preprocessed load information and preprocessed environmental information according to a preset combination method to obtain combined information as a message to be processed.
[0213] Each module in the aforementioned power system microservice message asynchronous processing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can invoke and execute the operations corresponding to each module.
[0214] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 6 As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores data such as messages to be processed and digital signatures. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements an asynchronous message processing method for power system microservices.
[0215] Those skilled in the art will understand that Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0216] In one exemplary embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.
[0217] In one exemplary embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above-described method embodiments.
[0218] In one exemplary embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.
[0219] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0220] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0221] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for asynchronous message processing in a power system microservice, characterized in that, The first microservice applied to a power system, the method comprising: Feature extraction processing is performed on the pending messages sent to the second microservice of the power system to obtain the feature vector of the pending messages; the feature vector is input into a trained sensitivity prediction model to obtain the predicted sensitivity of the pending messages; the predicted sensitivity is input into a trained encryption method prediction model to obtain the predicted probability of the pending messages under each preset encryption method; from each preset encryption method, the preset encryption method with the highest predicted probability is selected as the target encryption method for the pending messages; the pending messages are encrypted according to the target encryption method to obtain the encrypted messages; the pending messages are obtained based on the operation information, load information, and environmental information of the target power equipment associated with the second microservice. Obtain the current length information of the encrypted message; if the current length information is greater than a preset length information, query the preset correspondence between the length information and the segmentation method according to the current length information to obtain the segmentation method corresponding to the current length information, which is used as the current segmentation method of the encrypted message; the preset length information is obtained by querying the correspondence between the performance information and the preset length information according to the performance information of the power system; the performance information refers to network bandwidth and data read / write speed; the encrypted message is segmented according to the current segmentation method to obtain multiple message blocks of the encrypted message; Perform a hash operation on each message block to obtain the hash value of each message block; The structure marker of each message block is obtained, and the structure marker of each message block is parsed to obtain the parsing information of each message block; the position information of each message block is extracted from the parsing information of each message block; the position information is used to indicate the relative position of each message block in the encrypted message; the concatenation order of each message block is determined according to the position information of each message block; the hash value of each message block is concatenated according to the concatenation order to obtain the concatenated hash value. The concatenated hash value is subjected to another hash operation to obtain the root hash value of the encrypted message; The root hash value is signed using the private key of the first microservice to obtain the digital signature of the encrypted message; The encrypted message and the digital signature are sent to the message middleware; the second microservice is used to verify the digital signature obtained from the message middleware based on the public key of the first microservice, and if the verification result of the digital signature is successful, to decrypt the encrypted message obtained from the message middleware to obtain the message to be processed.
2. The method according to claim 1, characterized in that, The private and public keys of the first microservice are obtained in the following way: A developer terminal associated with the power system generates a private key to be verified for the first microservice, verifies the private key to obtain a processed private key, and generates a public key to be verified for the first microservice, verifies the public key to obtain a processed public key, and sends the processed private key and the processed public key to a certificate authority. The certificate authority verifies the processed private key again to obtain the private key of the first microservice, and verifies the processed public key again to obtain the public key of the first microservice.
3. The method according to claim 1, characterized in that, The digital signature is used to represent the signature value of the encrypted message.
4. The method according to claim 1, characterized in that, The message middleware is used to represent the software infrastructure for transmitting the encrypted message.
5. The method according to any one of claims 1 to 4, characterized in that, Before performing feature extraction processing on the pending messages sent to the second microservice of the power system to obtain the feature vector of the pending messages, the process further includes: Identify the target power devices associated with the second microservice; Obtain the operating information, load information, and environmental information of the target power equipment; The operation information, the load information, and the environment information are preprocessed to obtain preprocessed operation information, preprocessed load information, and preprocessed environment information. According to a preset combination method, the preprocessed running information, the preprocessed load information, and the preprocessed environment information are combined to obtain combined information, which is used as the message to be processed.
6. An asynchronous message processing device for microservices in a power system, characterized in that, The first microservice applied to power systems, the device comprising: A message encryption module is used to perform feature extraction processing on pending messages sent to the second microservice of the power system to obtain feature vectors of the pending messages; input the feature vectors into a trained sensitivity prediction model to obtain the predicted sensitivity of the pending messages; input the predicted sensitivity into a trained encryption method prediction model to obtain the predicted probability of the pending messages under each preset encryption method; select the preset encryption method with the highest predicted probability from each preset encryption method as the target encryption method for the pending messages; encrypt the pending messages according to the target encryption method to obtain encrypted messages; the pending messages are obtained based on the operating information, load information, and environmental information of the target power equipment associated with the second microservice. A message segmentation module is used to obtain the current length information of the encrypted message; if the current length information is greater than a preset length information, it queries a preset correspondence between the length information and the segmentation method based on the current length information to obtain the segmentation method corresponding to the current length information, which is used as the current segmentation method for the encrypted message; the preset length information is obtained by querying the correspondence between the performance information and the preset length information based on the performance information of the power system; the performance information refers to network bandwidth and data read / write speed; the encrypted message is segmented according to the current segmentation method to obtain multiple message blocks of the encrypted message; The message block processing module is used to perform hash operations on each message block to obtain the hash value of each message block; A hash value concatenation module is used to obtain the structure marker of each message block, parse the structure marker of each message block to obtain the parsing information of each message block; extract the position information of each message block from the parsing information of each message block; the position information is used to indicate the relative position of each message block in the encrypted message; determine the concatenation order of each message block according to the position information of each message block; and concatenate the hash values of each message block according to the concatenation order to obtain a concatenated hash value. The hash value processing module is used to perform a second hash operation on the concatenated hash value to obtain the root hash value of the encrypted message; The hash value signing module is used to sign the root hash value using the private key of the first microservice to obtain the digital signature of the encrypted message. The information sending module is used to send the encrypted message and the digital signature to the message middleware; the second microservice is used to verify the digital signature obtained from the message middleware based on the public key of the first microservice, and if the verification result of the digital signature is successful, to decrypt the encrypted message obtained from the message middleware to obtain the message to be processed.
7. The apparatus according to claim 6, characterized in that, The device further includes a message generation module, used to determine the target power device associated with the second microservice; and to obtain the operating information, load information, and environmental information of the target power device. The operation information, the load information, and the environment information are preprocessed to obtain preprocessed operation information, preprocessed load information, and preprocessed environment information. According to a preset combination method, the preprocessed running information, the preprocessed load information, and the preprocessed environment information are combined to obtain combined information, which is used as the message to be processed.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 5.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.