Power consumer payment communication method and device, electronic equipment and storage medium
By employing a multi-layered key derivation system, combined with the SM2 algorithm and time parameter binding, the problem of key leakage in electricity payment communication is solved, achieving high security and dynamic security for electricity user payment communication.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA ELECTRIC POWER RESEARCH INSTITUTE CO LTD
- Filing Date
- 2025-11-21
- Publication Date
- 2026-04-24
AI Technical Summary
In the current electricity payment communication process, there is a high risk of key leakage and insufficient communication security, making it difficult to meet the high-frequency interaction needs between user terminals and service platforms.
A multi-layered key derivation system is adopted, which generates temporary private and public keys through the SM2 algorithm, calculates shared and identity keys using hash functions and key derivation functions, and combines time parameter binding to realize one-way key derivation and dynamic update, thereby enhancing communication security.
It reduces the risk of key leakage, improves the security of electricity user payment communication and business-driven dynamic security, and enhances the security of data interaction between devices.
Smart Images

Figure CN121923795A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of power system information security technology, and more specifically, relates to a communication method and device for electricity user payment, electronic equipment, and storage medium. Background Technology
[0002] With the rapid development of smart grids, electricity payment systems are gradually transforming towards online and intelligent models. Real-time electricity bill inquiries and payments via mobile terminals and service platforms have become the mainstream trend. However, electricity payment scenarios involve high-frequency interactions of sensitive user information, posing security challenges such as identity theft and data leakage. To enhance communication security between user terminals and service platforms, current methods primarily rely on encrypted data transmission; however, existing technologies have low encryption levels, leaving the risk of key leakage unresolved. Summary of the Invention
[0003] The purpose of this application is to provide a communication method, device, electronic equipment, and storage medium for electricity user payment, so as to reduce the risk of key leakage and improve the communication security of electricity users when making payments.
[0004] A first aspect of this application provides a communication method for electricity user payment, applied to a user terminal, including:
[0005] Receive the root key and first time sent by the system's trusted center. The first time is the time parameter selected by the system's trusted center after generating the root key.
[0006] A first temporary private key is generated based on the SM2 algorithm. A first shared key is calculated using a hash function based on the root key, the first temporary private key, and the second temporary public key sent by the server.
[0007] Based on the first shared key and the first time, a first identity key is generated using a key derivation function, a first identity authentication tag is generated based on the first identity key, and the first identity key, the first identity authentication tag and the timestamp of the first identity authentication tag are sent to the server.
[0008] In response to receiving a successful authentication flag from the server, a first session key is generated using a key derivation function based on the first identity key, the first temporary parameter, and the second temporary parameter; the first temporary parameter is generated by the user terminal, and the second temporary parameter is generated by the server.
[0009] The electricity user's payment data is encrypted using the first session key to obtain encrypted data, which is then sent to the server for data interaction.
[0010] In one embodiment of this application, the electricity user payment communication method further includes:
[0011] In response to the difference between the current time and the first time being greater than or equal to a preset period, or upon receiving a user terminal revocation flag sent by the system's trusted center, the first shared key is updated using a hash function based on the newly generated first temporary private key and the new second temporary public key sent by the server, thus obtaining a new first shared key;
[0012] Based on the new first shared key and the current time sent by the system's trusted center, a new first identity key is generated using the key derivation function;
[0013] After completing the data interaction with the server, the first session key is updated based on the new first identity key to obtain the new first session key for the next round of sessions.
[0014] In one embodiment of this application, the expression for the root key is:
[0015] K root =H(SDK,msk||H) user )
[0016] Among them, K root H represents the root key, H() represents the hash function, SDK represents the user terminal's identifier, and msk represents the master private key generated by the system's trusted center. user This represents the identity hash identifier of the user terminal. The identity hash identifier is obtained using the SM3 algorithm based on the unique identity identifier of the user terminal and the timestamp when the user terminal sends the identification code to the system's trusted center.
[0017] In one embodiment of this application, a first identity key is generated using a key derivation function based on a first shared key and a first time, including:
[0018] The first identity key is calculated based on the first shared key, the first time, the key derivation function, and the first formula, which is:
[0019]
[0020] in, K represents the first identity key, KDF() represents the key derivation function, K shared,1 Let represent the first shared key, ID represent the unique identifier of the user terminal, t represent the first time sent by the system's trusted center, and σ(t) represent the signature identifier obtained by the system's trusted center from signing the first time.
[0021] In one embodiment of this application, after generating the first temporary private key based on the SM2 algorithm, the method further includes:
[0022] Calculate a first temporary public key based on the first temporary private key, and send the first temporary public key to the server so that the server can generate a second shared key based on the first temporary public key.
[0023] A second aspect of this application provides a communication method for electricity user payment, applied to a server, including:
[0024] Receive the root key sent by the system trust center and the timestamp when the user terminal sends the identification code to the system trust center, and receive the first time sent by the system trust center;
[0025] A second temporary private key is generated based on the SM2 algorithm. A first temporary public key is received from the user terminal. Based on the root key, the second temporary private key, and the first temporary public key, a second shared key is calculated using a hash function. Based on the second shared key and the first time, a second identity key is generated using a key derivation function.
[0026] The system receives the first identity key, the first identity authentication tag, and the timestamp of the first identity authentication tag sent by the user terminal, and determines whether the absolute value of the difference between the timestamp of the first identity authentication tag and the timestamp when the user terminal sends the identification code to the system trust center is less than the first time. The first identity authentication tag is generated based on the first identity key and the timestamp of the first identity authentication tag. The first identity key is generated based on the first shared key and the first time using a key derivation function.
[0027] If the absolute value of the difference between the timestamp of the first identity authentication tag and the timestamp when the user terminal sends the identification code to the system trust center is less than the first time, then the user terminal's identity authentication is determined based on the first identity key, the first identity authentication tag, and the second identity key.
[0028] If the user terminal's authentication is successful, an authentication success flag is sent to the user terminal so that the user terminal and the server can exchange their respective generated first and second temporary parameters.
[0029] Based on the second identity key, the first temporary parameter, and the second temporary parameter, a second session key is generated using a key derivation function. Encrypted data sent by the user terminal is received, and data interaction with the user terminal is performed based on the second session key.
[0030] In one embodiment of this application, the electricity user payment communication method further includes:
[0031] In response to the difference between the current time and the first time being greater than or equal to a preset period, or upon receiving a user terminal revocation identifier sent by the system's trusted center, the second shared key is updated using a hash function based on the newly generated second temporary private key and the new first temporary public key sent by the user terminal, thus obtaining a new second shared key;
[0032] The first identity key, the first identity authentication tag, and the timestamp of the first identity authentication tag sent by the user terminal are received, including:
[0033] Receive a new first identity key, a new first identity authentication label, and a new first identity authentication label timestamp sent by the user terminal; the new first identity key is generated using a key derivation function based on the new first shared key and the first time, and the new first identity authentication label is generated based on the new first identity key and the new first identity authentication label timestamp.
[0034] In one embodiment of this application, the expression for the root key is:
[0035] K root =H(SDK,msk||H) user )
[0036] Among them, K root H represents the root key, H() represents the hash function, SDK represents the user terminal's identifier, and msk represents the master private key generated by the system's trusted center. user This represents the identity hash identifier of the user terminal. The identity hash identifier is obtained using the SM3 algorithm based on the unique identity identifier of the user terminal and the timestamp when the user terminal sends the identification code to the system's trusted center.
[0037] In one embodiment of this application, the expression for the second identity key is:
[0038]
[0039] in, K represents the second identity key, KDF() represents the key derivation function, K shared,2 denoted as the second shared key, ID represents the unique identifier of the user terminal, t represents the first time sent by the system trusted center, and σ(t) represents the signature identifier obtained by the system trusted center from signing the first time.
[0040] In one embodiment of this application, after generating the second temporary private key based on the SM2 algorithm, the method further includes:
[0041] A second temporary public key is obtained based on the second temporary private key, and the second temporary public key is sent to the user terminal so that the user terminal can generate a first shared key based on the second temporary public key.
[0042] In one embodiment of this application, the electricity user payment communication method further includes:
[0043] Statistical analysis of the frequency of generation of the first identity key for user terminals;
[0044] If the frequency of generating the first identity key of the user terminal exceeds a preset frequency threshold, a risk alarm will be sent to the external power system.
[0045] In one embodiment of this application, the electricity user payment communication method further includes:
[0046] Calculate the reuse rate of the second session key within a preset duration;
[0047] Get the number of times the user terminal failed to authenticate within a preset time period;
[0048] If the reuse rate of the second session key is greater than the first preset value, or the number of authentication failures of the user terminal is greater than the second preset value, a freeze account notification will be sent to the user terminal, and the account corresponding to the user terminal will be frozen.
[0049] In one embodiment of this application, the electricity user payment communication method further includes:
[0050] Receive the signature identifier sent by the Trusted Center of the System. The signature identifier is obtained by the Trusted Center of the System using the master private key to sign the key in real time. The master private key is a key randomly generated by the Trusted Center of the System.
[0051] Determining whether the user terminal's authentication is successful based on the first identity key, the first identity authentication tag, and the second identity key includes:
[0052] The first identity key is compared with the second identity key. If the first identity key is the same as the second identity key, a second identity authentication label is generated based on the second identity key and the timestamp of the first identity authentication label.
[0053] If the first authentication tag is equal to the second authentication tag, then the user terminal's authentication is successful.
[0054] A third aspect of this application provides a communication method for electricity user payment, applied to a system trusted center, including:
[0055] Obtain the root key, and use the time parameter selected after generating the root key as the first time.
[0056] Send the root key, the timestamp when the user terminal sent the identifier code, and the first time to the user terminal and the server respectively, so that:
[0057] The user terminal calculates the first shared key using a hash function based on the root key, the first temporary private key, and the second temporary public key sent by the server. Based on the first shared key and the first time, it generates the first identity key using a key derivation function. Based on the first identity key, it generates the first identity authentication tag and sends the first identity key, the first identity authentication tag, and the timestamp of the first identity authentication tag to the server.
[0058] The server calculates the second shared key using a hash function based on the root key, the second temporary private key, and the first temporary public key sent by the user terminal. Based on the second shared key and the first time, the server generates the second identity key using a key derivation function.
[0059] The server receives the first identity key, the first identity authentication tag, and the timestamp of the first identity authentication tag sent by the user terminal, and determines whether the user terminal's identity authentication is successful. If the user terminal's identity authentication is successful, the server sends the user terminal's identity authentication success flag to the user terminal, so that the user terminal and the server exchange their respective generated first temporary parameters and second temporary parameters. Based on the second identity key, the first temporary parameters, and the second temporary parameters, the server generates a second session key using a key derivation function, receives encrypted data sent by the user terminal, and performs data interaction with the user terminal based on the second session key.
[0060] When the user terminal receives the authentication success flag sent by the server, it generates a first session key based on the first identity key, the first temporary parameter, and the second temporary parameter using a key derivation function. Based on the first session key, it encrypts the electricity user's payment data to obtain encrypted data, and sends the encrypted data to the server for data interaction.
[0061] A fourth aspect of this application provides an electricity user payment communication device, applied to a user terminal, comprising:
[0062] The first data acquisition unit is used to receive the root key and the first time sent by the system trusted center. The first time is the time parameter selected by the system trusted center after generating the root key.
[0063] The first computing unit is used to generate a first temporary private key based on the SM2 algorithm, and to calculate a first shared key using a hash function based on the root key, the first temporary private key, and the second temporary public key sent by the server.
[0064] The second computing unit is used to generate a first identity key based on the first shared key and the first time using a key derivation function, generate a first identity authentication tag based on the first identity key, and send the first identity key, the first identity authentication tag and the timestamp of the first identity authentication tag to the server.
[0065] The second data acquisition unit is used to respond to the successful authentication flag sent by the server, and generate a first session key based on the first identity key, the first temporary parameter, and the second temporary parameter using a key derivation function; the first temporary parameter is generated by the user terminal, and the second temporary parameter is generated by the server;
[0066] The first communication unit is used to encrypt the electricity user's payment data based on the first session key to obtain encrypted data, and then send the encrypted data to the server for data interaction.
[0067] In one embodiment of this application, the electricity user payment security communication device further includes a first data update unit;
[0068] The first data update unit is used for:
[0069] In response to the difference between the current time and the first time being greater than or equal to a preset period, or upon receiving a user terminal revocation flag sent by the system's trusted center, the first shared key is updated using a hash function based on the newly generated first temporary private key and the new second temporary public key sent by the server, thus obtaining a new first shared key;
[0070] Based on the new first shared key and the current time sent by the system's trusted center, a new first identity key is generated using the key derivation function;
[0071] After completing the data interaction with the server, the first session key is updated based on the new first identity key to obtain the new first session key for the next round of sessions.
[0072] In one embodiment of this application, the expression for the root key is:
[0073] K root =H(SDK,msk||H) user )
[0074] Among them, K root H represents the root key, H() represents the hash function, SDK represents the user terminal's identifier, and msk represents the master private key generated by the system's trusted center. user This represents the identity hash identifier of the user terminal. The identity hash identifier is obtained using the SM3 algorithm based on the unique identity identifier of the user terminal and the timestamp when the user terminal sends the identification code to the system's trusted center.
[0075] In one embodiment of this application, the second computing unit is specifically used for:
[0076] The first identity key is calculated based on the first shared key, the first time, the key derivation function, and the first formula, which is:
[0077]
[0078] in, K represents the first identity key, KDF() represents the key derivation function, K shared,1Let represent the first shared key, ID represent the unique identifier of the user terminal, t represent the first time sent by the system's trusted center, and σ(t) represent the signature identifier obtained by the system's trusted center from signing the first time.
[0079] In one embodiment of this application, after generating the first temporary private key based on the SM2 algorithm, the first computing unit is further configured to:
[0080] Calculate a first temporary public key based on the first temporary private key, and send the first temporary public key to the server so that the server can generate a second shared key based on the first temporary public key.
[0081] A fifth aspect of this application provides a power user payment communication device, applied to a server, comprising:
[0082] The second data acquisition unit is used to receive the root key sent by the system trust center and the timestamp when the user terminal sends the identification code to the system trust center, and to receive the first time sent by the system trust center;
[0083] The third computing unit is used to generate a second temporary private key based on the SM2 algorithm, receive a first temporary public key sent by the user terminal, calculate a second shared key using a hash function based on the root key, the second temporary private key and the first temporary public key, and generate a second identity key using a key derivation function based on the second shared key and the first time.
[0084] The fourth calculation unit is used to receive the first identity key, the first identity authentication tag, and the timestamp of the first identity authentication tag sent by the user terminal, and to determine whether the absolute value of the difference between the timestamp of the first identity authentication tag and the timestamp when the user terminal sends the identification code to the system trust center is less than the first time; the first identity authentication tag is generated based on the first identity key and the timestamp of the first identity authentication tag, and the first identity key is generated based on the first shared key and the first time using a key derivation function;
[0085] The judgment unit is used to determine whether the user terminal's identity authentication is successful based on the first identity key, the first identity authentication tag, and the second identity key if the absolute value of the difference between the timestamp of the first identity authentication tag and the timestamp when the user terminal sends the identification code to the system trust center is less than the first time.
[0086] If the user terminal's authentication is successful, an authentication success flag is sent to the user terminal so that the user terminal and the server can exchange their respective generated first and second temporary parameters.
[0087] The second communication unit is used to generate a second session key using a key derivation function based on a second identity key, a first temporary parameter, and a second temporary parameter, to receive encrypted data sent by the user terminal, and to perform data interaction with the user terminal based on the second session key.
[0088] In one embodiment of this application, the electricity user payment security communication device further includes a second data update unit;
[0089] The second data update unit is used for:
[0090] In response to the difference between the current time and the first time being greater than or equal to a preset period, or upon receiving a user terminal revocation identifier sent by the system's trusted center, the second shared key is updated using a hash function based on the newly generated second temporary private key and the new first temporary public key sent by the user terminal, thus obtaining a new second shared key;
[0091] The first identity key, the first identity authentication tag, and the timestamp of the first identity authentication tag sent by the user terminal are received, including:
[0092] Receive a new first identity key, a new first identity authentication label, and a new first identity authentication label timestamp sent by the user terminal; the new first identity key is generated using a key derivation function based on the new first shared key and the first time, and the new first identity authentication label is generated based on the new first identity key and the new first identity authentication label timestamp.
[0093] In one embodiment of this application, the expression for the root key is:
[0094] K root =H(SDK,msk||H) user )
[0095] Among them, K root H represents the root key, H() represents the hash function, SDK represents the user terminal's identifier, and msk represents the master private key generated by the system's trusted center. user This represents the identity hash identifier of the user terminal. The identity hash identifier is obtained using the SM3 algorithm based on the unique identity identifier of the user terminal and the timestamp when the user terminal sends the identification code to the system's trusted center.
[0096] In one embodiment of this application, the expression for the second identity key is:
[0097]
[0098] in, K represents the second identity key, KDF() represents the key derivation function, K shared,2denoted as the second shared key, ID represents the unique identifier of the user terminal, t represents the first time sent by the system trusted center, and σ(t) represents the signature identifier obtained by the system trusted center from signing the first time.
[0099] In one embodiment of this application, after receiving the first time sent by the trusted center of the system, the third computing unit is specifically used for:
[0100] A second temporary public key is obtained based on the second temporary private key, and the second temporary public key is sent to the user terminal so that the user terminal can generate a first shared key based on the second temporary public key.
[0101] In one embodiment of this application, the electricity user payment security communication device further includes a first data statistics unit;
[0102] The first data statistics unit is used for:
[0103] Statistical analysis of the frequency of generation of the first identity key for user terminals;
[0104] If the frequency of generating the first identity key of the user terminal exceeds a preset frequency threshold, a risk alarm will be sent to the external power system.
[0105] In one embodiment of this application, the electricity user payment security communication device further includes a second data statistics unit;
[0106] The second data statistics unit is used for:
[0107] Calculate the reuse rate of the second session key within a preset duration;
[0108] Get the number of times the user terminal failed to authenticate within a preset time period;
[0109] If the reuse rate of the second session key is greater than the first preset value, or the number of authentication failures of the user terminal is greater than the second preset value, a freeze account notification will be sent to the user terminal, and the account corresponding to the user terminal will be frozen.
[0110] In one embodiment of this application, the electricity user payment security communication device further includes a third data acquisition unit; the third data acquisition unit is used for:
[0111] Receive the signature identifier sent by the Trusted Center of the System. The signature identifier is obtained by the Trusted Center of the System using the master private key to sign the key in real time. The master private key is a key randomly generated by the Trusted Center of the System.
[0112] The decision unit is specifically used for:
[0113] The first identity key is compared with the second identity key. If the first identity key is the same as the second identity key, a second identity authentication label is generated based on the second identity key and the timestamp of the first identity authentication label.
[0114] If the first authentication tag is equal to the second authentication tag, then the user terminal's authentication is successful.
[0115] A sixth aspect of this application provides a power user payment communication device, applied in a system trusted center, comprising:
[0116] The fourth data acquisition unit is used to acquire the root key and uses the time parameter selected after the root key is generated as the first time.
[0117] The data transmission unit is used to send the root key, the timestamp when the user terminal sent the identification code, and the first time to the user terminal and the server, respectively, so that:
[0118] The user terminal calculates the first shared key using a hash function based on the root key, the first temporary private key, and the second temporary public key sent by the server. Based on the first shared key and the first time, it generates the first identity key using a key derivation function. Based on the first identity key, it generates the first identity authentication tag and sends the first identity key, the first identity authentication tag, and the timestamp of the first identity authentication tag to the server.
[0119] The server calculates the second shared key using a hash function based on the root key, the second temporary private key, and the first temporary public key sent by the user terminal. Based on the second shared key and the first time, the server generates the second identity key using a key derivation function.
[0120] The server receives the first identity key, the first identity authentication tag, and the timestamp of the first identity authentication tag sent by the user terminal, and determines whether the user terminal's identity authentication is successful. If the user terminal's identity authentication is successful, the server sends the user terminal's identity authentication success flag to the user terminal, so that the user terminal and the server exchange their respective generated first temporary parameters and second temporary parameters. Based on the second identity key, the first temporary parameters, and the second temporary parameters, the server generates a second session key using a key derivation function, receives encrypted data sent by the user terminal, and performs data interaction with the user terminal based on the second session key.
[0121] When the user terminal receives the authentication success flag sent by the server, it generates a first session key based on the first identity key, the first temporary parameter, and the second temporary parameter using a key derivation function. Based on the first session key, it encrypts the electricity user's payment data to obtain encrypted data, and sends the encrypted data to the server for data interaction.
[0122] A seventh aspect of this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program to implement the steps of the above-described electricity user payment communication method.
[0123] An eighth aspect of the embodiments of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described electricity user payment communication method.
[0124] The beneficial effects of the electricity user payment communication method and device, electronic device, and storage medium provided in this application embodiment are as follows:
[0125] This application proposes a multi-layered key derivation system. The root key, first identity key, and first session key are derived unidirectionally, meaning that lower-level keys can only be generated from upper-level keys, and upper-level keys cannot be generated from lower-level keys. In this embodiment, the first identity key can only be generated from the root key, and the first session key can only be generated from the first identity key. Both the first identity key and the first session key in this application are generated through negotiation between the user terminal and the server. This unidirectional key derivation method enhances the security of data interaction between devices and reduces the risk of key propagation and leakage. Furthermore, this application binds the first identity key to a time parameter, enabling deep coupling between the first identity key and the electricity payment service scenario, thus responding to dynamic security requirements driven by business needs. Attached Figure Description
[0126] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0127] Figure 1 This application provides an embodiment of an equipment information interaction diagram for a power user payment communication system.
[0128] Figure 2 A flowchart illustrating a power user payment communication method provided in an embodiment of this application;
[0129] Figure 3 A flowchart illustrating a power user payment communication method provided in an embodiment of this application;
[0130] Figure 4 A flowchart illustrating a power user payment communication method provided in an embodiment of this application;
[0131] Figure 5 This is a signaling interaction diagram of multi-terminal communication for electricity user payment provided in an embodiment of this application;
[0132] Figure 6 This is a structural block diagram of an electricity user payment communication device provided in an embodiment of this application;
[0133] Figure 7 This is a structural block diagram of an electricity user payment communication device provided in an embodiment of this application;
[0134] Figure 8 This is a structural block diagram of an electricity user payment communication device provided in an embodiment of this application;
[0135] Figure 9 This is a schematic block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0136] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known algorithms, systems, or apparatuses have been omitted so as not to obscure the description of this application with unnecessary detail.
[0137] The purpose of this application is to provide a communication method, device, electronic device, and storage medium for electricity user payment scenarios, including root key generation, identity key generation, session key generation, identity authentication, and key update, so as to ensure the security and flexibility of the entire data communication process when users make electricity payments.
[0138] To make the objectives, technical solutions, and advantages of this application clearer, the following description will be provided in conjunction with the accompanying drawings and specific embodiments.
[0139] Please refer to Figure 1 , Figure 1 This is a diagram illustrating the device information interaction of a power user payment communication system according to an embodiment of this application. The system includes a user terminal 110, a server 120, and a system trust center 130.
[0140] The first stage is system initialization and root key generation. When a user has a payment requirement, the user terminal 110 requests user registration from the system trust center 130. After receiving the user registration information, the system trust center 130 generates a root key and a signature identifier, and sends the root key and signature identifier to the user terminal 110 and the server 120 respectively.
[0141] During the identity verification phase, after successful user registration, identity verification is required. At this time, user terminal 110 generates a first temporary private key and a first temporary public key, while server 120 generates a second temporary private key and a second temporary public key. After exchanging their respective temporary public keys, user terminal 110 generates a first shared key based on the root key and uses a key derivation function to generate a first identity key based on the first shared key. Server 120 generates a second shared key based on the root key and uses a key derivation function to generate a second identity key based on the second shared key. User terminal 110 submits an identity authentication request to server 120. Server 120 determines whether the user's identity verification is successful based on the second identity key. If the user's identity verification is successful, the user proceeds to the payment transaction phase.
[0142] During the payment transaction phase, the user terminal 110 generates a first session key, uses the first session key to encrypt the transaction data, and communicates securely with the second session key generated by the server 120.
[0143] During the key update phase, when certain conditions are met or when user terminal 110 is revoked by the system trust center 130, it is necessary to update the identity keys of user terminal 110 and the system trust center 130. After each session between user terminal 110 and server 120, their respective session keys are updated.
[0144] During the key analysis and monitoring phase, the server 120 counts the generation frequency of the first identity key of the user terminal 110, the reuse rate of the second session key within a preset time period, and the number of authentication failures of the user terminal 110 within a preset time period. If the preset conditions are not met, a risk alarm is triggered, or the preset time period and preset frequency threshold are dynamically adjusted, and the risk situation is reported to the external power system.
[0145] Based on the information interaction process of the three devices mentioned above, the following sections will elaborate and provide a detailed introduction from the perspective of each device.
[0146] Please refer to Figure 2 , Figure 2 This is a flowchart illustrating a power user payment communication method provided in an embodiment of this application, applied to a user terminal. The method may include steps S201 to S205.
[0147] S201: Receive the root key and first time sent by the system's trusted center. The first time is the time parameter selected by the system's trusted center after generating the root key.
[0148] In this embodiment, during the system initialization and root key generation phases:
[0149] Before the user terminal receives the root key sent by the system's trusted center, the trusted center performs initialization, which involves using the Elliptic Curve Public Key Cryptography (SM2) algorithm and selecting the elliptic curve equation E. A point G on the elliptic curve is randomly selected as the base point. All other points on the elliptic curve can be represented based on the base point G; that is, other points on the elliptic curve can be generated by performing "scalar multiplication" on G and multiple point addition operations. n is the order of the base point G. The order affects the security strength of the root key; the higher the order, the more difficult it is to crack the root key.
[0150] The system's trusted center randomly generates the master private key msk and the master public key mpk based on the SM2 algorithm, where mpk = msk × G.
[0151] The user terminal sends its identification code and unique identity identifier to the system's trusted center. Upon receiving this information, the trusted center calculates the identity hash identifier using the user terminal's identification code, unique identity identifier, and timestamp t1. Based on this identity hash identifier, it uses a hash function to obtain the root key. The expression for the identity hash identifier is:
[0152] H user =SM3(ID||t1);
[0153] H user The hash represents the identity identifier, SM3() represents the domestic cryptographic hash algorithm, ID represents the unique identity identifier of the user terminal, t1 represents the timestamp when the user terminal sends the identifier code to the system trust center, and "||" represents concatenation. In other formulas of this application, "||" also represents concatenation.
[0154] The expression for the root key is:
[0155] K root =H(SDK,msk||H) user );
[0156] K root The root key is represented by the root key, the SDK is represented by the user terminal identifier, and H is represented by the root key. user This represents the identity hash identifier, msk represents the master private key, and H() represents the hash function.
[0157] The system's trusted center transmits the timestamp, identity hash identifier, and generated root password (t1, H) from the user terminal to the system's trusted center via a secure channel. user ,K root The system sends the data to the user terminal and the server. Then, the system's trusted center selects the time parameter t and sends it to the user terminal and the server as the first time.
[0158] S202: Generate a first temporary private key based on the SM2 algorithm, and calculate the first shared key using a hash function based on the root key, the first temporary private key, and the second temporary public key sent by the server.
[0159] In this embodiment, the identity authentication stage:
[0160] After receiving the first time t, the user terminal randomly generates the first temporary private key. Calculate the first temporary public key based on the first temporary private key, and send the first temporary public key to the server.
[0161] After receiving the first time t, the server randomly generates a second temporary private key. Calculate the second temporary public key based on the second temporary private key, and send the second temporary public key to the user terminal.
[0162] The user terminal uses the root key, the first temporary private key, and the second temporary public key to calculate the first shared key using a hash function. Then, the user terminal can use the first shared key to generate a first identity key and send an authentication request to the server.
[0163] S203: Based on the first shared key and the first time, generate a first identity key using a key derivation function, generate a first identity authentication tag based on the first identity key, and send the first identity key, the first identity authentication tag, and the timestamp of the first identity authentication tag to the server.
[0164] In this embodiment, the identity authentication stage:
[0165] The first identity key is calculated based on the first shared key, the first time, the key derivation function, and the first formula, which is:
[0166]
[0167] in, K represents the first identity key, KDF() represents the key derivation function, K shared,1 Let represent the first shared key, ID represent the unique identifier of the user terminal, t represent the first time sent by the system's trusted center, and σ(t) represent the signature identifier obtained by the system's trusted center from signing the first time.
[0168] Generate a first identity authentication tag based on the first identity key, including:
[0169] The first identity authentication tag is calculated based on the first identity key, the SM4 algorithm, and the second formula, which is:
[0170]
[0171] Here, Tag1 represents the identity authentication tag, and t2 represents the timestamp of the first identity authentication tag. This represents the first identity key, and ID represents the unique identifier of the user terminal.
[0172] After the user terminal generates the identity authentication tag, it will store the timestamp of the first identity authentication tag, the first identity key, and the first identity authentication tag (t2, Tag1) is sent to the server for identity verification.
[0173] S204: In response to receiving the authentication success flag sent by the server, generate a first session key based on the first identity key, the first temporary parameter, and the second temporary parameter using a key derivation function; the first temporary parameter is generated by the user terminal, and the second temporary parameter is generated by the server.
[0174] In this embodiment, the server receives (t2, ...) sent by the user terminal. Following Tag1, the user terminal's identity is verified. If verification is successful, a successful authentication flag is sent to the user terminal. If verification fails, the user terminal cannot proceed to the next payment transaction stage and needs to re-authenticate.
[0175] After receiving the authentication success flag sent by the server, the user terminal generates the first session key based on the first identity key, the first temporary parameter, and the second temporary parameter using the key derivation function.
[0176] The first session key can be calculated based on the first identity key, the first temporary parameter, the second temporary parameter, the key derivation function, and the third formula, which is:
[0177]
[0178] N represents the session key for the k-th transaction. u N represents the first temporary parameter randomly generated by the user terminal. s This represents a second temporary parameter randomly generated by the server. k is a positive integer, representing the k-th transaction with the server. After each transaction, k is updated to k+1 to ensure forward safety. This shows the session key for the (k-1)th transaction, KDF. SM3 () represents the key derivation function based on the SM3 algorithm.
[0179] S205: Encrypt the electricity user's payment data based on the first session key to obtain encrypted data, and send the encrypted data to the server for data interaction.
[0180] In this embodiment, after the user terminal generates a first session key, it can use this first session key to encrypt the electricity user's payment data to obtain encrypted data, and then send the encrypted data to the server for data interaction. For example, the electricity user's payment data is... The content represents transaction data, such as "Payment of 100 yuan on 20250508".
[0181] As can be seen from the above, this application proposes a multi-layered key derivation system. The root key, first identity key, and first session key are derived unidirectionally, meaning that lower-level keys can only be generated from upper-level keys, and upper-level keys cannot be generated from lower-level keys. In this embodiment, the first identity key can only be generated from the root key, and the first session key can only be generated from the first identity key. In this application embodiment, both the first identity key and the first session key are generated through negotiation between the user terminal and the server. This unidirectional key derivation method enhances the security of data interaction between devices and reduces the risk of key propagation and leakage. Furthermore, this application embodiment binds the first identity key to a time parameter, enabling deep coupling between the first identity key and the electricity payment business scenario, thus responding to dynamic security requirements driven by business needs.
[0182] In one embodiment of this application, the electricity user payment communication method further includes:
[0183] In response to the difference between the current time and the first time being greater than or equal to a preset period, or upon receiving a user terminal revocation flag sent by the system's trusted center, the first shared key is updated using a hash function based on the newly generated first temporary private key and the new second temporary public key sent by the server, thus obtaining a new first shared key;
[0184] Based on the new first shared key and the current time sent by the system's trusted center, a new first identity key is generated using the key derivation function;
[0185] After completing the data interaction with the server, the first session key is updated based on the new first identity key to obtain the new first session key for the next round of sessions.
[0186] In this embodiment, a key update phase begins after the user terminal completes data interaction with the server. During the key update phase, a preset period is set, such as 5 days, 10 days, or 15 days. A first identity key update command is triggered when the difference between the current time and the last update time of the first identity key is greater than or equal to the preset period; alternatively, a first identity key update command is triggered when a user terminal is revoked by the system's trusted center.
[0187] During initialization, the system's trusted center selects a time parameter t. Besides sending this time parameter t as the first time to the user terminal and server, it also uses the master private key to sign the time t, obtaining the signature identifier σ(t) = SM2. sign (msk,t) is then sent to the user terminal and the server. When the update command for the first identity key and the first session key is triggered, t = t + 1, σ(t + 1) = SM2. sign (msk,t+1) The user terminal updates the first shared key using a hash function based on the newly generated first temporary private key and the new second temporary public key sent by the server, and obtains the new first shared key. Based on the new first shared key, the user terminal obtains the new first identity key.
[0188] In this embodiment, the update logic for the first session key is as follows: the first session key is updated after each session between the server and the user terminal is completed. At this time, k = k + 1, and the updated first session key is:
[0189] in
[0190] In this embodiment, the first identity key can be dynamically updated by setting conditions, such as the difference between the current time and the first time being greater than or equal to a preset period, or by receiving a user terminal revocation identifier sent by the system's trusted center. Other conditions can also be set, such as triggering a first session key update after each session between the server and the user terminal. These two key update mechanisms avoid the problems of existing dynamic password schemes that only achieve one-time authentication, making it difficult to guarantee the security of subsequent communication sessions, and the problems faced by traditional mainstream solutions based on static keys or Public Key Infrastructure (PKI) systems in high-concurrency scenarios, such as complex authentication, difficulty in updating keys, and high communication costs. This improves the communication security between devices in the electricity payment scenario.
[0191] Please refer to Figure 3 , Figure 3 This is a flowchart illustrating a power user payment communication method provided in an embodiment of this application. Applied to a server, the method may include steps S301 to S306.
[0192] S301: Receive the root key sent by the system trusted center and the timestamp when the user terminal sends the identification code to the system trusted center, and receive the first time sent by the system trusted center.
[0193] In this embodiment, during the system initialization and root key generation phases:
[0194] The system's trusted center randomly generates the master private key msk and the master public key mpk based on the SM2 algorithm, where mpk = msk × G.
[0195] The user terminal sends its identification code and unique identity to the system's trusted center. After receiving the above information, the system's trusted center uses the user terminal's identification code, unique identity, and timestamp t1 to calculate the identity hash identifier. Based on the identity hash identifier, it uses a hash function to obtain the root key. The above operation steps have been described above and will not be repeated here.
[0196] The system's trusted center transmits the timestamp, identity hash identifier, and generated root password (t1, H) from the user terminal to the system's trusted center via a secure channel. user ,K root The system sends the data to the user terminal and the server. Then, the system's trusted center selects the time parameter t and sends it to the user terminal and the server as the first time.
[0197] S302: Generate a second temporary private key based on the SM2 algorithm, receive a first temporary public key sent by the user terminal, calculate a second shared key using a hash function based on the root key, the second temporary private key and the first temporary public key, and generate a second identity key using a key derivation function based on the second shared key and the first time.
[0198] In this embodiment, the identity authentication stage:
[0199] After receiving the first time t, the server randomly generates a second temporary private key. Calculate the second temporary public key based on the second temporary private key, and send the second temporary public key to the user terminal.
[0200] After receiving the first time t, the user terminal randomly generates the first temporary private key. Calculate the first temporary public key based on the first temporary private key, and send the first temporary public key to the server.
[0201] The server calculates a second shared key using a hash function based on the root key, the second temporary private key, and the first temporary public key. Then, the server can use the second shared key to generate a second identity key and verify the authentication request sent by the user terminal.
[0202] S303: Receive the first identity key, the first identity authentication tag, and the timestamp of the first identity authentication tag sent by the user terminal, and determine whether the absolute value of the difference between the timestamp of the first identity authentication tag and the timestamp when the user terminal sends the identification code to the system trusted center is less than the first time.
[0203] The first identity authentication tag is generated based on the first identity key and the timestamp of the first identity authentication tag. The first identity key is generated based on the first shared key and the first time, using a key derivation function.
[0204] In this embodiment, when the user terminal sends authentication information to the server, that is, the user terminal sends the timestamp of the first authentication tag, the first identity key, and the first authentication tag to the server, the server first determines whether the absolute value of the difference between the timestamp of the first authentication tag and the timestamp when the user terminal sends the identification code to the system trusted center is less than a first time, that is, whether |t2-t1|<t holds true, where t1 represents the timestamp when the user terminal sends the identification code to the system trusted center, t2 represents the timestamp of the first authentication tag, and t represents the first time. If it is less than the first time, it means that no time has been exceeded, and the next step of judgment can be performed.
[0205] In this embodiment, the process of calculating the first identity key and the first identity authentication tag has been described above and will not be repeated here.
[0206] S304: If the absolute value of the difference between the timestamp of the first identity authentication tag and the timestamp when the user terminal sends the identification code to the system trusted center is less than the first time, then the user terminal's identity authentication is determined based on the first identity key, the first identity authentication tag, and the second identity key.
[0207] In this embodiment, if the absolute value of the difference between the timestamp of the first identity authentication tag and the timestamp when the user terminal sends the identification code to the system trusted center is less than the first time, the following judgment can be made to verify whether the user terminal's identity authentication is successful.
[0208] Determining whether the user terminal's authentication is successful based on the first identity key, the first identity authentication tag, and the second identity key includes:
[0209] The first identity key is compared with the second identity key. If the first identity key is equal to the second identity key, a second identity authentication tag is generated based on the second identity key. If the first identity authentication tag is equal to the second identity authentication tag, the user terminal's identity authentication is determined to be successful.
[0210] In this embodiment, the user terminal's authentication is considered successful only if the absolute value of the difference between the timestamp of the first identity authentication tag and the timestamp when the user terminal sends the identification code to the system's trusted center is less than the first time, the first identity key is equal to the second identity key, and the first identity authentication tag is equal to the second identity authentication tag. If any one of these conditions is not met, the authentication fails. The expression for the second identity key is:
[0211]
[0212] in, K represents the second identity key, KDF() represents the key derivation function, K shared,2 denoted as the second shared key, ID represents the unique identifier of the user terminal, t represents the first time sent by the system trusted center, and σ(t) represents the signature identifier obtained by the system trusted center from signing the first time.
[0213] S305: If the user terminal's authentication is successful, the authentication success flag of the user terminal is sent to the user terminal so that the user terminal and the server can exchange the first temporary parameter and the second temporary parameter generated by each other.
[0214] In this embodiment, both the first temporary parameter generated by the user terminal and the second temporary parameter generated by the server are temporarily generated parameters. If the user terminal's authentication is successful, a second session key can be generated based on the aforementioned first and second temporary parameters to facilitate data interaction with the user terminal.
[0215] S306: Based on the second identity key, the first temporary parameter, and the second temporary parameter, generate a second session key using a key derivation function, receive encrypted data sent by the user terminal, and perform data interaction with the user terminal based on the second session key.
[0216] In this embodiment, a second session key is generated using a key derivation function based on the second identity key, the first temporary parameter, and the second temporary parameter. This second session key is equal to the first session key corresponding to the user terminal. Therefore, data interaction can be performed with the user terminal based on the second session key, ensuring communication security between devices.
[0217] As can be seen from the above, this application proposes a multi-layered key derivation system. The root key, identity key, and session key are derived unidirectionally, meaning that lower-level keys can only be generated from upper-level keys, and upper-level keys cannot be generated from lower-level keys. In this embodiment, the identity key can only be generated from the root key, and the session key can only be generated from the identity key. In this application embodiment, both the identity key and session key are negotiated and generated by the user terminal and the server. This unidirectional key derivation method enhances the security of data interaction between devices and reduces the risk of key propagation and leakage. Furthermore, this application embodiment binds the identity key to a time parameter, enabling deep coupling between the identity key and the electricity payment business scenario, and responding to dynamic security requirements driven by business needs.
[0218] In one embodiment of this solution, the electricity user payment communication method further includes:
[0219] In response to the difference between the current time and the first time being greater than or equal to a preset period, or upon receiving a user terminal revocation identifier sent by the system's trusted center, the second shared key is updated using a hash function based on the newly generated second temporary private key and the new first temporary public key sent by the user terminal, thus obtaining a new second shared key;
[0220] The first identity key, the first identity authentication tag, and the timestamp of the first identity authentication tag sent by the user terminal are received, including:
[0221] Receive a new first identity key, a new first identity authentication label, and a new first identity authentication label timestamp sent by the user terminal; the new first identity key is generated using a key derivation function based on the new first shared key and the first time, and the new first identity authentication label is generated based on the new first identity key and the new first identity authentication label timestamp.
[0222] In this embodiment, the key update phase:
[0223] Once the user terminal and server have completed data interaction, the key update phase begins. During this phase, a preset period is set, such as 5 days, 10 days, or 15 days. A key update command is triggered when the difference between the current time and the last update time of the primary identity key is greater than or equal to the preset period. Alternatively, a key update command is triggered when a user terminal is revoked by the system's trusted center.
[0224] During system initialization, the Trust Center selects a time parameter 't'. Besides sending this time parameter 't' as the first time to the user terminal and server, it also signs the first time 't' using the master private key to obtain a signature identifier, which is then sent to the user terminal and server. When the update command for the first identity key and the first session key is triggered, 't = t + 1'. The user terminal updates the first shared key using a hash function based on the newly generated first temporary private key and the new second temporary public key sent by the server, obtaining a new first shared key. The new first shared key is equal to the new second shared key. A new first identity key can be generated based on the new first shared key, and a new second identity key can be generated based on the new second shared key.
[0225] This embodiment avoids the problem that existing dynamic password schemes only achieve one-time authentication and cannot guarantee the security of subsequent communication sessions by dynamically updating the key, thus improving the device's adaptive defense capabilities.
[0226] In one embodiment of this solution, the electricity user payment communication method further includes:
[0227] Statistical analysis of the frequency of generation of the first identity key for user terminals;
[0228] If the frequency of generating the first identity key of the user terminal exceeds a preset frequency threshold, a risk alarm will be sent to the external power system.
[0229] In this embodiment, the generation frequency of the first identity key is applied to any user terminal. If the generation frequency of the first identity key of the user terminal is greater than a preset frequency threshold, such as 5 times / minute, it indicates that there may be a risk of password leakage, and a risk alarm needs to be sent to the external power system.
[0230] In one embodiment of this solution, the electricity user payment communication method further includes:
[0231] Calculate the reuse rate of the second session key within a preset duration;
[0232] Get the number of times the user terminal failed to authenticate within a preset time period;
[0233] If the reuse rate of the second session key is greater than the first preset value, or the number of authentication failures of the user terminal is greater than the second preset value, a freeze account notification will be sent to the user terminal, and the account corresponding to the user terminal will be frozen.
[0234] In this embodiment, if the reuse rate of the second session key is greater than the first preset value within a preset time period, or the number of authentication failures of the user terminal is greater than the second preset value, it indicates that there is a certain risk, and the user terminal needs to be automatically frozen and a notification sent to the user terminal to improve the adaptive defense capability of the power user payment communication system.
[0235] Please refer to Figure 4 , Figure 4 This is a flowchart illustrating a power user payment communication method provided in an embodiment of this application, applied to a system trusted center. The method may include steps S401 to S402.
[0236] S401: Obtain the root key and use the time parameter selected after generating the root key as the first time.
[0237] In this embodiment, during the system initialization and root key generation phases:
[0238] Before the user terminal receives the root key sent by the system's trusted center, the system's trusted center performs initialization by generating a master private key and a master public key based on the elliptic curve cryptography algorithm. The method for generating the master private key and master public key based on the elliptic curve cryptography algorithm has been introduced earlier and will not be repeated here.
[0239] The user terminal sends its identification code and unique identity to the system's trusted center. After receiving the above information, the system's trusted center uses the user terminal's identification code, unique identity, and timestamp t1 to calculate the identity hash identifier, and uses a hash function to obtain the root key based on the identity hash identifier.
[0240] The expression for the root key is:
[0241] K root =H(SDK,msk||H) user )
[0242] Among them, K root H represents the root key, H() represents the hash function, SDK represents the user terminal's identifier, and msk represents the master private key generated by the system's trusted center. user This represents the identity hash identifier of the user terminal. The identity hash identifier is obtained using the SM3 algorithm based on the unique identity identifier of the user terminal and the timestamp when the user terminal sends the identification code to the system's trusted center.
[0243] The expression for the identity hash identifier is:
[0244] H user =SM3(ID||t1);
[0245] H user The hash represents the identity identifier, SM3() represents the domestic cryptographic hash algorithm, ID represents the unique identity identifier of the user terminal, t1 represents the timestamp when the user terminal sends the identifier code to the system trust center, and "||" represents concatenation. In other formulas of this application, "||" also represents concatenation.
[0246] The system's trusted center transmits the timestamp, identity hash identifier, and generated root password (t1, H) from the user terminal to the system's trusted center via a secure channel. user ,K root The system sends the data to the user terminal and the server. Then, the system's trusted center selects the time parameter t and sends it to the user terminal and the server as the first time.
[0247] S402: Send the root key, the timestamp when the user terminal sends the identification code, and the first time to the user terminal and the server respectively, so that the user terminal and the server can interact with each other.
[0248] The data interaction process is as follows:
[0249] The user terminal calculates the first shared key using a hash function based on the root key, the first temporary private key, and the second temporary public key sent by the server. Based on the first shared key and the first time, it generates the first identity key using a key derivation function. Based on the first identity key, it generates the first identity authentication tag and sends the first identity key, the first identity authentication tag, and the timestamp of the first identity authentication tag to the server.
[0250] The server calculates the second shared key using a hash function based on the root key, the second temporary private key, and the first temporary public key sent by the user terminal. Based on the second shared key and the first time, the server generates the second identity key using a key derivation function.
[0251] The server receives the first identity key, the first identity authentication tag, and the timestamp of the first identity authentication tag sent by the user terminal, and determines whether the user terminal's identity authentication is successful. If the user terminal's identity authentication is successful, the server sends the user terminal's identity authentication success flag to the user terminal, so that the user terminal and the server exchange their respective generated first temporary parameters and second temporary parameters. Based on the second identity key, the first temporary parameters, and the second temporary parameters, the server generates a second session key using a key derivation function, receives encrypted data sent by the user terminal, and performs data interaction with the user terminal based on the second session key.
[0252] When the user terminal receives the authentication success flag sent by the server, it generates a first session key based on the first identity key, the first temporary parameter, and the second temporary parameter using a key derivation function. Based on the first session key, it encrypts the electricity user's payment data to obtain encrypted data, and sends the encrypted data to the server for data interaction.
[0253] In this embodiment, the system's trusted center sends the root key, the timestamp when the user terminal sends the identification code, and the first time to the user terminal and the server, respectively, so that the user terminal and the server can generate their respective first session key and second session key based on the key in a one-way derivation and complete data interaction.
[0254] As can be seen from the above, the embodiments of this application, by initializing and generating a root key, enable the user terminal to generate a first identity key based on the root key, and then generate a first identity authentication tag and a first session key. The server can generate a second identity key based on the root key, and then generate a second identity authentication tag and a second session key. Data interaction between the user terminal and the server can be realized based on the first session key and the second session key. Moreover, the identity key and session key are generated through negotiation between the user terminal and the server, avoiding the security risk of key leakage.
[0255] In one embodiment of this application, reference is made to Figure 5 The interaction process between the user terminal, the server, and the system's trusted center is as follows:
[0256] A1. Generate the master private key and master public key.
[0257] The system's trusted center randomly generates the master private key msk and the master public key mpk based on the SM2 algorithm.
[0258] A2. Send the identification code and unique identity identifier.
[0259] The user terminal sends its identification code and unique identity to the system's trusted center.
[0260] A3. Generate the root key.
[0261] The system's trusted center uses the user terminal's identifier, unique identity, and timestamp t1 to calculate an identity hash identifier, and then uses a hash function to obtain the root key based on the identity hash identifier.
[0262] A4. Send to the user terminal.
[0263] A5. Send to the server.
[0264] A6. Sending time parameter.
[0265] The system's trusted center selects a time parameter t and sends this time parameter t as the first time to the user terminal and the server respectively.
[0266] A7. Send the second temporary public key.
[0267] After receiving the first time t, the server randomly generates a second temporary private key. Calculate the second temporary public key based on the second temporary private key, and send the second temporary public key to the user terminal.
[0268] A8. Send the first temporary public key.
[0269] After receiving the first time t, the user terminal randomly generates the first temporary private key. Calculate the first temporary public key based on the first temporary private key, and send the first temporary public key to the server.
[0270] A9. Generate a first temporary private key, generate a first shared key based on the root key, the first temporary private key and the second temporary public key, and generate a first identity key based on the first shared key.
[0271] The user terminal uses the root key, the first temporary private key, and the second temporary public key to calculate the first shared key using a hash function. Then, the user terminal can use the first shared key to generate a first identity key and send an authentication request to the server.
[0272] A10. Send the first identity key to the server.
[0273] A11. Generate a second temporary private key, generate a first shared key based on the root key, the second temporary private key and the first temporary public key, and generate a second identity key based on the second shared key.
[0274] A12. Identity verification.
[0275] The server uses the second identity key to verify the identity authentication request sent by the user terminal.
[0276] A13. Send the identity authentication success indicator.
[0277] The server determines that the user terminal has successfully authenticated and sends an authentication success flag to the user terminal.
[0278] A14. Generate a first session key based on the first identity key, the first temporary parameter, and the second temporary parameter.
[0279] When the user terminal receives the authentication success flag sent by the server, it generates a first session key based on the first identity key, the first temporary parameter, and the second temporary parameter using a key derivation function; the first temporary parameter is generated by the user terminal, and the second temporary parameter is generated by the server.
[0280] A15. Data interaction is conducted based on the first session key.
[0281] The user terminal encrypts the electricity user's payment data to obtain encrypted data, and then sends the encrypted data to the server for data interaction.
[0282] Corresponding to the electricity user payment communication method in the above embodiment, Figure 6 This is a structural block diagram of an electricity user payment communication device provided according to an embodiment of this application. For ease of explanation, only the parts relevant to the embodiment of this application are shown. References Figure 6 The electricity user payment communication device 20 is applied to the user terminal and includes: a first data acquisition unit 21, a first calculation unit 22, a second calculation unit 23, a second data acquisition unit 24, and a first communication unit 25.
[0283] The first data acquisition unit 21 is used to receive the root key and the first time sent by the system trusted center. The first time is the time parameter selected by the system trusted center after generating the root key.
[0284] The first computing unit 22 is used to generate a first temporary private key based on the SM2 algorithm, and to calculate a first shared key using a hash function based on the root key, the first temporary private key, and the second temporary public key sent by the server.
[0285] The second computing unit 23 is used to generate a first identity key based on the first shared key and the first time using a key derivation function, generate a first identity authentication tag based on the first identity key, and send the first identity key, the first identity authentication tag and the timestamp of the first identity authentication tag to the server.
[0286] The second data acquisition unit 24 is used to generate a first session key based on the first identity key, the first temporary parameter, and the second temporary parameter using a key derivation function in response to receiving an authentication success flag sent by the server; the first temporary parameter is generated by the user terminal, and the second temporary parameter is generated by the server.
[0287] The first communication unit 25 is used to encrypt the electricity user's payment data based on the first session key to obtain encrypted data, and send the encrypted data to the server for data interaction.
[0288] In one embodiment of this application, the electricity user payment security communication device 20 further includes a first data update unit;
[0289] The first data update unit is used for:
[0290] In response to the difference between the current time and the first time being greater than or equal to a preset period, or upon receiving a user terminal revocation flag sent by the system's trusted center, the first shared key is updated using a hash function based on the newly generated first temporary private key and the new second temporary public key sent by the server, thus obtaining a new first shared key;
[0291] Based on the new first shared key and the current time sent by the system's trusted center, a new first identity key is generated using the key derivation function;
[0292] After completing the data interaction with the server, the first session key is updated based on the new first identity key to obtain the new first session key for the next round of sessions.
[0293] In one embodiment of this application, the expression for the root key is:
[0294] K root =H(SDK,msk||H) user )
[0295] Among them, K root H represents the root key, H() represents the hash function, SDK represents the user terminal's identifier, and msk represents the master private key generated by the system's trusted center. user This represents the identity hash identifier of the user terminal. The identity hash identifier is obtained using the SM3 algorithm based on the unique identity identifier of the user terminal and the timestamp when the user terminal sends the identification code to the system's trusted center.
[0296] In one embodiment of this application, the second computing unit 23 is specifically used for:
[0297] The first identity key is calculated based on the first shared key, the first time, the key derivation function, and the first formula, which is:
[0298]
[0299] in, K represents the first identity key, KDF() represents the key derivation function, K shared,1 Let represent the first shared key, ID represent the unique identifier of the user terminal, t represent the first time sent by the system's trusted center, and σ(t) represent the signature identifier obtained by the system's trusted center from signing the first time.
[0300] In one embodiment of this application, after generating the first temporary private key based on the SM2 algorithm, the first computing unit 22 is further configured to:
[0301] Calculate a first temporary public key based on the first temporary private key, and send the first temporary public key to the server so that the server can generate a second shared key based on the first temporary public key.
[0302] Corresponding to the electricity user payment communication method in the above embodiment, Figure 7 This is a structural block diagram of an electricity user payment communication device provided according to an embodiment of this application. For ease of explanation, only the parts relevant to the embodiment of this application are shown. References Figure 7 The electricity user payment communication device 30 is applied to the server side and includes: a second data acquisition unit 31, a third calculation unit 32, a fourth calculation unit 33, a judgment unit 34, and a second communication unit 35.
[0303] The second data acquisition unit 31 is used to receive the root key sent by the system trusted center and the timestamp when the user terminal sends the identification code to the system trusted center, and to receive the first time sent by the system trusted center.
[0304] The third computing unit 32 is used to generate a second temporary private key based on the SM2 algorithm, receive a first temporary public key sent by the user terminal, calculate a second shared key using a hash function based on the root key, the second temporary private key and the first temporary public key, and generate a second identity key using a key derivation function based on the second shared key and the first time.
[0305] The fourth calculation unit 33 is used to receive the first identity key, the first identity authentication tag, and the timestamp of the first identity authentication tag sent by the user terminal, and to determine whether the absolute value of the difference between the timestamp of the first identity authentication tag and the timestamp when the user terminal sends the identification code to the system trust center is less than the first time; the first identity authentication tag is generated based on the first identity key and the timestamp of the first identity authentication tag, and the first identity key is generated based on the first shared key and the first time using a key derivation function;
[0306] The judgment unit 34 is used to determine whether the user terminal’s identity authentication is successful based on the first identity key, the first identity authentication tag and the second identity key if the absolute value of the difference between the timestamp of the first identity authentication tag and the timestamp when the user terminal sends the identification code to the system trusted center is less than the first time.
[0307] If the user terminal's authentication is successful, an authentication success flag is sent to the user terminal so that the user terminal and the server can exchange their respective generated first and second temporary parameters.
[0308] The second communication unit 35 is used to generate a second session key using a key derivation function based on the second identity key, the first temporary parameter, and the second temporary parameter, to receive encrypted data sent by the user terminal, and to perform data interaction with the user terminal based on the second session key.
[0309] In one embodiment of this application, the electricity user payment security communication device 30 further includes a second data update unit;
[0310] The second data update unit is used for:
[0311] In response to the difference between the current time and the first time being greater than or equal to a preset period, or upon receiving a user terminal revocation identifier sent by the system's trusted center, the second shared key is updated using a hash function based on the newly generated second temporary private key and the new first temporary public key sent by the user terminal, thus obtaining a new second shared key;
[0312] The first identity key, the first identity authentication tag, and the timestamp of the first identity authentication tag sent by the user terminal are received, including:
[0313] Receive a new first identity key, a new first identity authentication label, and a new first identity authentication label timestamp sent by the user terminal; the new first identity key is generated using a key derivation function based on the new first shared key and the first time, and the new first identity authentication label is generated based on the new first identity key and the new first identity authentication label timestamp.
[0314] In one embodiment of this application, the expression for the root key is:
[0315] K root =H(SDK,msk||H) user )
[0316] Among them, K root H represents the root key, H() represents the hash function, SDK represents the user terminal's identifier, and msk represents the master private key generated by the system's trusted center. user This represents the identity hash identifier of the user terminal. The identity hash identifier is obtained using the SM3 algorithm based on the unique identity identifier of the user terminal and the timestamp when the user terminal sends the identification code to the system's trusted center.
[0317] In one embodiment of this application, the expression for the second identity key is:
[0318]
[0319] in, K represents the second identity key, KDF() represents the key derivation function, K shared,2 denoted as the second shared key, ID represents the unique identifier of the user terminal, t represents the first time sent by the system trusted center, and σ(t) represents the signature identifier obtained by the system trusted center from signing the first time.
[0320] In one embodiment of this application, after receiving the first time sent by the trusted center of the system, the third computing unit 32 is specifically used for:
[0321] A second temporary public key is obtained based on the second temporary private key, and the second temporary public key is sent to the user terminal so that the user terminal can generate a first shared key based on the second temporary public key.
[0322] In one embodiment of this application, the electricity user payment security communication device further includes a first data statistics unit;
[0323] The first data statistics unit is used for:
[0324] Statistical analysis of the frequency of generation of the first identity key for user terminals;
[0325] If the frequency of generating the first identity key of the user terminal exceeds a preset frequency threshold, a risk alarm will be sent to the external power system.
[0326] In one embodiment of this application, the electricity user payment security communication device further includes a second data statistics unit;
[0327] The second data statistics unit is used for:
[0328] Calculate the reuse rate of the second session key within a preset duration;
[0329] Get the number of times the user terminal failed to authenticate within a preset time period;
[0330] If the reuse rate of the second session key is greater than the first preset value, or the number of authentication failures of the user terminal is greater than the second preset value, a freeze account notification will be sent to the user terminal, and the account corresponding to the user terminal will be frozen.
[0331] In one embodiment of this application, the electricity user payment security communication device further includes a third data acquisition unit; the third data acquisition unit is used for:
[0332] Receive the signature identifier sent by the Trusted Center of the System. The signature identifier is obtained by the Trusted Center of the System using the master private key to sign the key in real time. The master private key is a key randomly generated by the Trusted Center of the System.
[0333] The specific decision unit 34 is used for:
[0334] The first identity key is compared with the second identity key. If the first identity key is the same as the second identity key, a second identity authentication label is generated based on the second identity key and the timestamp of the first identity authentication label.
[0335] If the first authentication tag is equal to the second authentication tag, then the user terminal's authentication is successful.
[0336] Corresponding to the electricity user payment communication method in the above embodiment, Figure 8 This is a structural block diagram of an electricity user payment communication device provided according to an embodiment of this application. For ease of explanation, only the parts relevant to the embodiment of this application are shown. References Figure 8 The electricity user payment communication device 40 is applied to the system's trusted center and includes: a fourth data acquisition unit 41 and a data transmission unit 42.
[0337] The fourth data acquisition unit 41 is used to acquire the root key and take the time parameter selected after the root key is generated as the first time.
[0338] Data sending unit 42 is used to send the root key, the timestamp when the user terminal sends the identification code, and the first time to the user terminal and the server respectively, so that:
[0339] The user terminal calculates the first shared key using a hash function based on the root key, the first temporary private key, and the second temporary public key sent by the server. Based on the first shared key and the first time, it generates the first identity key using a key derivation function. Based on the first identity key, it generates the first identity authentication tag and sends the first identity key, the first identity authentication tag, and the timestamp of the first identity authentication tag to the server.
[0340] The server calculates the second shared key using a hash function based on the root key, the second temporary private key, and the first temporary public key sent by the user terminal. Based on the second shared key and the first time, the server generates the second identity key using a key derivation function.
[0341] The server receives the first identity key, the first identity authentication tag, and the timestamp of the first identity authentication tag sent by the user terminal, and determines whether the user terminal's identity authentication is successful. If the user terminal's identity authentication is successful, the server sends the user terminal's identity authentication success flag to the user terminal, so that the user terminal and the server exchange their respective generated first temporary parameters and second temporary parameters. Based on the second identity key, the first temporary parameters, and the second temporary parameters, the server generates a second session key using a key derivation function, receives encrypted data sent by the user terminal, and performs data interaction with the user terminal based on the second session key.
[0342] When the user terminal receives the authentication success flag sent by the server, it generates a first session key based on the first identity key, the first temporary parameter, and the second temporary parameter using a key derivation function. Based on the first session key, it encrypts the electricity user's payment data to obtain encrypted data, and sends the encrypted data to the server for data interaction.
[0343] See Figure 9 , Figure 9 This is a schematic block diagram of an electronic device provided according to an embodiment of this application. Figure 9 The electronic device 800 in this embodiment may include one or more processors 801, one or more input devices 802, one or more output devices 803, and one or more memories 804. The processors 801, input devices 802, output devices 803, and memories 804 communicate with each other via a communication bus 805. The memory 804 stores computer programs, including program instructions. The processor 801 executes the program instructions stored in the memory 804. The processor 801 is configured to invoke the program instructions to perform the functions of the units in the above-described device embodiments, for example... Figure 6 The functions of the first data acquisition unit 21, the first calculation unit 22, the second calculation unit 23, the second data acquisition unit 24, and the first communication unit 25 shown are as follows: Figure 7 The functions of the second data acquisition unit 31, the third calculation unit 32, the fourth calculation unit 33, the judgment unit 34, and the second communication unit 35 shown are as follows: Figure 8 The functions of the fourth data acquisition unit 41 and the data transmission unit 42 are shown.
[0344] It should be understood that, in the embodiments of this application, the processor 801 may be a central processing unit (CPU), but it may also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.
[0345] Input device 802 may include a touchpad, a fingerprint sensor (for collecting the user's fingerprint information and fingerprint orientation information), a microphone, etc., and output device 803 may include a display (LCD, etc.), a speaker, etc.
[0346] The memory 804 may include read-only memory and random access memory, and provides instructions and data to the processor 801. A portion of the memory 804 may also include non-volatile random access memory. In specific implementations, the processor 801, input device 802, and output device 803 described in the embodiments of this application can execute the implementation methods described in the electricity user payment communication method provided in the embodiments of this application, or they can execute the implementation methods of the electronic devices described in the embodiments of this application, which will not be repeated here.
[0347] In another embodiment of this application, a computer-readable storage medium is provided. This computer-readable storage medium stores a computer program, which includes program instructions. When executed by a processor, the program instructions implement all or part of the processes in the methods described above. Alternatively, the computer program can instruct related hardware to complete the process. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include any entity or device capable of carrying computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc.
[0348] The computer-readable storage medium can be an internal storage unit of the electronic device in any of the foregoing embodiments, such as a hard disk or memory of the electronic device. The computer-readable storage medium can also be an external storage device of the electronic device, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc., equipped on the electronic device. Furthermore, the computer-readable storage medium can include both internal and external storage units of the electronic device. The computer-readable storage medium is used to store computer programs and other programs and data required by the electronic device. The computer-readable storage medium can also be used to temporarily store data that has been output or will be output.
[0349] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this application.
[0350] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the electronic devices and units described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0351] In the several embodiments provided in this application, it should be understood that the disclosed electronic devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces or units, or it may be an electrical, mechanical, or other form of connection.
[0352] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments of this application, depending on actual needs.
[0353] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0354] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A communication method for electricity user payment, characterized in that, Applied to user terminals, including: The system receives the root key and the first time sent by the Trusted Center of the System, wherein the first time is the time parameter selected by the Trusted Center of the System after generating the root key; A first temporary private key is generated based on the SM2 algorithm. A first shared key is calculated using a hash function based on the root key, the first temporary private key, and the second temporary public key sent by the server. Based on the first shared key and the first time, a first identity key is generated using a key derivation function, a first identity authentication tag is generated based on the first identity key, and the first identity key, the first identity authentication tag and the timestamp of the first identity authentication tag are sent to the server. In response to receiving the authentication success flag sent by the server, a first session key is generated using a key derivation function based on the first identity key, the first temporary parameter, and the second temporary parameter; the first temporary parameter is generated by the user terminal, and the second temporary parameter is generated by the server. The electricity user's payment data is encrypted using the first session key to obtain encrypted data, which is then sent to the server for data interaction.
2. The electricity user payment communication method as described in claim 1, characterized in that, Also includes: In response to the difference between the current time and the first time being greater than or equal to a preset period, or upon receiving a user terminal revocation identifier sent by the system's trusted center, the first shared key is updated using a hash function based on the newly generated first temporary private key and the new second temporary public key sent by the server, to obtain a new first shared key; Based on the new first shared key and the current time sent by the system's trusted center, a new first identity key is generated using a key derivation function; After completing data interaction with the server, the first session key is updated based on the new first identity key to obtain a new first session key for the next round of session.
3. The electricity user payment communication method as described in claim 1, characterized in that, The expression for the root key is: K root =H(SDK,msk||H user ) Among them, K root H represents the root key, H() represents the hash function, SDK represents the user terminal's identifier, and msk represents the master private key generated by the system's trusted center. user The identity hash identifier represents the user terminal's identity. The identity hash identifier is obtained using the SM3 algorithm based on the user terminal's unique identity identifier and the timestamp when the user terminal sends the identifier code to the system's trusted center.
4. The electricity user payment communication method as described in claim 1, characterized in that, The step of generating a first identity key based on the first shared key and the first time using a key derivation function includes: The first identity key is calculated based on the first shared key, the first time, the key derivation function, and the first formula, whereby the first formula is: in, K represents the first identity key, KDF() represents the key derivation function, K shared,1 Let represent the first shared key, ID represent the unique identifier of the user terminal, t represent the first time sent by the system's trusted center, and σ(t) represent the signature identifier obtained by the system's trusted center from signing the first time.
5. The electricity user payment communication method as described in claim 1, characterized in that, After generating the first temporary private key based on the SM2 algorithm, the following is also included: Calculate a first temporary public key based on the first temporary private key, and send the first temporary public key to the server so that the server can generate a second shared key based on the first temporary public key.
6. A communication method for electricity user payment, characterized in that, Applied to the server side, including: Receive the root key sent by the system trust center and the timestamp when the user terminal sends the identification code to the system trust center, and receive the first time sent by the system trust center; A second temporary private key is generated based on the SM2 algorithm. A first temporary public key is received from the user terminal. A second shared key is calculated using a hash function based on the root key, the second temporary private key, and the first temporary public key. A second identity key is generated using a key derivation function based on the second shared key and the first time. The system receives a first identity key, a first identity authentication tag, and a timestamp of the first identity authentication tag sent by the user terminal. It then determines whether the absolute value of the difference between the timestamp of the first identity authentication tag and the timestamp when the user terminal sends the identification code to the system trust center is less than a first time. The first identity authentication tag is generated based on the first identity key and the timestamp of the first identity authentication tag. The first identity key is generated based on the first shared key and the first time using a key derivation function. If the absolute value of the difference between the timestamp of the first identity authentication tag and the timestamp when the user terminal sends the identification code to the system trust center is less than the first time, then the user terminal's identity authentication is determined to be successful based on the first identity key, the first identity authentication tag, and the second identity key. If the user terminal's identity authentication is successful, an identity authentication success flag is sent to the user terminal, so that the user terminal and the server exchange their respective generated first temporary parameters and second temporary parameters. Based on the second identity key, the first temporary parameter, and the second temporary parameter, a second session key is generated using a key derivation function. Encrypted data sent by the user terminal is received, and data interaction is performed with the user terminal based on the second session key.
7. The electricity user payment communication method as described in claim 6, characterized in that, Also includes: In response to the difference between the current time and the first time being greater than or equal to a preset period, or upon receiving a user terminal revocation identifier sent by the system's trusted center, the second shared key is updated using a hash function based on the newly generated second temporary private key and the new first temporary public key sent by the user terminal, to obtain a new second shared key; The step of receiving the first identity key, the first identity authentication tag, and the timestamp of the first identity authentication tag sent by the user terminal includes: Receive the new first identity key, the new first identity authentication tag, and the timestamp of the new first identity authentication tag sent by the user terminal; The new first identity key is generated using a key derivation function based on the new first shared key and the first time. The new first identity authentication label is generated based on the new first identity key and the timestamp of the new first identity authentication label.
8. The electricity user payment communication method as described in claim 6, characterized in that, The expression for the root key is: K root =H(SDK,msk||H user ) Among them, K root H represents the root key, H() represents the hash function, SDK represents the user terminal's identifier, and msk represents the master private key generated by the system's trusted center. user The identity hash identifier represents the user terminal's identity. The identity hash identifier is obtained using the SM3 algorithm based on the user terminal's unique identity identifier and the timestamp when the user terminal sends the identifier code to the system's trusted center.
9. The electricity user payment communication method as described in claim 6, characterized in that, The expression for the second identity key is: in, K represents the second identity key, KDF() represents the key derivation function, K shared,2 The second shared key is represented by ID, the unique identifier of the user terminal is represented by t, the first time sent by the system's trusted center is represented by σ(t), and the signature identifier obtained by the system's trusted center from the first time is represented by σ(t).
10. The electricity user payment communication method as described in claim 6, characterized in that, After generating the second temporary private key based on the SM2 algorithm, the following is also included: A second temporary public key is obtained based on the second temporary private key, and the second temporary public key is sent to the user terminal so that the user terminal generates a first shared key based on the second temporary public key.
11. The electricity user payment communication method as described in claim 6, characterized in that, Also includes: Count the frequency of generation of the first identity key of the user terminal; If the frequency of generating the first identity key of the user terminal is greater than a preset frequency threshold, a risk alarm is sent to the external power system.
12. The electricity user payment communication method as described in claim 6, characterized in that, Also includes: Calculate the reuse rate of the second session key within a preset duration; Obtain the number of times the user terminal failed to authenticate within the preset time period; If the reuse rate of the second session key is greater than the first preset value, or the number of authentication failures of the user terminal is greater than the second preset value, then a freeze account notification is sent to the user terminal, and the account corresponding to the user terminal is frozen.
13. The electricity user payment communication method as described in claim 6, characterized in that, Also includes: Receive a signature identifier sent by the system's trusted center, wherein the signature identifier is obtained by the system's trusted center signing the first time using the master private key, and the master private key is a key randomly generated by the system's trusted center; The step of determining whether the user terminal's identity authentication is successful based on the first identity key, the first identity authentication tag, and the second identity key includes: The first identity key is compared with the second identity key. If the first identity key is the same as the second identity key, a second identity authentication label is generated based on the second identity key and the timestamp of the first identity authentication label. If the first identity authentication tag is equal to the second identity authentication tag, then the user terminal's identity authentication is determined to be successful.
14. A communication method for electricity user payment, characterized in that, Applications to system trust centers include: Obtain the root key, and use the time parameter selected after generating the root key as the first time. The root key, the timestamp when the user terminal sent the identifier code, and the first time are sent to the user terminal and the server, respectively, so that: The user terminal calculates a first shared key using a hash function based on the root key, the first temporary private key, and the second temporary public key sent by the server. Based on the first shared key and the first time, it generates a first identity key using a key derivation function. Based on the first identity key, it generates a first identity authentication tag. The user terminal then sends the first identity key, the first identity authentication tag, and the timestamp of the first identity authentication tag to the server. The server calculates the second shared key using a hash function based on the root key, the second temporary private key, and the first temporary public key sent by the user terminal. Based on the second shared key and the first time, it generates a second identity key using a key derivation function. The server receives the first identity key, the first identity authentication tag, and the timestamp of the first identity authentication tag sent by the user terminal, and determines whether the user terminal's identity authentication is successful. If the user terminal's identity authentication is successful, the server sends the user terminal's identity authentication success flag to the user terminal, so that the user terminal and the server exchange their respective generated first temporary parameters and second temporary parameters. Based on the second identity key, the first temporary parameters, and the second temporary parameters, the server generates a second session key using a key derivation function, receives encrypted data sent by the user terminal, and performs data interaction with the user terminal based on the second session key. The user terminal receives the authentication success flag sent by the server, generates a first session key based on the first identity key, the first temporary parameter and the second temporary parameter using a key derivation function, encrypts the electricity user payment data based on the first session key to obtain encrypted data, and sends the encrypted data to the server for data interaction.
15. A secure communication device for electricity user payment, characterized in that, Applied to user terminals, including: The first data acquisition unit is used to receive the root key and the first time sent by the system trusted center, wherein the first time is the time parameter selected by the system trusted center after generating the root key; The first computing unit is used to generate a first temporary private key based on the SM2 algorithm, and to calculate a first shared key using a hash function based on the root key, the first temporary private key, and the second temporary public key sent by the server. The second computing unit is used to generate a first identity key based on the first shared key and the first time using a key derivation function, generate a first identity authentication tag based on the first identity key, and send the first identity key, the first identity authentication tag and the timestamp of the first identity authentication tag to the server. The second data acquisition unit is configured to, in response to receiving an authentication success flag sent by the server, generate a first session key based on the first identity key, the first temporary parameter, and the second temporary parameter using a key derivation function; the first temporary parameter is generated by the user terminal, and the second temporary parameter is generated by the server; The first communication unit is used to encrypt the electricity user's payment data based on the first session key to obtain encrypted data, and send the encrypted data to the server for data interaction.
16. The secure communication device for electricity user payment as described in claim 15, characterized in that, It also includes the first data update unit; The first data update unit is used for: In response to the difference between the current time and the first time being greater than or equal to a preset period, or upon receiving a user terminal revocation identifier sent by the system's trusted center, the first shared key is updated using a hash function based on the newly generated first temporary private key and the new second temporary public key sent by the server, to obtain a new first shared key; Based on the new first shared key and the current time sent by the system's trusted center, a new first identity key is generated using a key derivation function; After completing data interaction with the server, the first session key is updated based on the new first identity key to obtain a new first session key for the next round of session.
17. The secure communication device for electricity user payment as described in claim 15, characterized in that, The expression for the root key is: K root =H(SDK,msk||H user ) Among them, K root H represents the root key, H() represents the hash function, SDK represents the user terminal's identifier, and msk represents the master private key generated by the system's trusted center. user The identity hash identifier represents the user terminal's identity. The identity hash identifier is obtained using the SM3 algorithm based on the user terminal's unique identity identifier and the timestamp when the user terminal sends the identifier code to the system's trusted center.
18. The secure communication device for electricity user payment as described in claim 15, characterized in that, The second calculation unit is specifically used for: The first identity key is calculated based on the first shared key, the first time, the key derivation function, and the first formula, whereby the first formula is: in, K represents the first identity key, KDF() represents the key derivation function, K shared,1 Let represent the first shared key, ID represent the unique identifier of the user terminal, t represent the first time sent by the system's trusted center, and σ(t) represent the signature identifier obtained by the system's trusted center from signing the first time.
19. The secure communication device for electricity user payment as described in claim 15, characterized in that, After generating the first temporary private key based on the SM2 algorithm, the first computing unit is further configured to: Calculate a first temporary public key based on the first temporary private key, and send the first temporary public key to the server so that the server can generate a second shared key based on the first temporary public key.
20. A secure communication device for electricity user payment, characterized in that, Applied to the server side, including: The second data acquisition unit is used to receive the root key sent by the system trusted center and the timestamp when the user terminal sends the identification code to the system trusted center, and to receive the first time sent by the system trusted center; The third computing unit is used to generate a second temporary private key based on the SM2 algorithm, receive a first temporary public key sent by the user terminal, calculate a second shared key using a hash function based on the root key, the second temporary private key and the first temporary public key, and generate a second identity key using a key derivation function based on the second shared key and the first time. The fourth calculation unit is used to receive the first identity key, the first identity authentication tag, and the timestamp of the first identity authentication tag sent by the user terminal, and to determine whether the absolute value of the difference between the timestamp of the first identity authentication tag and the timestamp when the user terminal sends the identification code to the system trust center is less than the first time; the first identity authentication tag is generated based on the first identity key and the timestamp of the first identity authentication tag, and the first identity key is generated based on the first shared key and the first time using a key derivation function; The judgment unit is used to determine whether the user terminal's identity authentication is successful based on the first identity key, the first identity authentication tag, and the second identity key if the absolute value of the difference between the timestamp of the first identity authentication tag and the timestamp when the user terminal sends the identification code to the system trust center is less than the first time. If the user terminal's identity authentication is successful, an identity authentication success flag is sent to the user terminal, so that the user terminal and the server exchange their respective generated first temporary parameters and second temporary parameters. The second communication unit is configured to generate a second session key using a key derivation function based on the second identity key, the first temporary parameter, and the second temporary parameter, receive encrypted data sent by the user terminal, and perform data interaction with the user terminal based on the second session key.
21. The secure communication device for electricity user payment as described in claim 20, characterized in that, It also includes a second data update unit; The second data update unit is used for: In response to the difference between the current time and the first time being greater than or equal to a preset period, or upon receiving a user terminal revocation identifier sent by the system's trusted center, the second shared key is updated using a hash function based on the newly generated second temporary private key and the new first temporary public key sent by the user terminal, to obtain a new second shared key; The step of receiving the first identity key, the first identity authentication tag, and the timestamp of the first identity authentication tag sent by the user terminal includes: Receive the new first identity key, the new first identity authentication tag, and the timestamp of the new first identity authentication tag sent by the user terminal; The new first identity key is generated using a key derivation function based on the new first shared key and the first time. The new first identity authentication label is generated based on the new first identity key and the timestamp of the new first identity authentication label.
22. The secure communication device for electricity user payment as described in claim 20, characterized in that, The expression for the root key is: K root =H(SDK,msk||H user ) Among them, K root H represents the root key, H() represents the hash function, SDK represents the user terminal's identifier, and msk represents the master private key generated by the system's trusted center. user The identity hash identifier represents the user terminal's identity. The identity hash identifier is obtained using the SM3 algorithm based on the user terminal's unique identity identifier and the timestamp when the user terminal sends the identifier code to the system's trusted center.
23. The secure communication device for electricity user payment as described in claim 20, characterized in that, The expression for the second identity key is: in, K represents the second identity key, KDF() represents the key derivation function, K shared,2 The second shared key is represented by ID, the unique identifier of the user terminal is represented by t, the first time sent by the system's trusted center is represented by σ(t), and the signature identifier obtained by the system's trusted center from the first time is represented by σ(t).
24. The secure communication device for electricity user payment as described in claim 20, characterized in that, After the first time the trusted center of the receiving system sends the data, the third computing unit is specifically used for: A second temporary public key is obtained based on the second temporary private key, and the second temporary public key is sent to the user terminal so that the user terminal generates a first shared key based on the second temporary public key.
25. The secure communication device for electricity user payment as described in claim 20, characterized in that, It also includes the first data statistics unit; The first data statistics unit is used for: Count the frequency of generation of the first identity key of the user terminal; If the frequency of generating the first identity key of the user terminal is greater than a preset frequency threshold, a risk alarm is sent to the external power system.
26. The secure communication device for electricity user payment as described in claim 20, characterized in that, It also includes a second data statistics unit; The second data statistics unit is used for: Calculate the reuse rate of the second session key within a preset duration; Obtain the number of times the user terminal failed to authenticate within the preset time period; If the reuse rate of the second session key is greater than the first preset value, or the number of authentication failures of the user terminal is greater than the second preset value, then a freeze account notification is sent to the user terminal, and the account corresponding to the user terminal is frozen.
27. The secure communication device for electricity user payment as described in claim 20, characterized in that, It also includes a third data acquisition unit; the third data acquisition unit is used for: Receive a signature identifier sent by the system's trusted center, wherein the signature identifier is obtained by the system's trusted center signing the first time using the master private key, and the master private key is a key randomly generated by the system's trusted center; The judgment unit is specifically used for: The first identity key is compared with the second identity key. If the first identity key is the same as the second identity key, a second identity authentication label is generated based on the second identity key and the timestamp of the first identity authentication label. If the first identity authentication tag is equal to the second identity authentication tag, then the user terminal's identity authentication is determined to be successful.
28. A communication device for electricity user payment, characterized in that, Applications to system trust centers include: The fourth data acquisition unit is used to acquire the root key and take the time parameter selected after the root key is generated as the first time. The data sending unit is configured to send the root key, the timestamp when the user terminal sends the identifier code, and the first time to the user terminal and the server, respectively, so that: The user terminal calculates a first shared key using a hash function based on the root key, the first temporary private key, and the second temporary public key sent by the server. Based on the first shared key and the first time, it generates a first identity key using a key derivation function. Based on the first identity key, it generates a first identity authentication tag. The user terminal then sends the first identity key, the first identity authentication tag, and the timestamp of the first identity authentication tag to the server. The server calculates the second shared key using a hash function based on the root key, the second temporary private key, and the first temporary public key sent by the user terminal. Based on the second shared key and the first time, it generates a second identity key using a key derivation function. The server receives the first identity key, the first identity authentication tag, and the timestamp of the first identity authentication tag sent by the user terminal, and determines whether the user terminal's identity authentication is successful. If the user terminal's identity authentication is successful, the server sends the user terminal's identity authentication success flag to the user terminal, so that the user terminal and the server exchange their respective generated first temporary parameters and second temporary parameters. Based on the second identity key, the first temporary parameters, and the second temporary parameters, the server generates a second session key using a key derivation function, receives encrypted data sent by the user terminal, and performs data interaction with the user terminal based on the second session key. The user terminal receives the authentication success flag sent by the server, generates a first session key based on the first identity key, the first temporary parameter and the second temporary parameter using a key derivation function, encrypts the electricity user payment data based on the first session key to obtain encrypted data, and sends the encrypted data to the server for data interaction.
29. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as claimed in any one of claims 1 to 5, or the steps of the method as claimed in any one of claims 6 to 13, or the steps of the method as claimed in claim 14.
30. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as claimed in any one of claims 1 to 5, or the steps of the method as claimed in any one of claims 6 to 13, or the steps of the method as claimed in claim 14.