Multi-strategy encrypted transaction data processing method, system, device and storage medium
Through the multi-strategy encryption method and the collaborative mechanism of edge computing nodes, the problems of high cost, low efficiency and opaque transaction data transmission in V2G network are solved, and safe and efficient transaction data processing is achieved.
Patent Information
- Application Number
- CN202510235205.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-28
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2045-02-28
AI Technical Summary
In the existing V2G network, the encrypted transmission cost of electric vehicle transaction data is high, low efficiency and not transparent enough. The existing transaction mechanism has the problems of high encryption transmission cost, low efficiency and not transparent enough.
The multi-strategy encryption method is adopted, and the smart contract is selected through encryption policy to filter the appropriate encryption algorithm according to the data call request, encrypt the transaction data, and use edge computing nodes to perform encryption processing, combine the collaborative mechanism to verify the transaction data and record it on the blockchain.
It realizes that on the premise of ensuring the security of transaction data, it improves transmission efficiency, reduces transmission costs, and ensures fairness and transparency of transaction prices and improves data security.
Smart Images

Figure CN120074933B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of V2G network technology, and in particular to a multi-strategy encrypted transaction data processing method, system, device and storage medium. Background Art
[0002] The V2G (Vehicle-to-Grid) network is a bidirectional energy exchange technology between electric vehicles and the power grid. Electric vehicles connect to the V2G network through dedicated parking facilities and provide ancillary services to the smart grid under the control of local aggregators. Electric vehicles have three states: charging, discharging, and distributed discharging. Charging is initiated by the electric vehicle, and power is transmitted from the smart grid to the electric vehicle, for which the electric vehicle pays the smart grid for electricity. Discharging is initiated by the smart grid when the grid is overloaded during peak user demand periods. Electric vehicles can alleviate power shortages by discharging to the grid and receive financial rewards from the smart grid. Distributed discharging is initiated by one or more electric vehicles when the battery capacity falls below a certain threshold. Unlike the charging state, electric vehicles with sufficient power temporarily act as energy suppliers for electric vehicles with insufficient power, and the latter are required to pay the supplier for electricity.
[0003] In existing V2G networks, electric vehicle payment transactions must ensure the security of sensitive user information when sharing data. Therefore, most current payment mechanisms are based on blockchain. Although blockchain-based information transmission mechanisms have trusted entities to ensure security, existing transaction mechanisms still have the following problems:
[0004] (1) High encryption transmission cost: Existing transaction solutions use the same encryption protocol during data transmission, which results in a large amount of data but low security consuming a lot of costs.
[0005] (2) Low efficiency of encrypted transmission: Existing transaction schemes use a transmission encryption protocol for information transmission of different data volumes, which will cause the transmission speed of some data that is not suitable for this protocol to be abnormally slow.
[0006] (3) Insufficient price transparency: The price results after the transaction are not fairly reviewed and publicly recorded, and the transaction price results are not fair and transparent. Summary of the Invention
[0007] In order to improve transmission efficiency and reduce transmission costs while ensuring the security of transaction data, the present application provides a multi-strategy encrypted transaction data processing method, system, device and storage medium.
[0008] In order to achieve the above-mentioned purpose of the present invention, the present invention provides a transaction data processing method with multi-strategy encryption.
[0009] The present invention provides a multi-strategy encrypted transaction data processing method, comprising:
[0010] Obtain transaction data and data call requests;
[0011] The transaction data and data call request are input into the encryption strategy selection smart contract. The encryption strategy selection smart contract determines the call information of the transaction data based on the data call request, selects the encryption algorithm that meets the screening conditions from the preset encryption algorithm library based on the call information as the target encryption strategy, and outputs the target encryption strategy;
[0012] The target encryption policy is sent to the edge computing node to control the edge computing node to encrypt the transaction data according to the target encryption policy to obtain encrypted transaction data.
[0013] Optionally, the call information includes the call data volume and the call data security quantification value, and the encryption algorithm library includes symmetric encryption algorithms, asymmetric encryption algorithms, and hybrid encryption algorithms;
[0014] Based on the call information, the encryption algorithm that meets the screening conditions is filtered out from the encryption algorithm library as the target encryption policy, including:
[0015] Compare the call data volume and the data volume reference value, and compare the call data security quantification value and the data security reference value:
[0016] If the amount of data being called is less than the data amount reference value and the quantified value of the security of the data being called is less than the data security reference value, the symmetric encryption algorithm is selected as the target encryption strategy;
[0017] If the amount of data being called is less than the data amount reference value and the quantified value of the security of the data being called is greater than or equal to the data security reference value, then the asymmetric encryption algorithm is selected as the target encryption strategy;
[0018] If the amount of data being called is greater than or equal to the reference value of the amount of data, the hybrid encryption algorithm is selected as the target encryption strategy.
[0019] Optionally, when a symmetric encryption algorithm is selected as the target encryption strategy, the process of encrypting transaction data by the edge computing node includes:
[0020] Monitor the first encryption instruction, and generate a round key set {K0, K1, ..., K n} = KeyExpansion(K);
[0021] Among them, K represents the symmetric key, KeyExpansion(.) is the key expansion function, K0 represents the round key of the initial round, K1 represents the round key of the first round, K n represents the round key of the nth round, where n represents the total number of rounds;
[0022] Initial round execution P represents the original plaintext, Indicates the exclusive OR operation, P (0) Represents the plaintext intermediate result after the initial round of processing;
[0023] For each round i (1≤i≤n-1), perform the following operations:
[0024] P (i) =AddRoundKey(MixColumns(ShiftRows(SubBytes(P (i-1) ))),K i ),
[0025] P (i) represents the intermediate result of the plaintext after the i-th round of processing, K i represents the round key of round i, P (i-1) Indicates the intermediate plaintext result after the i-1th round of processing, AddRoundKey(.,K i ) represents the round key K i Perform an XOR operation, MixColumns(.) represents a column mixing operation, ShiftRows(.) represents a row shift operation, and SubBytes(.) represents a byte replacement operation;
[0026] Final round execution: C = AddRoundKey(ShiftRows(SubBytes(P (n-1) )),K n ), AddRoundKey(.,K n ) represents the round key K n Perform XOR operation, P (n-1) Indicates the intermediate plaintext result after the n-1th round of processing.
[0027] Optionally, when an asymmetric encryption algorithm is selected as the target encryption strategy, the process of encrypting transaction data by the edge computing node includes:
[0028] Monitor the second encryption instruction, randomly select two coprime numbers p and q after monitoring the second encryption instruction, and calculate N=p*q, where "*" represents a multiplication operation;
[0029] Calculate the Euler function of N
[0030] Randomly select an integer E, provided that And E and mutually prime;
[0031] Calculate E for The modular inverse element D of , we get the public key (E, N) and the private key (D, N).
[0032] Optionally, when a hybrid encryption algorithm is selected as the target encryption strategy, the edge computing node encrypts transaction data in the following steps:
[0033] monitoring a third encryption instruction, and generating a symmetric key K=GenerateKey() after detecting the third encryption instruction, where the GenerateKey() function is used to generate one or more random or pseudo-random byte sequences;
[0034] Create a multi-thread pool ThreadPool for encryption and decryption CP , the original plaintext P to be encrypted is input into the encryption and decryption multi-thread pool for mixed encryption, and the output ciphertext C = (C1, C2); C1 represents the encrypted plaintext, C1 = E1 (K, P), E1 (.) represents the encryption operation, K represents the symmetric key; C2 represents the encrypted symmetric key, C2 = K E mod N, N = p*q, N represents the product of two coprime numbers p and q, E represents a random integer, and "*" represents a multiplication operation.
[0035] Optionally, the method further includes:
[0036] Edge computing nodes use a collaborative mechanism to mobilize both parties to verify the encrypted transaction data.
[0037] Optionally, the transaction parties include the electric vehicle party and the power grid party, and the edge computing node uses a collaborative mechanism to mobilize the transaction parties to verify the encrypted transaction data, including:
[0038] The edge computing node verifies the identity information of the electric vehicle party and the grid party, and sends a verification instruction to the electric vehicle party and the grid party when the identity information of the electric vehicle party and the grid party are both verified;
[0039] receiving a first verification result obtained by the electric vehicle party verifying the encrypted transaction data in response to the verification instruction;
[0040] receiving a second verification result obtained by the power grid party verifying the encrypted transaction data in response to the verification instruction;
[0041] Compare the first verification result and the second verification result. If both the first verification result and the second verification result are verified to be passed, the transaction data is recorded in the blockchain.
[0042] In order to solve the above problems, the present invention also provides a multi-strategy encrypted transaction data processing system, which includes an electric vehicle, a power grid, an edge computing node and a processing center;
[0043] Both electric vehicles and the power grid are used to send transaction data and data call requests;
[0044] A processing center, configured to execute the above-mentioned multi-strategy encrypted transaction data processing method;
[0045] The processing center includes encryption strategy selection smart contract and blockchain system,
[0046] The encryption strategy selection smart contract is used to determine the call information of the transaction data according to the data call request, and based on the call information, select the encryption algorithm that meets the screening conditions from the preset encryption algorithm library as the target encryption strategy, and output the target encryption strategy;
[0047] The blockchain system is used to store encrypted transaction data;
[0048] The edge computing node is used to encrypt the transaction data according to the target encryption strategy and output the encrypted transaction data.
[0049] In order to solve the above problem, the present invention further provides an electronic device, comprising:
[0050] at least one processor; and,
[0051] a memory communicatively connected to the at least one processor; wherein,
[0052] The memory stores a computer program that can be executed by the at least one processor. The computer program is executed by the at least one processor to enable the at least one processor to execute the multi-strategy encrypted transaction data processing method described above.
[0053] In order to solve the above problems, the present invention also provides a computer-readable storage medium, which stores at least one computer program. The at least one computer program is executed by a processor in an electronic device to implement the above-mentioned multi-strategy encrypted transaction data processing method.
[0054] In summary, this application has the following beneficial technical effects:
[0055] The encryption strategy selection smart contract can determine the call information of the transaction data based on the data call request, and filter out the encryption algorithm that meets the screening conditions from the preset encryption algorithm library as the target encryption strategy and synchronize it to the edge computing node; for transaction data of different data sizes or different security levels, different encryption algorithms are used to encrypt the transaction data, ensuring the security of transaction data transmission while achieving faster transmission speeds and effectively reducing data transmission costs.
[0056] Edge computing nodes use a collaborative mechanism to mobilize both parties to the transaction to verify the encrypted transaction data. Through secure multi-party computing technology, multiple parties are allowed to participate in the calculation and verification of encrypted transaction data and record it on the blockchain, ensuring the fairness, transparency and unchangeability of transaction prices, further improving data security. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 A flowchart of a multi-strategy encrypted transaction data processing method provided by one embodiment of the present invention;
[0058] Figure 2 The data processing performance test results of the three encryption algorithms in the preset encryption algorithm library;
[0059] Figure 3 A schematic diagram of the steps for selecting an encryption algorithm that meets the screening criteria from an encryption algorithm library based on call information provided in one embodiment of the present invention;
[0060] Figure 4 Schematic diagram of the processing flow of the privacy-preserving electricity price coordination mechanism based on trusted identity of the present invention;
[0061] Figure 5 This is an overall framework diagram of a multi-strategy encrypted transaction data processing system provided by one embodiment of the present invention;
[0062] Figure 6 A schematic structural diagram of an electronic device for implementing the multi-strategy encrypted transaction data processing method provided by an embodiment of the present invention.
[0063] Reference numerals: 10, processor; 11, memory; 12, communication bus; 13, communication interface.
[0064] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings and in conjunction with the embodiments. DETAILED DESCRIPTION
[0065] The following describes embodiments of the present invention in detail. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended only to explain the present invention and are not to be construed as limiting the present invention.
[0066] In the description of the present invention, it should be understood that the terms "longitudinal", "transverse", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc., indicating the orientation or position relationship, are based on the orientation or position relationship shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention.
[0067] In the description of the present invention, unless otherwise specified and limited, it should be noted that the terms "installed", "connected" and "connected" should be understood in a broad sense. For example, it can be a mechanical connection or an electrical connection, or it can be the internal communication between two components. It can be a direct connection or an indirect connection through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to the specific circumstances.
[0068] Reference Figure 1 FIG. 1 is a flow chart of a method for processing transaction data using multi-strategy encryption according to an embodiment of the present invention. In this embodiment, the method for processing transaction data using multi-strategy encryption includes:
[0069] S1. Obtain transaction data and data call request.
[0070] Transaction data includes charging and discharging data (such as the amount of electricity obtained by electric vehicles from the power grid or the amount of electricity fed back to the power grid by electric vehicles), electricity price and cost data (such as electricity price information when electric vehicles are charging or information on the benefits obtained from electric vehicles discharging to the power grid), vehicle data (such as the identity information of vehicles participating in V2G (Vehicle-to-Grid) transactions), battery status data (such as key parameters such as the remaining battery power, health status, temperature, etc.) and power grid data (such as the load situation of the power grid, electricity price fluctuations, etc.).
[0071] A data call request refers to an instruction used to guide or control specific operations or behaviors in the transaction data encryption processing process. A data call request includes multiple contents such as data transmission instructions and access control instructions. Among them, data transmission instructions are instructions used to guide how to securely transmit encrypted transaction data in the network, such as data encapsulation, routing selection, security protocols, etc.; access control instructions are used to limit access rights to transaction data and control instructions; data call requests can also include other action information related to transaction data transmission and encryption, which will not be listed one by one in this embodiment.
[0072] S2. Input the transaction data and data call request into the encryption strategy selection smart contract. The encryption strategy selection smart contract determines the call information of the transaction data according to the data call request, and selects the encryption algorithm that meets the screening conditions from the preset encryption algorithm library as the target encryption strategy according to the call information, and outputs the target encryption strategy.
[0073] The call information includes the call data volume and the call data security quantification value. The call data security quantification value is used to characterize the security required for the pending transaction data during the transmission and sharing process. The encryption algorithm library includes symmetric encryption algorithms, asymmetric encryption algorithms and hybrid encryption algorithms.
[0074] Figure 2 (a) shows the data processing performance test results of the symmetric encryption algorithm. Figure 2 (b) shows the data processing performance test results of the asymmetric encryption algorithm. Figure 2 (c) shows the data processing performance test results of the hybrid encryption algorithm; Figure 2 The horizontal axis of the three figures represents the amount of data processed, and the unit of data volume is byte. Figure 2 The vertical axis of the three figures represents the processing time, and the unit of processing time is seconds (s); symmetric encryption algorithms are relatively simple, with efficient encryption and decryption processes, suitable for processing large amounts of data, but lack security; asymmetric encryption algorithms have high security, but slow encryption and decryption speeds; hybrid encryption algorithms combine the advantages of symmetric and asymmetric encryption. In hybrid encryption algorithms, symmetric encryption is responsible for encrypting data, which improves encryption and decryption speeds; asymmetric encryption is responsible for encrypting the keys of symmetric encryption, which enhances security, but is more complex to implement. Figure 2 From the performance test results of the encryption algorithm, asymmetric encryption algorithm and hybrid encryption algorithm shown, it can be seen that: information with small data volume and low security requirements is suitable for symmetric encryption algorithm; information with small data volume and high security requirements is suitable for asymmetric encryption algorithm; information with large data volume and certain security requirements is suitable for hybrid encryption algorithm.
[0075] Reference Figure 3 The encryption strategy corresponding to the symmetric encryption algorithm is recorded as Algorithm 1 strategy, the encryption strategy corresponding to the asymmetric encryption algorithm is recorded as Algorithm 2 strategy, and the encryption strategy corresponding to the hybrid encryption algorithm is recorded as Algorithm 3 strategy; the amount of data called is recorded as D C , the call data security quantification value is recorded as S C ;
[0076] Based on the above analysis, the steps of selecting an encryption algorithm that meets the screening criteria from the encryption algorithm library according to the call information as the target encryption policy include:
[0077] Compare the call data volume and the data volume reference value, and compare the call data security quantification value and the data security reference value:
[0078] If the amount of data being called is less than the data amount reference value and the quantified value of the security of the data being called is less than the data security reference value, the encryption strategy selection smart contract outputs to the edge computing node the selected symmetric encryption algorithm as the target encryption strategy;
[0079] If the amount of data being called is less than the data volume reference value and the quantified value of the security of the data being called is greater than or equal to the data security reference value, the encryption strategy selection smart contract outputs to the edge computing node the selection of an asymmetric encryption algorithm as the target encryption strategy;
[0080] If the amount of called data is greater than or equal to the data volume reference value, the encryption strategy selection smart contract outputs the selected hybrid encryption algorithm as the target encryption strategy to the edge computing node.
[0081] In this embodiment, the data volume reference value is set to 1MB, and the data security reference value is set to 0; MB is short for Megabyte, which is one of the computer storage units and represents megabytes; in this embodiment, the following principles can be followed when setting the call data security quantization value: if the transaction data to be processed is related to the transaction amount and identity information, the call data security quantization value is set to be greater than 0; otherwise, the call data security quantization value is set to be less than 0.
[0082] In a preferred implementation of this embodiment, if the amount of called data is greater than 10MB, the encrypted data to be called is packaged into blocks, with the amount of each block being less than or equal to 10MB, and a hybrid encryption algorithm is selected as the target encryption strategy for each block.
[0083] S3. Send the target encryption policy to the edge computing node to control the edge computing node to encrypt the transaction data according to the target encryption policy to obtain encrypted transaction data.
[0084] Specifically, when a symmetric encryption algorithm is selected as the target encryption strategy, the edge computing node encrypts transaction data in the following steps:
[0085] Monitor the first encryption instruction, and generate a round key set {K0, K1, ..., K n} = KeyExpansion(K);
[0086] Among them, K represents the symmetric key, KeyExpansion(.) is the key expansion function, K0 represents the round key of the initial round, K1 represents the round key of the first round, K n represents the round key of the nth round, where n represents the total number of rounds;
[0087] Initial round execution P represents the original plaintext, Indicates the exclusive OR operation, P (0) Represents the plaintext intermediate result after the initial round of processing;
[0088] For each primary round i (1≤i≤n-1), perform the following operations:
[0089] P (i) =AddRoundKey(MixColumns(ShiftRows(SubBytes(P (i-1) ))),K i ),
[0090] P (i) represents the intermediate result of the plaintext after the i-th round of processing, K i Indicates the round key of round i, i represents the round number index of the main round. The round number index of the main round of the encryption process refers to the way of numbering or identifying the main encryption rounds in the encryption algorithm. (i-1) Indicates the intermediate plaintext result after the i-1th round of processing, AddRoundKey(.,K i ) represents the round key K i Perform an XOR operation, MixColumns(.) represents a column mixing operation, ShiftRows(.) represents a row shift operation, and SubBytes(.) represents a byte replacement operation.
[0091] Final round execution: C = AddRoundKey(ShiftRows(SubBytes(P (n-1) )),K n ), AddRoundKey(.,K n ) represents the round key K n Perform XOR operation, P (n-1) Indicates the intermediate plaintext result after the n-1th round of processing.
[0092] The decryption step of the symmetric encryption algorithm includes generating a set of round keys {K0, K1, ..., K n}=KeyExpansion(K).
[0093] The generation process of the round key set is:
[0094] Initial round execution
[0095] C (n) represents the output result of the initial round in the decryption process, C represents the final ciphertext generated after encryption,
[0096] For each primary round i (1≤i≤n-1), perform the following operations:
[0097] C (i-1) =
[0098] InvSubBytes(InvShiftRows(InvMixColumns(AddRoundKey(C (i) ,K i )))),
[0099] Among them, C (i-1) Indicates the intermediate ciphertext result after the i-1th round of processing, InvSubBytes(.) indicates the byte substitution inverse operation, InvShiftRows(.) indicates the row shift inverse operation, and InvMixColumns(.) indicates the column mixing inverse operation.
[0100] Final round execution:
[0101] P=InvSubBytes(InvShiftRows((AddRoundKey(C (1) ,K0))), where P represents the final plaintext.
[0102] Furthermore, when an asymmetric encryption algorithm is selected as the target encryption strategy, the edge computing node encrypts transaction data in the following ways:
[0103] Monitor the second encryption instruction, randomly select two coprime numbers p and q after monitoring the second encryption instruction, and calculate N=p*q, where "*" represents a multiplication operation;
[0104] Calculate the Euler function of N
[0105] Randomly select an integer E, provided that And E and Coprime; calculate E for The modular inverse element D, Express Perform a modulo operation and finally obtain the public key (E, N) and private key (D, N).
[0106] In the asymmetric encryption algorithm, the encrypted ciphertext C = P E mod N, decrypted plaintext P = C D mod N.
[0107] Furthermore, when the hybrid encryption algorithm is selected as the target encryption strategy, the process of encrypting transaction data by the edge computing node includes:
[0108] monitoring a third encryption instruction, and generating a symmetric key K=GenerateKey() after detecting the third encryption instruction, where the GenerateKey() function is used to generate one or more random or pseudo-random byte sequences;
[0109] Create a multi-thread pool ThreadPool for encryption and decryption CP , put the original plaintext P to be encrypted in the multi-threaded encryption and decryption information multi-threaded hybrid encryption, output ciphertext C = (C1, C2); C1 represents the encrypted plaintext, C1 = E1 (K, P), E1 (.) represents the encryption operation, K represents the symmetric key; C2 represents the encrypted symmetric key, C2 = K E mod N, N=p*q, N represents the product of two coprime numbers, and E represents a random integer.
[0110] When decrypting, the hybrid encryption algorithm uses the decryption symmetric key for decryption. The expression of the decryption symmetric key K is:
[0111] Decrypted ciphertext P = D1(K, C1), where D1(.) represents the encryption operation, K represents the decryption symmetric key, and C1 represents the encrypted plaintext.
[0112] In another embodiment of the present application, the multi-strategy encrypted transaction data processing method further includes:
[0113] Edge computing nodes use a collaborative mechanism to mobilize both parties to verify the encrypted transaction data.
[0114] The transaction parties include the electric vehicle party and the power grid party. The edge computing node uses a collaborative mechanism to mobilize the transaction parties to verify the encrypted transaction data, including:
[0115] The edge computing node verifies the identity information of the electric vehicle party and the grid party, and sends a verification instruction to the electric vehicle party and the grid party when the identity information of the electric vehicle party and the grid party are both verified;
[0116] receiving a first verification result obtained by the electric vehicle party verifying the encrypted transaction data in response to the verification instruction;
[0117] receiving a second verification result obtained by the power grid party verifying the encrypted transaction data in response to the verification instruction;
[0118] Compare the first verification result and the second verification result. If both the first verification result and the second verification result are verified to be passed, the transaction data is recorded in the blockchain.
[0119] To facilitate understanding by those skilled in the art, the following describes the process in which both parties to a transaction utilize a collaborative mechanism to mobilize the other party to verify the encrypted transaction data with reference to a specific example.
[0120] Reference Figure 4 Taking the transaction scenario where electric vehicles receive economic rewards by discharging electricity to the grid as an example, the processing flow of the privacy-preserving electricity price coordination mechanism based on trusted identity includes:
[0121] S401. Parameter definition.
[0122] In the transaction scenario where electric vehicles obtain economic rewards by discharging electricity to the grid, the transaction data includes the amount of electricity E that the electric vehicle can sell. avail (Unit: kWh), the lowest electricity price P that electric vehicles are willing to accept min (Unit: Yuan / kWh), the current power demand of the power grid D need (Unit: kWh) and the maximum electricity purchase price P that the grid is willing to pay max (yuan / kWh) and time peak-valley coefficient T. The time peak-valley coefficient is a correction coefficient used to reflect the electricity price fluctuations in the current time period, and its value range is [0,1].
[0123] Define the calculation model of transaction price P:
[0124]
[0125] Among them, w1 is the first weight coefficient, w2 is the second weight coefficient, w1 reflects the influence of electric vehicles, and w2 reflects the influence of the power grid. The weight calculation is based on the power supply and demand:
[0126] S402: Initialize the coordination mechanism.
[0127] Initializing the collaborative mechanism is a preparatory work in the early stage of the collaborative mechanism, which defines some operation rules in the collaborative mechanism:
[0128] Collaborative addition: [x+y] i =[x] i +[y] i mod q, where x and y are two values involved in the addition operation. In this formula, i represents the identifier of the participant. The value of i is A or B, where A represents the electric vehicle party and B represents the grid party. [x] i represents the secret share of x held by participant i, [y] i represents the secret share of y held by participant i.
[0129] The purpose of collaborative multiplication calculation is to generate multiplication triples. When collaborative division calculation is performed, Newton iteration method is used to calculate When y is equal to y, first calculate the reciprocal of y -1 , then calculate z = x * y -1 .
[0130] S403. Integrate the functions of the registration agency for the edge computing node.
[0131] Edge computing nodes can issue certificates and manage identity authentication transactions within the local area.
[0132] S404: Identity authentication.
[0133] Specifically, the identity authentication process of the two parties to the transaction (the electric vehicle party and the grid party) includes:
[0134] 404.1: RA settings.
[0135] The full English name of RA is Registration Authority, which means registration agency.
[0136] The registration authority holds a key pair (pk, sk), where pk represents the public key and sk represents the private key;
[0137] The registration authority RA is responsible for maintaining the certificate repository, which stores the user's private key sk and identity information, and obtains the public key pk through public channels.
[0138] 404.2: Electric vehicle party account registration.
[0139] Specifically, the registration steps for electric vehicles include:
[0140] a. Generate a key pair (pk A ,sk A ), where pk A Indicates the public key of the electric vehicle, sk A Represents the private key of the electric vehicle.
[0141] b. The electric vehicle submits the public key pk to RA A and electric vehicle ID A .
[0142] Electric vehicle identity information ID A Including vehicle license plates and personal ID cards, etc.
[0143] c. Get the RA signature of the electric vehicle: σ A =sign(sk,pk A )
[0144] d. Based on the electric vehicle's signature and the electric vehicle's public key pk A Generate a valid account: account A =(pk A ,σ A )
[0145] 404.3: Grid account registration.
[0146] Specifically, the registration steps for the grid include:
[0147] a. Generate a key pair (pk B ,sk B ), where pk B Indicates the public key of the power grid, sk B Indicates the private key of the grid party.
[0148] b. The power grid submits the public key pk to RA B and the grid's identity ID B .
[0149] The identity information of the power grid includes the power grid operation license, etc.
[0150] c. Obtain the signature of the RA grid: σ B =sign(sk,pk B ).
[0151] d. Generate a legal account based on the grid's signature: account B =(pk B ,σ B ).
[0152] 404.4: Account authentication.
[0153] a. The electric vehicle party and the grid party exchange their respective account information (account A and account B )
[0154] b. The electric vehicle verifies the grid account: B =Verify(pk,pk B ,σ B ),
[0155] v B is the Boolean value output by the electric vehicle, v B The value is 0 or 1; Verify(.) is the verification parameter. If the value input to the Verify(.) function is correct, the output result of Verify(.) is 1; if the value input to the Verify(.) function is incorrect, the output result of Verify(.) is 0.
[0156] c. The grid verifies the electric vehicle account: v A =Verify(pk,pk A ,σ A ),
[0157] v Bis the Boolean value output by the power grid, v B The value of is 0 or 1.
[0158] 404.5: Session established.
[0159] a. After successful verification (v A =v B =1), generate a session key.
[0160] b. All subsequent collaborative communications between the electric vehicle and the grid are encrypted using the session key.
[0161] c. The sender S prepares the message to be sent, using its own private key sk S Sign the message and generate signature σ S =sign(sk S ,message), and sends the message and signature together to the receiver R.
[0162] sk S It represents the private key of the sender S. When the electric vehicle sends information to the power grid, the electric vehicle is the sender S and the power grid is the receiver R. When the power grid sends information to the electric vehicle, the power grid is the sender S and the electric vehicle is the receiver R.
[0163] d. After receiving the data, the receiver R performs the following operations:
[0164] Get the sender's public key (pk S );
[0165] Use the sender's public key pk S Verify message signature v S =Verify(pk,pk S ,σ S );
[0166] If the verification passes (v S =1), indicating that the message is indeed from the user and has not been tampered with.
[0167] S405: After the verification is passed, the electric vehicle party processes the following steps:
[0168] Generate random numbers and and use and Calculating secret shares Wherein, q is a randomly generated prime number q (for modular operation), l is the decimal place precision; in this embodiment, q satisfies q>10 6 A random prime number.
[0169]
[0170] [E avail ] B ,[P min ] B Sent to the grid, [E avail ] B is the secret share of the electric vehicle's electricity available for sale (sent from the electric vehicle to the grid), [P min ] B It is the secret share of the lowest electricity selling price (sent by the electric vehicle party to the grid party).
[0171] S406: After verification is passed, the grid side processes the following steps:
[0172] Generate random numbers and use Calculating secret shares
[0173]
[0174] [D need ] A ,[P max ] A Sent to the electric vehicle party, [D need ] A The secret share of the current power demand of the power grid (sent by the power grid to the electric vehicle), [P max ] A A secret share representing the maximum price the grid is willing to pay for electricity (sent from the grid to the electric vehicle).
[0175] S407: Calculate weight.
[0176] The total amount of local computing power shared by the electric vehicle party and the power grid party: [S] A =[E avail ] A +[D need ] A modq,[S] B =[E avail ] B +[D need ] B mod q
[0177] Calculation molecules shared by all parties: [N1] A =[E avail ] A ,[N1] B =[E avail ] B ,[N2] A =[D need ] A ,[N2]B =[D need ] B ;
[0178] Perform cooperative division calculations
[0179] Step 408: Calculate the weighted price.
[0180] Perform cooperative multiplication calculation w1×P min :
[0181] [C1] A ,[C1] B =Multiply([w1] A ,[w1]B,[P min ] A ,[P min ] B )
[0182] [C1] A ,[C1] B The result of the multiplication of the secret shares representing the lowest electricity selling price for the electric vehicle and the grid;
[0183] Perform cooperative multiplication calculation w2×P max :
[0184] [C2] A ,[C2] B =Multiply([w2] A ,[w2] B ,[P max ] A ,[P max ] B )
[0185] [C2] A ,[C2] B The result of the multiplication of the secret shares representing the maximum electricity purchase price of the electric vehicle party and the grid party.
[0186] Summing gives the weighted average:
[0187] [P weighted ] A =[C1] A +[C2] A mod q
[0188] [P weighted ] B =[C1] B +[C2] B mod q
[0189] [P weighted] A is the weighted average price of the secret share (held by the electric vehicle party), [P weighted ] B is the secret share of the weighted average price (held by the grid).
[0190] S409: Calculate the final transaction price.
[0191] [P final ] A =[P weighted ] A ×(1+T)mod q
[0192] [P final ] B =[P weighted ] B ×(1+r)mod q
[0193] [P final ] A is the final transaction price held by the electric vehicle party (held by the electric vehicle party), [P final ] B The final transaction price held by the grid party.
[0194] Electric vehicle party sends [P final ] A To the grid, the grid sends [P final ] B To the electric car party.
[0195] Calculate the transaction price P = ([P final ] A +[P final ] B )÷10 2l mod q.
[0196] S410: Send the price result to the smart contract and record it on the blockchain.
[0197] Reference Figure 5 Based on the same inventive concept, an embodiment of the present invention provides a multi-strategy encrypted transaction data processing system.
[0198] The multi-strategy encrypted transaction data processing system of the present invention can be installed in an electronic device. According to the functions to be implemented, the multi-strategy encrypted transaction data processing system includes an electric vehicle, a power grid, an edge computing node, and a processing center;
[0199] Both electric vehicles and the power grid are used to send transaction data and data call requests;
[0200] The processing center is used to execute the multi-strategy encrypted transaction data processing method of the above embodiment; the processing center includes an encryption strategy selection smart contract and a blockchain system. The encryption strategy selection smart contract is used to determine the call information of the transaction data based on the data call request, and based on the call information, select an encryption algorithm that meets the screening conditions from a preset encryption algorithm library as the target encryption strategy, and output the target encryption strategy; the blockchain system is used to store the encrypted transaction data;
[0201] The edge computing node is used to encrypt the transaction data according to the target encryption strategy and output the encrypted transaction data.
[0202] The module described in the present invention may also be referred to as a unit, which refers to a series of computer program segments that can be executed by a processor of an electronic device and can complete fixed functions, and is stored in a memory of the electronic device.
[0203] The various variations and specific examples of the multi-strategy encrypted transaction data processing method provided in the above embodiment are also applicable to the multi-strategy encrypted transaction data processing system of this embodiment. Through the above detailed description of the multi-strategy encrypted transaction data processing method, those skilled in the art can clearly understand the implementation method of the multi-strategy encrypted transaction data processing system of this embodiment. For the sake of brevity of the specification, it will not be described in detail here.
[0204] This application also discloses an electronic device, such as Figure 6 FIG2 is a schematic diagram of the structure of an electronic device implementing a method for processing transaction data using multi-strategy encryption according to an embodiment of the present invention. The electronic device may include at least one processor 10, a memory 11 communicatively coupled to the at least one processor, a communication bus 12, and a communication interface 13. The electronic device may also include a computer program stored in the memory 11 and executable on the processor 10, such as a program for the method for processing transaction data using multi-strategy encryption.
[0205] In some embodiments, the processor 10 may be composed of an integrated circuit, such as a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and a combination of various control chips. The processor 10 is the control core (Control Unit) of the electronic device, connecting the various components of the entire electronic device using various interfaces and lines, and executing or executing programs or modules stored in the memory 11 (such as executing a multi-strategy encrypted transaction data processing method, etc.), as well as calling data stored in the memory 11, to perform various functions of the electronic device and process data.
[0206] The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 11 can be an internal storage unit of an electronic device, such as a mobile hard disk of the electronic device. In other embodiments, the memory 11 can also be an external storage device of the electronic device, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card, etc. equipped on the electronic device. Furthermore, the memory 11 can also include both an internal storage unit of the electronic device and an external storage device. The memory 11 can not only be used to store application software and various types of data installed in the electronic device, such as the code of a multi-strategy encrypted transaction data processing method program, but can also be used to temporarily store data that has been output or is to be output.
[0207] The communication bus 12 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is configured to enable communication between the memory 11 and at least one processor 10, etc.
[0208] The communication interface 13 is used for communication between the above-mentioned electronic device and other devices, including a network interface and a user interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a display (Display), an input unit (such as a keyboard (Keyboard)), optionally, the user interface may also be a standard wired interface, a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, etc. Among them, the display may also be appropriately referred to as a display screen or a display unit, for displaying information processed in the electronic device and for displaying a visual user interface.
[0209] Figure 6 Only the electronic device with components is shown, and it can be understood by those skilled in the art that Figure 6The structure shown does not limit the electronic device, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0210] For example, although not shown, the electronic device may further include a power source (such as a battery) for powering various components. Preferably, the power source may be logically connected to at least one processor 10 via a power management device, thereby implementing functions such as charge management, discharge management, and power consumption management through the power management device. The power source may further include any components such as one or more DC or AC power sources, a recharging device, a power failure detection circuit, a power converter or inverter, a power status indicator, etc. The electronic device may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be described in detail here.
[0211] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.
[0212] Furthermore, if the module / unit integrated into the electronic device is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile.
[0213] The present application provides a computer-readable storage medium, including, for example, any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard drive, a magnetic disk, an optical disk, a computer memory, or a read-only memory (ROM). The computer-readable storage medium stores a computer program capable of being loaded by a processor and executing the multi-strategy encrypted transaction data processing method of the above-described embodiment.
[0214] Throughout this specification, reference to terms such as "one embodiment," "some embodiments," "example," "specific example," "one implementation," "a preferred implementation," or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with that embodiment or example are included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
[0215] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to the embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the claims and their equivalents.
Claims
1. A multi-strategy encrypted transaction data processing method, characterized in that: The method comprises: Obtain transaction data and data call requests; The transaction data and data call request are input into the encryption strategy selection smart contract. The encryption strategy selection smart contract determines the call information of the transaction data based on the data call request, selects the encryption algorithm that meets the screening conditions from the preset encryption algorithm library based on the call information as the target encryption strategy, and outputs the target encryption strategy; Send the target encryption policy to the edge computing node to control the edge computing node to encrypt the transaction data according to the target encryption policy to obtain encrypted transaction data; The call information includes the call data volume and the call data security quantification value. The encryption algorithm library includes symmetric encryption algorithm, asymmetric encryption algorithm and hybrid encryption algorithm; Based on the call information, the encryption algorithm that meets the screening conditions is filtered out from the encryption algorithm library as the target encryption policy, including: Compare the call data volume and the data volume reference value, and compare the call data security quantification value and the data security reference value: If the amount of data being called is less than the data amount reference value and the quantified value of the security of the data being called is less than the data security reference value, the symmetric encryption algorithm is selected as the target encryption strategy; If the amount of data being called is less than the data amount reference value and the quantified value of the security of the data being called is greater than or equal to the data security reference value, then the asymmetric encryption algorithm is selected as the target encryption strategy; If the amount of data being called is greater than or equal to the reference value, the hybrid encryption algorithm is selected as the target encryption strategy; When a hybrid encryption algorithm is selected as the target encryption strategy, the edge computing node encrypts transaction data through the following process: monitoring a third encryption instruction, and generating a symmetric key K=GenerateKey() after detecting the third encryption instruction, where the GenerateKey() function is used to generate one or more random or pseudo-random byte sequences; Create a multi-thread pool ThreadPool for encryption and decryption CP , the original plaintext P to be encrypted is input into the encryption and decryption multi-thread pool for mixed encryption, and the output ciphertext C = (C1, C2); C1 represents the encrypted plaintext, C1 = E1 (K, P), E1 (.) represents the encryption operation, K represents the symmetric key; C2 represents the encrypted symmetric key, C2 = K E mod N, N = p*q, "*" represents a multiplication operation, N represents the product of two coprime numbers p and q, and E represents a random integer.
2. The multi-strategy encrypted transaction data processing method according to claim 1, characterized in that: When a symmetric encryption algorithm is selected as the target encryption strategy, the edge computing node encrypts transaction data through the following process: Monitor the first encryption instruction, and generate a round key set {K0, K1, ..., K n } = KeyExpansion(K); Among them, K represents the symmetric key, KeyExpansion(.) is the key expansion function, K0 represents the round key of the initial round, K1 represents the round key of the first round, K n represents the round key of the nth round, where n represents the total number of rounds; Initial round execution P represents the original plaintext, Indicates the exclusive OR operation, P (0) Represents the plaintext intermediate result after the initial round of processing; For each round i (1≤i≤n-1), perform the following operations: P (i) =AddRoundKey(MixColumns(ShiftRows(SubBytes(P (i-1) ))),K i ), P (i) represents the intermediate result of the plaintext after the i-th round of processing, K i represents the round key of round i, P (i-1) Indicates the intermediate plaintext result after the i-1th round of processing, AddRoundKey(.,K i ) represents the round key K i Perform an XOR operation, MixColumns(.) represents a column mixing operation, ShiftRows(.) represents a row shift operation, and SubBytes(.) represents a byte replacement operation; Final round execution: C = AddRoundKey(ShiftRows(SubBytes(P (n-1) )),K n ), AddRoundKey(.,K n ) represents the round key K n Perform XOR operation, P (n-1) represents the intermediate plaintext result after the n-1th round of processing, and C represents the final ciphertext generated after encryption.
3. The multi-strategy encrypted transaction data processing method according to claim 1, characterized in that: When an asymmetric encryption algorithm is selected as the target encryption strategy, the edge computing node encrypts transaction data through the following process: Monitor the second encryption instruction, randomly select two coprime numbers p and q after monitoring the second encryption instruction, and calculate N=p*q, where "*" represents a multiplication operation; Calculate the Euler function of N Randomly select an integer E, provided that And E and mutually prime; Calculate E for The modular inverse element D of , we get the public key (E, N) and the private key (D, N).
4. The multi-strategy encrypted transaction data processing method according to any one of claims 1 to 3, characterized in that: The method further comprises: Edge computing nodes use a collaborative mechanism to mobilize both parties to verify the encrypted transaction data.
5. The multi-strategy encrypted transaction data processing method according to claim 4, characterized in that: The transaction parties include the electric vehicle party and the power grid party. The edge computing node uses a collaborative mechanism to mobilize the transaction parties to verify the encrypted transaction data, including: The edge computing node verifies the identity information of the electric vehicle party and the grid party, and sends a verification instruction to the electric vehicle party and the grid party when the identity information of the electric vehicle party and the grid party are both verified; receiving a first verification result obtained by the electric vehicle party verifying the encrypted transaction data in response to the verification instruction; receiving a second verification result obtained by the power grid party verifying the encrypted transaction data in response to the verification instruction; Compare the first verification result and the second verification result. If both the first verification result and the second verification result are verified to be passed, the transaction data is recorded in the blockchain.
6. A multi-strategy encrypted transaction data processing system, characterized in that: including electric vehicles, power grids, edge computing nodes, and processing centers; Both electric vehicles and the power grid are used to send transaction data and data call requests; A processing center, configured to execute the multi-strategy encrypted transaction data processing method according to any one of claims 1 to 5; The processing center includes encryption strategy selection smart contract and blockchain system, The encryption strategy selection smart contract is used to determine the call information of the transaction data according to the data call request, and select the encryption algorithm that meets the screening conditions from the preset encryption algorithm library as the target encryption strategy based on the call information, and output the target encryption strategy; The blockchain system is used to store encrypted transaction data; The edge computing node is used to encrypt the transaction data according to the target encryption strategy and output the encrypted transaction data.
7. An electronic device, characterized in that: The electronic device comprises: at least one processor (10); and, a memory (11) communicatively coupled to the at least one processor (10); Wherein, the memory (11) stores a computer program that can be executed by the at least one processor (10), and the computer program is executed by the at least one processor (10) so that the at least one processor (10) can execute the multi-strategy encrypted transaction data processing method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program; when the computer program is executed by a processor, the multi-strategy encrypted transaction data processing method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Information transmission encryption method and system based on Internet of Things
CN115766233A
Charging transaction data processing method and device based on V2G, and storage medium
CN118982353A