Power system micro-service message asynchronous processing method and device, computer equipment, storage medium and computer program product
By encrypting, segmenting, hashing and signature processing of microservice messages in the power system, the problem of lack of security protection measures in the existing technology is solved, and the security and reliability of asynchronous processing of microservice messages is improved.
Patent Information
- Application Number
- CN202510082699.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-20
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2045-01-20
AI Technical Summary
The prior art lacks security protection measures when processing microservice messages asynchronously in power systems, and is vulnerable to network attacks, resulting in low security.
By encrypting, segmenting, hashing, splicing, hashing and signature processing on the to-processed messages, a digital signature is generated, and the encrypted message and digital signature are sent to the message middleware for verification and decryption.
It improves the security of asynchronous processing of microservice messages, ensures the reliability and integrity of the source of messages, avoids network attacks, and enhances the system's defense capabilities.
Smart Images

Figure CN119835075A_ABST
Abstract
Description
Technical Field
[0001] The present 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 asynchronously processing microservice messages in a power system. Background Art
[0002] At present, in order to ensure the stable operation of the power system, it is crucial to realize asynchronous processing of microservice messages in the power system.
[0003] In traditional technology, in the process of asynchronous processing of microservice messages, direct sending and direct receiving are generally adopted; however, this method lacks security protection measures and is vulnerable to network attacks, resulting in low security of asynchronous processing of microservice messages. Summary of the invention
[0004] Based on this, it is necessary to provide a method, device, computer equipment, computer-readable storage medium and computer program product for asynchronous processing of microservice messages in a power system, which can improve the security of asynchronous processing of microservice messages, in response to the above technical problems.
[0005] In a first aspect, the present application provides a method for asynchronously processing microservice messages in a power system, which is applied to a first microservice in a power system, comprising:
[0006] Encrypting a to-be-processed message sent to a second microservice of the power system to obtain an encrypted message;
[0007] Segmenting the encrypted message to obtain multiple message blocks of the encrypted message;
[0008] Performing hash operation processing on each message block to obtain a hash value of each message block;
[0009] Performing splicing processing on the hash value of each message block to obtain a spliced hash value;
[0010] Performing a hash operation on the concatenated hash value again to obtain a root hash value of the encrypted message;
[0011] The root hash value is signed using the private key of the first microservice to obtain a 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 passed, decrypt the encrypted message obtained from the message middleware to obtain the message to be processed.
[0013] In one embodiment, the private key and the public key of the first microservice are obtained in the following manner:
[0014] Through a developer terminal associated with the power system, a private key to be verified for the first microservice is generated, the private key to be verified is verified to obtain a processed private key, and 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 the processed public key are sent to a certificate authority; the certificate authority is used to re-verify the processed private key to obtain the private key of the first microservice, and re-verify the processed public key to obtain the public key of the first microservice.
[0015] In one embodiment, encrypting the to-be-processed message sent to the second microservice of the power system to obtain the encrypted message includes:
[0016] Performing feature extraction processing on a to-be-processed message sent to a second microservice of the power system to obtain a feature vector of the to-be-processed message;
[0017] Inputting the feature vector into a trained sensitivity prediction model to obtain a predicted sensitivity of the message to be processed;
[0018] Determining, according to the prediction sensitivity, a prediction probability of the message to be processed under each preset encryption mode;
[0019] From each of the preset encryption modes, select the preset encryption mode with the largest predicted probability as the target encryption mode of 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 segmenting of the encrypted message to obtain multiple message blocks of the encrypted message includes:
[0022] Obtaining current length information of the encrypted message;
[0023] In the case where the current length information is greater than the preset length information, querying the preset correspondence between the length information and the segmentation mode according to the current length information, obtaining the segmentation mode corresponding to the current length information as the current segmentation mode of the encrypted message; the preset length information is determined by the performance information of the power system;
[0024] The encrypted message is segmented according to the current segmentation method to obtain multiple message blocks of the encrypted message.
[0025] In one of the embodiments, the concatenating the hash values of each message block to obtain the concatenated hash value includes:
[0026] Obtaining location information of each message block;
[0027] Determining a splicing order of each message block according to the position information of each message block;
[0028] The hash value of each message block is concatenated according to the concatenation order to obtain the concatenated hash value.
[0029] In one embodiment, before encrypting the to-be-processed message sent to the second microservice of the power system to obtain the encrypted message, the method further includes:
[0030] Determining a target power device associated with the second microservice;
[0031] Acquiring operation information, load information and environmental information of the target electric equipment;
[0032] Preprocessing the operation information, the load information and the environment information to obtain preprocessed operation information, preprocessed load information and preprocessed environment information;
[0033] The preprocessed operation information, the preprocessed load information and the preprocessed environment information are combined and processed according to a preset combination method to obtain combined information as the message to be processed.
[0034] In a second aspect, the present application further provides a power system microservice message asynchronous processing device, which is applied to a first microservice of the power system, including:
[0035] A message encryption module, used for encrypting a to-be-processed message sent to the second microservice of the power system to obtain an encrypted message;
[0036] A message segmentation module, used for segmenting the encrypted message to obtain multiple message blocks of the encrypted message;
[0037] A message block processing module, used for performing a hash operation on each message block to obtain a hash value of each message block;
[0038] A hash value splicing module, used for splicing the hash value of each message block to obtain a spliced hash value;
[0039] A hash value processing module, used for performing a hash operation on the concatenated hash value again to obtain a root hash value of the encrypted message;
[0040] A hash value signature module, used to sign the root hash value using the private key of the first microservice to obtain a digital signature of the encrypted message;
[0041] An 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 passed, decrypt the encrypted message obtained from the message middleware to obtain the message to be processed.
[0042] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0043] Encrypting a to-be-processed message sent to a second microservice of the power system to obtain an encrypted message;
[0044] Segmenting the encrypted message to obtain multiple message blocks of the encrypted message;
[0045] Performing hash operation processing on each message block to obtain a hash value of each message block;
[0046] Performing splicing processing on the hash value of each message block to obtain a spliced hash value;
[0047] Performing a hash operation on the concatenated hash value again to obtain a root hash value of the encrypted message;
[0048] The root hash value is signed using the private key of the first microservice to obtain a 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 passed, decrypt the encrypted message obtained from the message middleware to obtain the message to be processed.
[0050] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0051] Encrypting a to-be-processed message sent to a second microservice of the power system to obtain an encrypted message;
[0052] Segmenting the encrypted message to obtain multiple message blocks of the encrypted message;
[0053] Performing hash operation processing on each message block to obtain a hash value of each message block;
[0054] Performing splicing processing on the hash value of each message block to obtain a spliced hash value;
[0055] Performing a hash operation on the concatenated hash value again to obtain a root hash value of the encrypted message;
[0056] The root hash value is signed using the private key of the first microservice to obtain a 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 passed, decrypt the encrypted message obtained from the message middleware to obtain the message to be processed.
[0058] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0059] Encrypting a to-be-processed message sent to a second microservice of the power system to obtain an encrypted message;
[0060] Segmenting the encrypted message to obtain multiple message blocks of the encrypted message;
[0061] Performing hash operation processing on each message block to obtain a hash value of each message block;
[0062] Performing splicing processing on the hash value of each message block to obtain a spliced hash value;
[0063] Performing a hash operation on the concatenated hash value again to obtain a root hash value of the encrypted message;
[0064] The root hash value is signed using the private key of the first microservice to obtain a 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 passed, decrypt the encrypted message obtained from the message middleware to obtain the message to be processed.
[0066] The above-mentioned method, device, computer equipment, storage medium and computer program product for asynchronous processing of power system microservice messages first encrypt the message to be processed sent to the second microservice of the power system to obtain an encrypted message, and then divide the encrypted message to obtain multiple message blocks of the encrypted message, and then perform hash operation on each message block to obtain the hash value of each message block, and concatenate the hash value of each message block to obtain the concatenated hash value, then perform hash operation on the concatenated hash value again to obtain the root hash value of the encrypted message, and then, use the private key of the first microservice to sign the root hash value to obtain the digital signature of the encrypted message, and finally, send the encrypted message and the digital signature to the message middleware, and the second microservice verifies the digital signature obtained from the message middleware based on the public key of the first microservice, and when the verification result of the digital signature is passed, decrypts the encrypted message obtained from the message middleware to obtain the message to be processed. In this way, in the process of asynchronous processing of microservice messages, the first microservice performs a series of processes such as encryption, segmentation, hashing, splicing, re-hashing, signing, etc. on the message to be processed to obtain a digital signature, thereby ensuring the reliability and integrity of the source of the message to be processed, and by sending the encrypted message and the digital signature to the message middleware, the encrypted message and the digital signature can be securely stored, so that the second microservice can process the encrypted message more securely, which is conducive to improving the security of encrypted message processing, thereby improving the security of asynchronous processing of microservice messages; moreover, the entire process performs a variety of different types of security processing methods on the messages to be processed, thereby avoiding the lack of security protection measures in the direct sending and direct receiving methods, which is vulnerable to network attacks, resulting in low security of asynchronous processing of microservice messages, and further improving the security of asynchronous processing of microservice messages. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0068] Figure 1 An application environment diagram of a method for asynchronously processing microservice messages in a power system in one embodiment;
[0069] Figure 2 A schematic diagram of a flow chart of a method for asynchronously processing microservice messages in a power system in one embodiment;
[0070] Figure 3 A schematic diagram of a flow chart of a method for asynchronously processing microservice messages in a power system in another embodiment;
[0071] Figure 4 A schematic diagram of a flow chart of an asynchronous message transmission and processing method between microservices in a power system in one embodiment;
[0072] Figure 5 It is a structural block diagram of a device for asynchronously processing microservice messages in a power system in one embodiment;
[0073] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0074] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present 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, stored data, displayed data, 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 relevant data must comply with relevant regulations.
[0076] The method for asynchronously processing microservice messages in a power system provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown in FIG. 1 , the first microservice 102 of the power system communicates with the second microservice 104 of the power system through a network. Specifically, refer to Figure 1, the first microservice 102 of the power system encrypts the message to be processed sent to the second microservice 104 of the power system to obtain an encrypted message, divides the encrypted message to obtain multiple message blocks of the encrypted message, performs hash operation on each message block to obtain a hash value of each message block, concatenates the hash value of each message block to obtain a concatenated hash value, performs hash operation on the concatenated hash value again to obtain a root hash value of the encrypted message, signs the root hash value with the private key of the first microservice to obtain a digital signature of the encrypted message, sends the encrypted message and the digital signature to the message middleware, and 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 of the power system, and decrypts the encrypted message obtained from the message middleware when the verification result of the digital signature is passed to obtain a message to be processed. Among them, the first microservice 102 of the power system refers to a microservice for generating a message to be processed, and the second microservice 104 of the power system refers to a microservice for processing a message to be processed. In an actual 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 the first microservice 102 of the power system and the second microservice 104 of the power system are both microservices in the power system, specifically referring to multiple small, independent, and collaborative service units decomposed from the monolithic power system software.
[0077] In an exemplary embodiment, Figure 2 As shown, a method for asynchronous processing of microservice messages in a power system is provided. Figure 1 Taking the first microservice of the power system in the example as an example, in this embodiment, the method includes the following steps:
[0078] Step S201: encrypt the message to be processed sent to the second microservice of the power system to obtain an encrypted message.
[0079] The message to be processed is used to indicate 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 encryption processing.
[0081] Exemplarily, the first microservice of the power system determines the target encryption method of 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 an encrypted message.
[0082] Step S202, segmenting the encrypted message to obtain multiple message blocks of the encrypted message.
[0083] The message block is used to represent the encrypted message after segmentation.
[0084] Exemplarily, 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, performing hash operation processing on each message block to obtain a hash value of each message block.
[0086] The hash value is obtained by performing a hash operation on the message block.
[0087] Exemplarily, 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 (Secure Hash Algorithm 256-bit) hash operation on each formatted message block to obtain a hash value of each formatted message block as the hash value of each message block.
[0088] Step S204, concatenating the hash value of each message block to obtain a concatenated hash value.
[0089] The concatenated hash value is used to represent a hash value obtained by concatenating the hash values of each message block.
[0090] Exemplarily, the first microservice of the power system determines the splicing order of each message block; then, the first microservice of the power system splices the hash value of each message block according to the splicing order of each message block to obtain a spliced hash value.
[0091] Step S205, performing hash operation on the concatenated hash value again 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 hash operation on the concatenated hash value.
[0093] Exemplarily, the first microservice of the power system performs a SHA-256 hash operation on the concatenated hash value again to obtain a processed concatenated hash value as a root hash value of the encrypted message.
[0094] Step S206: The root hash value is signed using the private key of the first microservice to obtain a digital signature of the encrypted message.
[0095] The private key of the first microservice is used to represent the confidential key of the first microservice.
[0096] The digital signature is used to represent the signature value of the encrypted message.
[0097] Exemplarily, the first microservice of the power system responds to the signing instruction for the root hash value, signs the root hash value through the private key of the first microservice in combination with the RSA (Rivest-Shamir-Adleman, an asymmetric encryption algorithm) algorithm, and obtains the digital signature of the root hash value as the digital signature of the encrypted message.
[0098] Step S207, sending 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 if the verification result of the digital signature is passed, decrypt the encrypted message obtained from the message middleware to obtain the message to be processed.
[0099] Among them, message middleware is used to represent the software infrastructure for transmitting encrypted messages, such as RabbitMQ (a message broker software) and Kafka (a distributed streaming platform).
[0100] 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 indicate the result information obtained by verifying the digital signature obtained from the message middleware.
[0102] Exemplarily, 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; when the verification result of the digital signature is passed, 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 above-mentioned asynchronous processing method of power system microservice messages, the message to be processed sent to the second microservice of the power system is first encrypted to obtain an encrypted message, and the encrypted message is segmented to obtain multiple message blocks of the encrypted message, and then each message block is hashed to obtain a hash value of each message block, and the hash value of each message block is spliced to obtain a spliced hash value. Next, the spliced hash value is hashed again to obtain a root hash value of the encrypted message, and then, the root hash value is signed by 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, and the second microservice verifies the digital signature obtained from the message middleware based on the public key of the first microservice, and when the verification result of the digital signature is passed, the encrypted message obtained from the message middleware is decrypted to obtain the message to be processed. In this way, in the process of asynchronous processing of microservice messages, the first microservice performs a series of processes such as encryption, segmentation, hashing, splicing, re-hashing, signing, etc. on the message to be processed to obtain a digital signature, thereby ensuring the reliability and integrity of the source of the message to be processed, and by sending the encrypted message and the digital signature to the message middleware, the encrypted message and the digital signature can be securely stored, so that the second microservice can process the encrypted message more securely, which is conducive to improving the security of encrypted message processing, thereby improving the security of asynchronous processing of microservice messages; moreover, the entire process performs a variety of different types of security processing methods on the messages to be processed, thereby avoiding the lack of security protection measures in the direct sending and direct receiving methods, which is vulnerable to network attacks, resulting in low security of asynchronous processing of microservice messages, and further improving the security of asynchronous processing of microservice messages.
[0104] In an exemplary embodiment, the private key and the public key of the first microservice are obtained in the following manner: through a developer terminal associated with the power system, a private key to be verified for the first microservice is generated, the private key to be verified is verified to obtain a processed private key, and 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 the processed public key are sent to a certificate authority; the certificate authority is used to re-verify the processed private key to obtain the private key of the first microservice, and re-verify the processed public key to obtain the public key of the first microservice.
[0105] The developer terminal is used to generate and verify the private key to be verified and the public key to be verified of the first microservice.
[0106] 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 a 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 a verification process has been performed.
[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] Exemplarily, the first microservice of the power system generates a private key to be verified for the first microservice 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 to be verified and the public key to be verified for the first microservice are double-verified through the developer terminal and the certificate authority, so that the private key and the public key of the first microservice have higher legitimacy, thereby reducing the risk of illegal use of the private key and the public key, which is conducive to ensuring the security of power system communication and data processing.
[0113] In an exemplary embodiment, the above step S201, encrypts the pending message sent to the second microservice of the power system to obtain an encrypted message, and specifically includes the following contents: perform feature extraction on the pending message sent to the second microservice of the power system to obtain a feature vector of the pending message; input the feature vector into a trained sensitivity prediction model to obtain a predicted sensitivity of the pending message; determine the predicted probability of the pending message under each preset encryption method according to the predicted sensitivity; select the preset encryption method with the largest predicted probability from each preset encryption method as the target encryption method for the pending message; encrypt the pending message according to the target encryption method to obtain an encrypted message.
[0114] The feature vector is used to represent the characterization vector of the message to be processed.
[0115] Among them, the sensitivity prediction model refers to a network model used to obtain the predicted sensitivity of the message to be processed, such as a recurrent neural network model, a convolutional neural network model, etc.
[0116] The predicted 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-set encryption method, such as AES (Advanced Encryption Standard), DES (Data Encryption Standard), etc. It should be noted that the preset encryption method depends on the situation.
[0118] The predicted probability is used to indicate the possibility that the model determines that the preset encryption method is correct.
[0119] The target encryption method refers to the preset encryption method with the highest predicted probability. In the actual scenario, the target encryption method is AES.
[0120] Exemplarily, the first microservice of the power system inputs the message to be processed, which is sent to the second microservice of the power system, into a feature extraction model, and performs feature extraction processing on the message to be processed, which is sent to the second microservice of the power system, through the feature extraction model, to obtain a feature vector of the message to be processed; then, the first microservice of the power system inputs the feature vector into a trained sensitivity prediction model, and obtains the predicted sensitivity of the message to be processed through the trained sensitivity prediction model; then, the first microservice of the power system inputs the predicted sensitivity into a trained encryption method prediction model, and determines the predicted probability of the message to be processed under each preset encryption method based on the predicted sensitivity through the trained encryption method prediction model; then, the first microservice of the power system selects the preset encryption method with the largest predicted probability from each preset encryption method, and uses the preset encryption method as the target encryption method for the message to be processed; then, the first microservice of the power system encrypts the message to be processed according to the target encryption method to obtain an encrypted message.
[0121] In this embodiment, the predicted sensitivity of the message to be processed is obtained through the sensitivity prediction model, and then the predicted probability under each preset encryption method is determined, and the encryption method with the largest predicted probability is selected as the target encryption method, so that the selection of encryption method is more targeted and better adapted to the security requirements of different messages.
[0122] In an exemplary embodiment, the above step S202, which performs segmentation processing on the encrypted message to obtain multiple message blocks of the encrypted message, specifically includes the following contents: obtaining the current length information of the encrypted message; when the current length information is greater than the preset length information, querying the preset correspondence between the length information and the segmentation method according to the current length information, and obtaining the segmentation method corresponding to the current length information as the current segmentation method of the encrypted message; the preset length information is determined by the performance information of the power system; according to the current segmentation method, the encrypted message is segmented to obtain multiple message blocks of the encrypted message.
[0123] The current length information is used to indicate the length value of the encrypted message.
[0124] The preset length information refers to a preset length threshold, which is determined by performance information of the power system.
[0125] Among them, performance information includes network bandwidth, data reading and writing speed and other information.
[0126] The preset corresponding relationship is used to indicate the corresponding relationship between the length information and the segmentation method. For example, when the length information presents regularity (such as the length information is 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 varies 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 the segmentation method of the encrypted message.
[0128] Exemplarily, the first microservice of the power system obtains performance information of the power system from a 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 of the power system, and obtains 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; when 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, and obtains the segmentation method corresponding to the current length information as 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.
[0129] In this embodiment, the preset length information is determined based on the power system performance information, and based on the current length information of the encrypted message, the preset length information and the preset correspondence, the segmentation method that best matches the encrypted message can be determined, so that the encrypted message can be segmented more effectively, which is conducive to improving the overall data processing efficiency.
[0130] In an exemplary embodiment, the above step S204 concatenates the hash value of each message block to obtain a concatenated hash value, which specifically includes the following contents: obtaining the position information of each message block; determining the concatenation order of each message block according to the position information of each message block; and concatenating the hash value of each message block according to the concatenation order to obtain a concatenated hash value.
[0131] The position 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 information of concatenating the hash values of each message block.
[0133] Exemplarily, the first microservice of the power system obtains the structural tag of each message block, and parses the structural 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 splicing 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 when splicing, message block A should be spliced before message block B; then, the first microservice of the power system splices the hash value of each message block in the splicing order to obtain the splicing hash value.
[0134] In this embodiment, the splicing order is determined by obtaining the position information of each message block, and then the hash values of each message block are spliced to obtain a spliced hash value, which is conducive to fully reflecting the entire message content, so that a more accurate spliced hash value can be obtained, thereby improving the accuracy of determining the spliced hash value and providing a data basis for subsequent analysis processes.
[0135] In an exemplary embodiment, the above step S201, before encrypting the pending message sent to the second microservice of the power system to obtain the encrypted message, specifically includes the following contents: determining the target power equipment associated with the second microservice; obtaining the operation information, load information and environmental information of the target power equipment; preprocessing the operation information, load information and environmental information to obtain preprocessed operation information, preprocessed load information and preprocessed environmental information; combining the preprocessed operation information, preprocessed load information and preprocessed environmental information in a preset combination method to obtain combined information as the pending message.
[0136] The target power device is used to represent the power device associated with the second microservice.
[0137] The operation information includes information such as the equipment status and operation parameters of the target power equipment.
[0138] The load information includes information such as the real-time load and load change of the target power equipment.
[0139] The environmental information includes the temperature, humidity and altitude of the target power equipment.
[0140] The pre-processed operation information refers to the operation information after pre-processing.
[0141] The preprocessed load information refers to the load information after preprocessing.
[0142] The preprocessed environmental information refers to environmental information after preprocessing.
[0143] The preset combination mode refers to a preset combination mode, such as combining from left to right. It should be noted that the preset combination mode depends on the situation.
[0144] The combined information refers to information obtained by combining the pre-processed operation information, the pre-processed load information and the pre-processed environment information.
[0145] Exemplarily, the first microservice of the power system obtains the identification information of the power equipment associated with the second microservice; then, the first microservice of the power system determines the power equipment corresponding to the identification information of the power equipment according to the identification information of the power equipment, 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 denoises and normalizes 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 the preset combination method, and combines the preprocessed operation information, preprocessed load information and preprocessed environmental information according to the preset combination method to obtain the combined information as the message to be processed.
[0146] In this embodiment, by obtaining 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 messages to be processed more comprehensive and accurate, which is conducive to improving the accuracy of determining the messages to be processed.
[0147] In an exemplary embodiment, Figure 3 As shown in FIG. 1 , another method for asynchronously processing microservice messages in a power system is provided. The method is applied to Figure 1 The first microservice of the power system in the example is used to illustrate the following steps:
[0148] Step S301, 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 the trained sensitivity prediction model to obtain the predicted sensitivity of the message to be processed.
[0149] Step S302, according to 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 largest 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 an encrypted message.
[0151] Step S304, obtaining the current length information of the encrypted message.
[0152] Step S305, when the current length information is greater than the preset length information, query the preset correspondence between the length information and the segmentation method based on the current length information, and obtain the segmentation method corresponding to the current length information 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, segmenting the encrypted message according to the current segmentation method to obtain multiple message blocks of the encrypted message.
[0154] Step S307: Perform hash operation on each message block to obtain a hash value of each message block.
[0155] Step S308, obtaining the position information of each message block; determining the splicing order of each message block according to the position information of each message block; and splicing the hash value of each message block according to the splicing order to obtain the spliced hash value.
[0156] Step S309, performing hash operation on the concatenated hash value again to obtain the root hash value of the encrypted message.
[0157] Step S310: The root hash value is signed using the private key of the first microservice to obtain a digital signature of the encrypted message.
[0158] Step S311, sending 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 if the verification result of the digital signature is passed, decrypting the encrypted message obtained from the message middleware to obtain the message to be processed.
[0159] In the above-mentioned method for asynchronous processing of microservice messages in the power system, in the process of asynchronous processing of microservice messages, the first microservice performs a series of processes such as encryption, segmentation, hashing, splicing, re-hashing, signing, etc. on the message to be processed to obtain a digital signature, thereby ensuring the reliability and integrity of the source of the message to be processed, and by sending the encrypted message and the digital signature to the message middleware, the encrypted message and the digital signature can be securely stored, so that the second microservice can process the encrypted message more securely, which is conducive to improving the security of encrypted message processing, thereby improving the security of asynchronous processing of microservice messages; moreover, the entire process performs a variety of different types of security processing methods on the messages to be processed, thereby avoiding the lack of security protection measures in the direct sending and direct receiving methods, which is vulnerable to network attacks, resulting in low security of asynchronous processing of microservice messages, and further improves the security of asynchronous processing of microservice messages.
[0160] In an exemplary embodiment, in order to more clearly illustrate the method for asynchronously processing messages of microservices in a power system provided in an embodiment of the present application, the method for asynchronously processing messages of microservices in a power system is specifically described below with a specific embodiment. Figure 4 As shown, the present application also provides an asynchronous message transmission and processing method between microservices of the power system. In the process of asynchronous processing of microservice messages, the to-be-processed message sent to the second microservice of the power system is first encrypted to obtain an encrypted message, and the encrypted message is segmented to obtain multiple message blocks of the encrypted message, and then each message block is hashed to obtain a hash value of each message block, and the hash value of each message block is spliced to obtain a spliced hash value, and then the spliced hash value is hashed again to obtain the root hash value of the encrypted message, and then, the root hash value is signed by the private key of the first microservice to obtain the digital signature of the encrypted message, and finally, the encrypted message and the digital signature are sent to the message middleware, and the second microservice verifies the digital signature obtained from the message middleware based on the public key of the first microservice, and when the verification result of the digital signature is passed, the encrypted message obtained from the message middleware is decrypted to obtain the to-be-processed message. Specifically including the following contents:
[0161] Step 1: The developer terminal is responsible for generating a unique set of private keys. Each microservice corresponds to a pair of private and public keys.
[0162] Step 2: After the private key is generated, the authentication process is executed to verify each private key and its corresponding public key to ensure its security.
[0163] Step 3: Transfer the authenticated private key and public key data to the certificate authority and submit the 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: Use the HashTree algorithm and rejection sampling technology to generate a valid digital signature for each microservice in the certificate authority and build a corresponding verification path.
[0166] Step 6: Send the generated digital signature and verification path to the 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 uses its private key to issue the certificate.
[0168] Step 8: The third-party terminal performs signature verification by calculating the root node of the recovery commitment tree and verifying its legitimacy, while generating the developer signature information.
[0169] Step 9: Design an asynchronous message delivery process to ensure the efficiency and security of communication between microservices. The specific steps are as follows: (1) Microservice A creates a message and encrypts and signs the message; (2) Publishes 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 verification, microservice B performs message processing operations; if verification fails, logs are recorded and the message is discarded.
[0170] Step 10: After microservice B processes the message, it asynchronously feeds back the result to microservice A and updates the system status. If an error occurs during the processing, the error information is fed back to the developer terminal. After the message is processed, the asynchronous message transmission process between the microservices of the entire power system ends.
[0171] Among them, the certificate authority is equipped with the CA (Certificate Authority) public key and CA private key to achieve a two-way secure connection with the authentication signature public key. After registering and applying for a developer certificate, the certificate authority will issue a developer certificate and pass the certificate to the authentication signature public key, and then return it to the certificate authority for final confirmation.
[0172] The generation of legal signatures uses the HashTree algorithm combined with rejection sampling technology, and the verification path is constructed through the BuildAuth algorithm. The data structure of the hash tree node is defined as follows: the internal class Node contains a next array representing the remainder, the value data, and an isDel that marks whether it has been deleted. The node constructor initializes the node attributes according to the passed parameters.
[0173] During the hash tree construction process, the insertion method involves performing a modulo operation on the elements to determine the position, creating a new node if the position is empty, restoring the node if it is logically deleted, and continuing the recursive search if there is already a value;
[0174] The steps of the hash tree insertion method include:
[0175] (1) Perform a remainder 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 the node is logically deleted, restore the node status and update the data.
[0178] (4) If the node already has data, recursively search downward until a vacant position or a logically deleted node is found.
[0179] Among them, the steps of using the HashTree algorithm combined with the rejection sampling technology include: first, for each microservice, a unique hash value is generated according to its public key, and this hash value will be used as the leaf node of the hash tree. Next, the structure of the Merkle (a tree-like data structure) hash tree is used to organize these leaf nodes. In the process of building the hash tree, it is implemented through the following algorithm steps: each non-leaf node is the hash of the hash value of its child node concatenated in series, so that a complete hash tree is gradually built from the leaf node to the root node. In this process, the rejection sampling technology is used to ensure that the node hash values in the hash tree have the characteristics of uniform distribution, thereby improving the efficiency of signature verification.
[0180] The SHA-256 hash algorithm is used to calculate the hash value of the node. The specific steps include: dividing the public key data of the microservice into blocks of fixed size, performing SHA-256 hash operations on each block independently, and then concatenating these hash values, and performing SHA-256 hash operations again to obtain the final hash value. In this way, each microservice obtains a root hash value, which is the digital signature of the microservice. Finally, in order to verify the signature, a verification path is constructed, that is, a path from the leaf node to the root node. This path contains all the necessary intermediate hash values, so that the receiver can independently verify the validity of the signature without accessing the entire hash tree. Such processing not only ensures the security of the signature, but also improves the efficiency of signature verification.
[0181] The detailed steps of decompiling APK (Android Package, an installation package) include:
[0182] Use apkdb (a decompilation tool) tool to decompile by right clicking on the APK file.
[0183] Use apktool (a decompilation and reconstruction tool), place the two files of apktool in the appropriate directory, and execute apktoold (a decompilation command) through the command line to decompile.
[0184] Change the APK file suffix to .zip (a file format), decompress it and extract the classes.dex (a file name) file.
[0185] Use the dex2jar tool to convert classes.dex to a jar file for further analysis.
[0186] Among them, the installation and use steps of zipalign (a tool for optimizing application packages) optimization tool include:
[0187] Install the zipalign tool, making sure it is available in the system path.
[0188] Use the zipalign tool to optimize APK and improve resource indexing efficiency.
[0189] The optimization process includes aligning resource files within the APK on 4-byte boundaries to reduce runtime memory usage.
[0190] Among them, after the third-party terminal receives the data, the terminal will initiate the registration application process for the third-party developer certificate. First, the terminal will generate a pair of public and private keys, in which the private key is used in the subsequent certificate issuance process. Then, the terminal sends the public key together with the developer's identity information to the certificate authority. After verifying the developer's identity, the certificate authority uses its CA private key to digitally sign the third-party developer's public key information to generate a developer certificate. Subsequently, the certificate authority sends the certificate back to the third-party terminal. After receiving the certificate, the terminal uses its pre-generated private key to issue the certificate to ensure the validity of the certificate and the authenticity of the terminal's identity. This process can be achieved through the Elliptic Curve Digital Signature Algorithm (ECDSA), in which the private key is used for signing and the public key is used to verify the legitimacy of the signature.
[0191] Among them, when performing signature verification, the third-party terminal will use the Commitment Tree algorithm to restore the root node of the commitment tree and verify its legitimacy. The terminal first receives the data containing the signature, and then uses the same hash function and construction process to rebuild the commitment tree. For each data element, the terminal calculates its commitment and inserts it into the commitment tree. By recursively calculating the hash value of the parent node until the root node is reached, the terminal can restore the root hash value of the commitment tree. Next, the terminal uses the public key in 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 achieved through the Hash Chain algorithm to ensure the integrity and verifiability of the signature.
[0192] The asynchronous messaging process is designed to ensure efficient and secure 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 performed using the Advanced Encryption Standard (AES) encryption and digital signature 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 topic or queue of the message so that other microservices can subscribe 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 the public key of microservice A to verify the legitimacy 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 the validation fails, Microservice B will record detailed error logs and discard the invalid message to prevent potential security threats.
[0193] Among them, after processing the message, microservice B asynchronously feeds back the processing result to microservice A. This step can be achieved by sending a confirmation message or callback function. At the same time, microservice B updates the system status to reflect the latest status of message processing. If an error occurs during the processing, microservice B will feed back the error information to the developer terminal so that the developer can understand the system status in time and perform necessary debugging or repairs. When microservice B completes the result feedback and status update, the asynchronous message transmission process between the microservices of the entire power system is declared over, ensuring the stable operation and efficient communication of the system.
[0194] The above embodiments can achieve the following technical effects:
[0195] (1) In the process of asynchronous processing of microservice messages, the first microservice performs a series of processes such as encryption, segmentation, hashing, concatenation, re-hashing, and signing on the message to be processed to obtain a digital signature, thereby ensuring the source reliability and integrity of the message to be processed. The encrypted message and the digital signature are sent to the message middleware, so that the encrypted message and the digital signature can be securely stored, so that the second microservice can process the encrypted message more securely, which is conducive to improving the security of encrypted message processing, thereby improving the security of asynchronous processing of microservice messages. Moreover, the entire process uses a variety of different types of security processing methods to process the message to be processed, avoiding the lack of security protection measures in the direct sending and direct receiving methods, which is vulnerable to network attacks and leads to low security of asynchronous processing of microservice messages, thereby further improving the security of asynchronous processing of microservice messages.
[0196] (2) By using digital signature and encryption technology when transmitting messages between microservices, the security of power system microservices is significantly improved. Digital signatures ensure the integrity of messages and the non-repudiation of their origin, that is, the receiver can verify that the message is 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 the content of messages, thereby protecting the stable operation and data security of the power system. In addition, encryption technology ensures the confidentiality of the message content. Even if the message is intercepted during transmission, unauthorized third parties cannot interpret the message content, which is crucial to preventing the leakage of sensitive information. Therefore, the beneficial effect of this method is that it provides a safe and reliable environment for communication between power system microservices and enhances 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 independently handle its own tasks without having to block and wait for responses from other services. This mechanism reduces the waiting time of system resources and improves resource utilization, thereby improving 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 hours and avoid 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 processing complex business logic, thereby improving the overall performance and reliability of the system.
[0198] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0199] Based on the same inventive concept, the embodiment of the present application also provides a power system microservice message asynchronous processing device for implementing the power system microservice message asynchronous processing method involved above. The implementation solution for solving the problem provided by the device is similar to the implementation solution recorded in the above method, so the specific limitations in one or more power system microservice message asynchronous processing device embodiments provided below can refer to the limitations of the power system microservice message asynchronous processing method above, and will not be repeated here.
[0200] In an exemplary embodiment, Figure 5 As shown, a power system microservice message asynchronous processing device is provided, including: a message encryption module 501, a message segmentation module 502, a message block processing module 503, a hash value splicing 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 to-be-processed message sent to the second microservice of the power system to obtain an encrypted message.
[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 operation processing on each message block to obtain a 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 a concatenated hash value.
[0205] The hash value processing module 505 is used to perform a hash operation on the concatenated hash value again to obtain a 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 if the verification result of the digital signature is passed, decrypt the encrypted message obtained from the message middleware to obtain the message to be processed.
[0208] In an exemplary embodiment, the power system microservice message asynchronous processing device also 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, and obtain a processed private key, and generate a public key to be verified for the first microservice, verify the public key to be verified, and 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 re-verify the processed private key to obtain the private key of the first microservice, and re-verify the processed public key to obtain the public key of the first microservice.
[0209] In an exemplary embodiment, the message encryption module 501 is also used to perform feature extraction processing on the pending message sent to the second microservice of the power system to obtain a feature vector of the pending message; input the feature vector into a 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 according to the predicted sensitivity; from each preset encryption method, select the preset encryption method with the largest predicted probability as the target encryption method for the pending message; encrypt the pending message according to the target encryption method to obtain an encrypted message.
[0210] In an exemplary embodiment, the message segmentation module 502 is also used to obtain the current length information of the encrypted message; when the current length information is greater than the preset length information, the preset correspondence between the length information and the segmentation method is queried based on the current length information, and the segmentation method corresponding to the current length information is obtained as the current segmentation method of the encrypted message; the preset length information is determined by the performance information of the power system; according to the current segmentation method, the encrypted message is segmented to obtain multiple message blocks of the encrypted message.
[0211] In an exemplary embodiment, the hash value splicing module 504 is further used to obtain the position information of each message block; determine the splicing order of each message block according to the position information of each message block; and splice the hash value of each message block according to the splicing order to obtain the spliced hash value.
[0212] In an exemplary embodiment, the power system microservice message asynchronous processing device also includes a message generation module, which is 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; 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 above-mentioned power system microservice message asynchronous processing device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0214] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 6 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as messages to be processed and digital signatures. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for asynchronous processing of microservice messages in a power system is implemented.
[0215] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0216] In an exemplary embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0217] In an exemplary embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0218] In an exemplary embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0219] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium 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), magnetoresistive 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. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0220] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, 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 above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for asynchronously processing microservice messages in a power system, characterized in that: A first microservice applied to a power system, the method comprising: Encrypting a to-be-processed message sent to a second microservice of the power system to obtain an encrypted message; Segmenting the encrypted message to obtain multiple message blocks of the encrypted message; Performing hash operation processing on each message block to obtain a hash value of each message block; Performing splicing processing on the hash value of each message block to obtain a spliced hash value; Performing a hash operation on the concatenated hash value again to obtain a root hash value of the encrypted message; The root hash value is signed using the private key of the first microservice to obtain a 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 passed, 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 key and public key of the first microservice are obtained in the following way: Through a developer terminal associated with the power system, a private key to be verified for the first microservice is generated, the private key to be verified is verified to obtain a processed private key, and 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 the processed public key are sent to a certificate authority; the certificate authority is used to re-verify the processed private key to obtain the private key of the first microservice, and re-verify the processed public key to obtain the public key of the first microservice.
3. The method according to claim 1, characterized in that The step of encrypting the to-be-processed message sent to the second microservice of the power system to obtain an encrypted message includes: Performing feature extraction processing on a to-be-processed message sent to a second microservice of the power system to obtain a feature vector of the to-be-processed message; Inputting the feature vector into a trained sensitivity prediction model to obtain a predicted sensitivity of the message to be processed; Determining, according to the prediction sensitivity, a prediction probability of the message to be processed under each preset encryption mode; From each of the preset encryption modes, select the preset encryption mode with the largest predicted probability as the target encryption mode of the message to be processed; The message to be processed is encrypted according to the target encryption method to obtain the encrypted message.
4. The method according to claim 1, characterized in that: The step of segmenting the encrypted message to obtain a plurality of message blocks of the encrypted message includes: Obtaining current length information of the encrypted message; In the case where the current length information is greater than the preset length information, querying the preset correspondence between the length information and the segmentation mode according to the current length information, obtaining the segmentation mode corresponding to the current length information as the current segmentation mode of the encrypted message; the preset length information is determined by the performance information of the power system; The encrypted message is segmented according to the current segmentation method to obtain multiple message blocks of the encrypted message.
5. The method according to claim 1, characterized in that The step of concatenating the hash values of each message block to obtain a concatenated hash value includes: Obtaining location information of each message block; Determining a splicing order of each message block 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.
6. The method according to any one of claims 1 to 5, characterized in that: Before encrypting the to-be-processed message sent to the second microservice of the power system to obtain the encrypted message, the method further includes: Determining a target power device associated with the second microservice; Acquiring operation information, load information and environmental information of the target electric equipment; Preprocessing the operation information, the load information and the environment information to obtain preprocessed operation information, preprocessed load information and preprocessed environment information; The preprocessed operation information, the preprocessed load information and the preprocessed environment information are combined and processed according to a preset combination method to obtain combined information as the message to be processed.
7. A device for asynchronously processing microservice messages in a power system, characterized in that: A first microservice applied to a power system, the device comprising: A message encryption module, used for encrypting a to-be-processed message sent to the second microservice of the power system to obtain an encrypted message; A message segmentation module, used for segmenting the encrypted message to obtain multiple message blocks of the encrypted message; A message block processing module, used for performing a hash operation on each message block to obtain a hash value of each message block; A hash value splicing module, used for splicing the hash value of each message block to obtain a spliced hash value; A hash value processing module, used for performing a hash operation on the concatenated hash value again to obtain a root hash value of the encrypted message; A hash value signature module, used to sign the root hash value using the private key of the first microservice to obtain a digital signature of the encrypted message; An 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 passed, decrypt the encrypted message obtained from the message middleware to obtain the message to be processed.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Data storage method, system and device, equipment and storage medium
CN112800450A
Block chain network node and resource file positioning method and device
CN118041925A