Electric meter off-line electricity selling method and system based on asymmetric encryption
By using asymmetric encryption technology to generate and verify offline electricity sales methods, the problems of service interruption and transaction disputes in traditional electricity sales in remote areas and unstable network environments are solved, and a safe and reliable offline electricity sales process is realized.
Patent Information
- Application Number
- CN202511561702.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-29
- Publication Date
- 2026-01-13
- Estimated Expiration
- 2045-10-29
AI Technical Summary
Traditional electricity meter sales solutions suffer from service interruptions in remote areas, network failures, or insufficient base station coverage. The operation chain is lengthy and has a low fault tolerance rate. Real-time requirements are stringent, and the strong binding of cash flow and data flow makes transaction disputes prone to occur.
An offline electricity sales method based on asymmetric encryption is adopted. The electricity sales system generates public-private key pairs, and the handheld device generates corresponding public-private key pairs. The public keys are exchanged, and an uncharged token chain is generated. When selling electricity, the recharge token is obtained by decrypting with the handheld device's private key. During verification, the integrity of the chain is compared to ensure the authenticity and security of the transaction.
It enables secure and reliable electricity sales via meters even when offline, ensuring the immutability of recharge tokens and the authenticity of transactions, simplifying the operation process, and reducing network dependence and the risk of transaction disputes.
Smart Images

Figure CN121033982B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of electric meter application, in particular to an electric meter offline electricity selling method and system based on asymmetric encryption. BACKGROUND
[0002] The traditional electric meter electricity selling scheme has the following three core pain points:
[0003] 1. Strong dependence on communication link
[0004] The scheme is completely subject to Internet or mobile base station SMS communication. In remote areas, network failures or insufficient base station coverage (such as mountainous areas, basements, etc.), the electricity selling service will be directly interrupted, forming a service blind area.
[0005] Users need to go to the business hall or agent site to buy electricity, and go through the multi-step process of meter number provision-amount confirmation-electricity selling system interaction-recharge token acquisition-manual input to the electric meter, with long operation chain and low fault tolerance (such as repeated process due to input error).
[0006] 2. Strict real-time requirement
[0007] The entire electricity selling process needs to maintain real-time online interaction with the electricity selling system. System response delay or temporary offline will lead to transaction failure, with high requirements for network stability.
[0008] 3. Strong binding of fund flow and data flow
[0009] The synchronous mechanism of collecting fees first and then generating recharge token is adopted. Users need to pay the full amount to obtain the recharge voucher, which not only occupies the user's time cost, but also lacks offline pre-authorization function, which is easy to cause transaction disputes in the event of network interruption. SUMMARY
[0010] The technical problem to be solved by the present application is to provide an electric meter offline electricity selling method and system based on asymmetric encryption, which can realize offline electricity selling while ensuring transaction authenticity and security.
[0011] To solve the above technical problems, the first technical solution adopted by the present application is:
[0012] The electric meter offline electricity selling method based on asymmetric encryption comprises:
[0013] Configuring a unique code of the electricity seller;
[0014] The electricity selling system generates a corresponding public-private key pair;
[0015] The game machine generates a corresponding public-private key pair according to the unique code of the electricity seller;
[0016] The electricity selling system and the game machine exchange public keys;
[0017] The electricity selling system generates an uncharged token chain table connected by two or more uncharged token nodes, and sends it to the palm computer for storage; each uncharged token node contains a previous node check value encrypted by the public key of the electricity selling system, a unique meter identifier, and a charged token encrypted by the public key of the palm computer;
[0018] When selling electricity, the palm computer verifies the unique code of the electricity seller and then calls the private key of the palm computer;
[0019] The palm computer retrieves a matching uncharged token node from the uncharged token chain table according to the unique identifier of the target meter of the current transaction, and receives an instruction from the electricity seller to select a target uncharged token node for the current transaction;
[0020] The palm computer obtains the charged token for the current transaction using method one or method two;
[0021] Method one includes:
[0022] The palm computer decrypts each target uncharged token node for the current transaction using its private key, obtains the corresponding charged token, and generates a one-to-one charged token node, which is sequentially connected to the charged token node chain table; each charged token node contains a corresponding uncharged token node check value encrypted by the private key of the palm computer, and a charged amount encrypted by the private key of the palm computer;
[0023] Method two includes:
[0024] The palm computer decrypts each target uncharged token node for the current transaction using its private key, obtains the corresponding charged token, and generates a charged token node corresponding to the current transaction, which is connected to the charged token node chain table; each charged token node contains a check value of all uncharged token nodes for the current transaction encrypted by the private key of the palm computer, a charged amount for the current transaction, and a charged amount for the current transaction encrypted by the private key of the palm computer;
[0025] The palm computer updates the recorded cumulative charged token amount encrypted by the private key of the palm computer according to the decrypted charged token amount for each successful transaction.
[0026] Optionally, it also includes:
[0027] When verifying the electricity selling, the palm computer synchronizes the uncharged token chain table and the charged token node chain table after selling electricity to the electricity selling system;
[0028] The electricity selling system compares the uncharged token chain table after electricity selling with the uncharged token chain table generated by itself to determine whether each uncharged token node in the uncharged token chain table after electricity selling is tampered with.
[0029] If the handheld game machine uses method one, the electricity selling system counts the cumulative charged token node quantity of the current round of electricity selling according to the charged token node quantity of the charged token node chain table after electricity selling, decrypts the cumulative charged token quantity recorded by the handheld game machine using the public key of the handheld game machine to obtain the cumulative charged token quantity of the current round of electricity selling, and compares the cumulative charged token node quantity of the current round of electricity selling with the cumulative charged token quantity of the current round of electricity selling.
[0030] The electricity selling system verifies each charged token node in the charged token node chain table after electricity selling one by one, and the verification includes verifying whether the encrypted corresponding uncharged token node check value recorded in the charged token node is consistent with the check value calculated according to the corresponding uncharged token node in the uncharged token chain table generated by itself.
[0031] Optionally, after determining whether each uncharged token node in the uncharged token chain table after electricity selling is tampered with, the method further includes:
[0032] If the handheld game machine uses method two, the electricity selling system counts the cumulative charged token node quantity of the current round of electricity selling according to the charged quantity of the current transaction recorded in each charged token node in the charged token node chain table after electricity selling, decrypts the cumulative charged token quantity recorded by the handheld game machine using the public key of the handheld game machine to obtain the cumulative charged token quantity of the current round of electricity selling, and compares the cumulative charged token node quantity of the current round of electricity selling with the cumulative charged token quantity of the current round of electricity selling.
[0033] The electricity selling system verifies each charged token node in the charged token node chain table after electricity selling one by one, and the verification includes verifying whether the encrypted check value of all uncharged token nodes of the current transaction recorded in the charged token node is consistent with the check value calculated according to the corresponding uncharged token node in the uncharged token chain table generated by itself.
[0034] Optionally, when verifying the electricity selling, the method further includes:
[0035] The electricity selling system calculates and displays the corresponding electricity purchase amount according to the cumulative charged token node quantity of the current round of electricity selling.
[0036] Optionally, further comprising:
[0037] If the power selling verification passes, the power selling system informs the game machine to initialize and destroy all data of the current power selling.
[0038] Optionally, further comprising:
[0039] The target electric meter receives the recharge token through manual input or Bluetooth communication or radio frequency communication and performs corresponding amount of recharge.
[0040] Optionally, the power selling system generates an un-recharged token linked list connected by two or more un-recharged token nodes, comprising:
[0041] The power selling system generates two or more quantitative recharge tokens for each electric meter;
[0042] The un-recharged token nodes corresponding to each recharge token are sequentially generated, and an un-recharged token linked list sequentially connected by each un-recharged token node is obtained.
[0043] Optionally, the power selling system generates an un-recharged token linked list connected by two or more un-recharged token nodes, comprising:
[0044] The power selling system generates two or more quantitative recharge tokens for each electric meter according to potential power purchasing users and potential power purchasing amounts predicted based on historical power consumption data of the users;
[0045] The un-recharged token nodes corresponding to each recharge token are sequentially generated, and an un-recharged token linked list sequentially connected by each un-recharged token node is obtained.
[0046] Another technical solution provided by the application is:
[0047] The electric meter offline power selling system based on asymmetric encryption comprises a power selling system, a game machine and an electric meter; the power selling system and the game machine are connected in communication through wired and / or wireless modes;
[0048] The power selling system is configured to be capable of realizing the steps performed by the power selling system in the above-mentioned electric meter offline power selling method based on asymmetric encryption;
[0049] The game machine is configured to be capable of realizing the steps performed by the game machine in the above-mentioned electric meter offline power selling method based on asymmetric encryption.
[0050] Optionally, the electric meter and the game machine are connected in communication through Bluetooth or radio frequency.
[0051] The beneficial effects of the present application are that the meter offline power selling method and system based on asymmetric encryption provided by the present application encrypt the recharge token in the power selling system through the game machine public key, and issue it to the game machine in the form of an unrecharged token linked list; only the power seller verified by the game machine can call the game machine private key to decrypt the unrecharged token node to obtain the recharge token during power selling; at the same time, the game machine generates a charged token node corresponding to each successfully decrypted unrecharged token node in each transaction, and maintains a charged token node linked list, which is used for verification by the power selling system after power selling. The present application innovatively builds a secure interactive channel based on asymmetric encryption technology between the power selling system and the game machine, and between the game machine and the power seller, to realize offline power selling of the meter, and can guarantee that the recharge token has non-tamperable security and reliability and authenticity in the whole process from generation, transmission, consumption to verification, thereby effectively guaranteeing the safety of power resources. BRIEF DESCRIPTION OF DRAWINGS
[0052] Figure 1 A flowchart of a meter offline power selling method based on asymmetric encryption provided by an embodiment of the present application;
[0053] Figure 2 A structure diagram of an unrecharged token linked list and a charged token node in the specific embodiment of the present application;
[0054] Figure 3 A composition diagram of a meter offline power selling system based on asymmetric encryption provided by an embodiment of the present application;
[0055] Figure 4 A meter offline power selling interactive diagram provided by the specific embodiment of the present application. DETAILED DESCRIPTION
[0056] In order to better understand the above technical solutions, the above technical solutions will be described in detail below in combination with the drawings in the specification and the specific embodiments. It should be understood that the embodiments described herein and shown in the drawings are only used to more clearly illustrate the technical solutions of the present application, and therefore only serve as examples and are intended to explain the present application, and should not be understood as a limitation on the present application. It should be understood that the present application can be implemented in various forms and should not be limited by the embodiments described herein.
[0057] In order to better understand the above technical solutions, the above technical solutions will be described in detail below in combination with the drawings in the specification and the specific embodiments. It should be understood that the embodiments described herein and shown in the drawings are only used to more clearly illustrate the technical solutions of the present application, and therefore only serve as examples and are intended to explain the present application, and should not be understood as a limitation on the present application. It should be understood that the present application can be implemented in various forms and should not be limited by the embodiments described herein.
[0058] The offline state of the present application refers to the process of charging the electric meter offline, without the need to rely on the Internet or mobile base station SMS communication. The electric meter and the handheld game machine do not need to maintain communication connection with the power selling system, and do not need to interact with the power selling system. The token is charged into the electric meter.
[0059] In this paper, the token refers to the amount of money / electricity charging coupon generated by the power selling system. The chip in the electric meter will update the remaining electricity / amount according to the received token, and the decryption verification will be passed.
[0060] Figure 1 The flowchart of the electric meter offline power selling method based on asymmetric encryption provided by the embodiment of the present application. Figure 2 The structure diagram of the uncharged token linked list and the charged token node in the specific embodiment of the present application.
[0061] As shown in Figure 1 The embodiment of the present application provides an electric meter offline power selling method based on asymmetric encryption, which at least includes the following contents:
[0062] I. Preparation before power selling
[0063] S1-1: Configure the unique code of the power seller;
[0064] Here, each power seller has a unique code corresponding to it. The unique code of the power seller serves as the identity certificate of the power seller and also as the legal power selling certificate of the power seller. The unique code of the power seller is used in this embodiment to ensure that only the power seller himself can decrypt the handheld game machine private key, i.e. the power selling private key, in the handheld game machine by means of the unique code, and only the power selling private key can decrypt the token. This ensures the authenticity of the transaction.
[0065] Optionally, the unique code of the power seller can be configured by the power seller himself in the power selling system; it can also be generated by the power selling system and then granted to the power seller; or it can be a unique identifier pre-configured by the power grid unit for the power seller, such as a work number, a certificate serial number, etc.
[0066] In particular, the association between the power seller and the unique code is securely stored in the power selling system.
[0067] S1-2: The power selling system generates a corresponding public-private key pair;
[0068] Optionally, the power selling system can use the RSA asymmetric encryption algorithm to randomly generate a pair of public-private key pairs through OpenSSL, OpenSSH, etc. or Java programming; or it can use the ECC algorithm to randomly generate a pair of public-private key pairs through OpenSSL.
[0069] S1-3: The palm machine generates a corresponding public-private key pair according to the unique code of the power seller;
[0070] In some embodiments, a pair of public-private keys can be randomly generated in the same or different way as the power selling system, and then the unique code of the power seller is used to encrypt the private key, and the encrypted private key and the unencrypted public key are marked as the public-private key pair of the palm machine.
[0071] In some embodiments, the unique code of the power seller can also be selected as a seed parameter and directly integrated into the generation algorithm of the public-private key pair to generate the public-private key pair of the palm machine.
[0072] By strongly associating the private key of the palm machine with the identity certificate of the power seller, the uniqueness of the palm machine and the power seller can be bound, and the legal power selling operator of each palm machine can be determined to prevent the use of palm machines for illegal power selling.
[0073] S1-4: The power selling system exchanges public keys with the palm machine;
[0074] The power selling system and the palm machine will exchange public keys in a secure / regulatory environment (such as a designated operating scenario in a power company) through wireless (such as Bluetooth, radio frequency, etc.) or wired (such as encrypted http / TCP, serial port, USB, etc.) communication methods to ensure the safety and reliability of the exchange process.
[0075] Here, the power selling system and the palm machine exchange public keys to verify the data encrypted by the private key of the other party during communication to ensure the authenticity and security of the communication data.
[0076] S1-5: The power selling system generates an uncharged token linked list connected by two or more uncharged token nodes and issues it to the palm machine for storage;
[0077] As shown in Figure 2 Each uncharged token node contains the previous node verification value encrypted by the public key of the power selling system, the unique identifier of the power meter, and the charged token encrypted by the public key of the palm machine.
[0078] Specifically, the electricity selling system first generates a certain number of quantitative recharge tokens; the "quantitative" refers to a fixed recharge amount, and the recharge amount is the amount of money or the amount of electricity charged to the meter. The rate set in the meter is 1, and the specific amount of electricity charged each time needs to be calculated according to the electricity price set by the power company. Then, the electricity selling system corresponds to each recharge token, and the unique meter identifier and the encrypted recharge token using the public key of the game console are assembled together to form an initial node. Then, each initial node is sequentially connected together in a certain order, and the check value of the previous node connected to it is added to each initial node to form an unrecharged token node. In this way, an unrecharged token linked list connected by two or more unrecharged token nodes is obtained.
[0079] Here, by recording the check value of the previous node in each unrecharged token node, a check dependency relationship between unrecharged token nodes is established, which can effectively prevent the electricity seller or other personnel from arbitrarily deleting unrecharged token nodes for private interests. By encrypting the public key of the recharge token game console in the unrecharged token node, the security of the recharge token is guaranteed, and theft during transmission to the game console or during storage in the game console is prevented.
[0080] As a specific example, each unrecharged token node is composed of a three-tuple (md5, IDNumber, encryptedToken). Wherein, md5 refers to the md5 check value generated using the MD5 encryption algorithm; IDNumber refers to the unique ID code of the meter, referred to as the meter number; encryptedToken = encrypt(token, public key of the game console pubkey) refers to the result obtained by encrypting the recharge token using the public key pubkey of the game console.
[0081] In some specific embodiments, a specific implementation process of the S1-5 steps is as follows:
[0082] The power company first predicts the potential electricity purchasing users and their potential electricity purchasing quantity quantity based on the user's historical electricity consumption data, and obtains the meter number IDNumber corresponding to the potential electricity purchasing users;
[0083] The power selling system generates two or more quantitative recharge tokens for each meter ID number corresponding to a potential power purchasing user, and each recharge token corresponds to a recharge amount or a recharge power. The number of recharge tokens corresponding to each meter ID number is determined according to the potential power purchasing quantity. Here, the potential power purchasing quantity is divided into N parts, and each part generates a recharge token, which facilitates the user to purchase the required number of recharge tokens as needed. As a specific example, the method for generating recharge tokens according to the potential power purchasing quantity is gen_token(number), and then N recharge tokens = gen_token(quantity / N) are generated.
[0084] Subsequently, the un-recharge token nodes corresponding to each recharge token are sequentially generated, and the un-recharge token linked list sequentially connected by each un-recharge token node is obtained.
[0085] Here, the corresponding recharge tokens are only generated for the meters of potential power purchasing users, which not only reduces system resource consumption and reduces the generation and storage of invalid recharge tokens, but also improves the security of recharge tokens and prevents the abuse of recharge tokens. At the same time, since potential users usually have clear recharge requirements, they can provide more accurate token services for them, optimize user experience, and further simplify the management process of recharge tokens and reduce the complexity of operation and maintenance.
[0086] In some specific embodiments, another specific implementation process of the S1-5 steps is as follows:
[0087] The power selling system generates two or more quantitative recharge tokens for each meter corresponding to it, and the number of recharge tokens corresponding to each meter is preset. Then, the un-recharge token nodes corresponding to each recharge token are sequentially generated, and the un-recharge token linked list sequentially connected by each un-recharge token node is obtained.
[0088] Here, recharge tokens are generated in advance for all power users, i.e., full-amount recharge tokens are generated, which can ensure that any user can enjoy offline recharge services and avoid the situation that legitimate users cannot obtain tokens in time due to errors in potential user identification algorithms.
[0089] The above two recharge token generation methods can be flexibly configured according to the resources, performance, processing cost, storage cost, business scenario demand, and other factors of the power selling system and the handheld machine.
[0090] II. Power selling process
[0091] S2-1 ( Figure 1 (Not shown): When selling electricity, the electricity seller carries a handheld device and walks around to ask electricity users if they have any needs to purchase electricity;
[0092] S2-2 ( Figure 1 (Not shown): When an electricity user has a need to purchase electricity, the user should inform the salesperson of the desired quantity of electricity and the unique identifier of the meter. Preferably, the unique code of the meter can be obtained directly by scanning the meter with a handheld device, avoiding errors in verbal communication and optimizing the electricity sales process.
[0093] S2-3: The electricity salesperson enters their unique code into the handheld device. After the handheld device verifies the electricity salesperson's unique code, it retrieves the handheld device's private key.
[0094] The retrieval mentioned here refers to the secure retrieval of the handheld device's private key, not its public display in plaintext; no one, including the electricity salesperson, can directly access the handheld device's private key to ensure its security.
[0095] S2-4: The handheld device retrieves the matching uncharged token node from the uncharged token chain in the database based on the unique identifier of the target electricity meter in the current transaction (the electricity meter that is the object of the transaction is referred to as the unique identifier of the target electricity meter in the following text).
[0096] Here, matching refers to the unique identifier of the electricity meter recorded in the uncharged token node being consistent with the unique identifier of the target electricity meter.
[0097] Preferably, the retrieved uncharged token node will be displayed on the handheld device's screen.
[0098] Further preferably, to facilitate more efficient and accurate electricity sales for sales personnel, the handheld device's display for retrieved unrecharged token nodes only needs to show the key identifier information required in the electricity sales process, such as the unique meter identifier and corresponding amount, for confirmation by the sales personnel / users; instead of displaying complex information unrelated to electricity sales confirmation, such as the node's specific content. This improves the visual simplicity of the handheld device interface, allowing for a focus on key information, while also ensuring the security of unrecharged token nodes.
[0099] S2-5: The handheld device receives the instruction from the electricity salesperson to select the target node for this transaction that has not been recharged with tokens;
[0100] Here, the electricity salesperson will select a specific number of unrecharged token nodes corresponding to the amount to be recharged from multiple unrecharged token nodes retrieved from the handheld device, based on the interaction confirmation with the electricity user, as the target unrecharged token nodes for this transaction.
[0101] S2-6: The palm machine uses method one or method two to obtain the recharge token of this transaction;
[0102] The method one specifically includes:
[0103] A. The palm machine uses its private key to decrypt the target un-recharge token node of this transaction corresponding to the instruction one by one, and obtains the corresponding recharge token. The obtained recharge token can be directly issued to the target meter, and the corresponding amount of recharge is performed in the meter.
[0104] Here, only the private key of the palm machine can correctly decrypt the target un-recharge token node to obtain the corresponding recharge token, so as to ensure that the acquisition and use of the recharge token are safe, compliant and legal.
[0105] B. The palm machine generates a one-to-one charged token node corresponding to each successfully decrypted target un-recharge token node, and sequentially accesses the charged token node linked list. The "sequentially" can be understood as: the palm machine has a sequence for decrypting each target un-recharge token node, and each charged token node with the same time sequence is generated by comparing the decryption sequence. According to the time sequence, the charged token node is sequentially accessed to the charged token node linked list according to the decryption sequence.
[0106] When the palm machine uses method one to obtain the recharge token of this transaction, the generated "charged token node linked list" is as shown in "form one" in Figure 2 Each charged token node includes three key fields: the verification value of the corresponding un-recharge token node encrypted by the private key of the palm machine, the recharge amount, and the recharge amount encrypted by the private key of the palm machine. The verification value can be md5 value, SHA hash value, CRC32 check code, parity check code, and Gray code. The recharge amount refers to the recharge amount corresponding to the recharge token obtained by decrypting a target un-recharge token node. As known from the above, the recharge amount can be a recharge amount or a recharge power. Here, the verification value and the recharge amount are respectively signed by the private key of the palm machine, which can prevent the transaction record from being tampered with and ensure the authenticity and reliability of the transaction record.
[0107] The method two specifically includes:
[0108] a. The palm machine uses its private key to decrypt the target un-recharge token node of this transaction one by one, and obtains the corresponding recharge token;
[0109] b. The palm machine generates a recharged token node for each transaction and accesses the recharged token node chain table. That is, a recharged token node records the relevant data of a transaction.
[0110] When the palm machine uses method two to obtain the recharged token of this transaction, the generated "recharged token node chain table" is as shown in "Form Two" in Figure 2 Each recharged token node contains three key fields: the verification value of all uncharged token nodes involved in this transaction encrypted by the private key of the palm machine, all recharged amounts of this transaction, and all recharged amounts of this transaction encrypted by the private key of the palm machine. The verification value can be md5 value, SHA hash value, CRC32 check code, parity check code, and Gray code. The all recharged amounts refer to the total amount of recharged tokens corresponding to all recharged tokens obtained by decrypting this transaction. As can be seen from the above, the recharged amount can be a recharged amount or a recharged power. Here, the verification value and the recharged amount are signed by the private key of the palm machine, which can prevent transaction records from being tampered with and ensure the authenticity and reliability of transaction records.
[0111] The recharged token node chain table obtained by the above method one or method two can effectively guarantee the authenticity and integrity of the electricity sale transaction.
[0112] S2-7: After each transaction is completed, the palm machine will also update the cumulative recharged token quantity recorded by itself and sign it using the private key of the palm machine.
[0113] As a specific example, assume that the total number of completed recharged tokens after recharging is N, i.e., N = cumulative recharged token quantity, then calculate the signature number_sign = signature sign (private key privKey, N) of the recharged token quantity, and assume that the token_num field of the t_sign signature table in the database is used to store the signature number_sign of the recharged token quantity token_num. Then, the method for updating the t_sign signature table after each recharging is complete is: update t_sign set token_num = number_sign.
[0114] The cumulative recharged token quantity records the number of tokens that have been recharged so far. The nodes in the recharged token node chain table represent completed transactions, and the record of "cumulative recharged token quantity" guarantees the integrity of the chain table nodes and prevents each node in the chain table from being deleted to achieve the purpose of withdrawing transactions.
[0115] S2-8: The electricity seller collects the electricity fee amount of this transaction;
[0116] S2-9: The target meter receives the recharge token through manual input or Bluetooth communication or radio frequency communication and performs the corresponding amount of recharge.
[0117] Here, short-distance communication between the target meter and the handheld game machine is supported to achieve efficient and accurate token recharge.
[0118] III. Electricity sales verification
[0119] When the electricity seller completes the electricity sales and returns to the power company with the handheld game machine, electricity sales verification, i.e., account reconciliation and financial accounting, is required.
[0120] Specifically, electricity sales verification includes the following steps:
[0121] S3-1: The handheld game machine synchronizes the "unrecharged token linked list" and "recharged token node linked list" in it to the electricity sales system;
[0122] S3-2: The electricity sales system compares the received unrecharged token linked list after electricity sales with the unrecharged token linked list generated by itself before to determine whether each unrecharged token node in the unrecharged token linked list has been tampered with.
[0123] Here, the comparison verification content includes the number of nodes, node content, and node sequence to ensure that the data on the unrecharged token linked list after electricity sales has not been tampered with. It can be understood that based on the verification dependency relationship between each node on the unrecharged token linked list, once one node is modified (e.g., deleted), all subsequent nodes will change. Therefore, through this step, it can be ensured that the data on the unrecharged token linked list has not been tampered with.
[0124] S3-3: The electricity sales system counts the cumulative recharge token node quantity of this round of electricity sales based on the recharged token node linked list after electricity sales to verify the cumulative recharge token node quantity of this round of electricity sales.
[0125] Specifically, corresponding to the different methods used by the handheld game machine in the above S2-6 step, the generated "recharged token node linked list" will be different.
[0126] Correspondingly, the statistical method based on the "recharged token node linked list" in this step is also different:
[0127] The statistical method corresponding to Method One (i.e., "Form One" in Figure 2 is as follows:
[0128] A-1, the power selling system obtains the cumulative recharge token node quantity of the current round of power selling according to the quantity of the recharge token nodes in the recharge token node chain table after power selling; here, based on the relationship that "one unrecharge token node" is consumed to generate "one recharge token node", the total quantity of the recharge tokens consumed in the current round of power selling can be obtained by accumulating the quantity of the nodes contained in the recharge token node chain table.
[0129] B-1, the cumulative recharge token quantity recorded by the palm computer is decrypted using the public key of the palm computer to obtain the cumulative recharge token quantity of the current round of power selling.
[0130] C-1, whether the cumulative recharge token node quantity of the current round of power selling and the cumulative recharge token quantity of the current round of power selling are consistent, i.e. whether the results of A-1 and B-1 are consistent.
[0131] The statistical method corresponding to method two (i.e. "Form Two" in Figure 2 is as follows:
[0132] a-1, the power selling system obtains the cumulative recharge token node quantity of the current round of power selling according to the quantity of the recharge token nodes in the recharge token node chain table after power selling; here, based on the relationship that "all unrecharge token nodes involved in one transaction" generate "one recharge token node", and the quantity of the recharge tokens is fixed, the total quantity of the recharge tokens consumed in the current round of power selling can be obtained by analyzing the recharge token node.
[0133] b-1, the cumulative recharge token quantity recorded by the palm computer is decrypted using the public key of the palm computer to obtain the cumulative recharge token quantity of the current round of power selling.
[0134] c-1, whether the cumulative recharge token node quantity of the current round of power selling and the cumulative recharge token quantity of the current round of power selling are consistent, i.e. whether the results of a-1 and b-1 are consistent.
[0135] Here, the "cumulative recharge token node quantity of the current round of power selling" obtained by decryption is authentic, and by judging whether the "cumulative recharge token node quantity of the current round of power selling" is consistent with the "cumulative recharge token quantity of the current round of power selling" obtained by analyzing the "recharge token node chain table" generated by the transaction, it can be determined whether the "recharge token node chain table" in the palm computer is authentic and reliable and has not been tampered with, so as to ensure that the "transaction record" of the palm computer is authentic and reliable.
[0136] S3-4: The electricity selling system verifies each of the recharged token nodes in the recharged token node linked list after the electricity selling; the verification includes: verifying whether the "encrypted corresponding uncharged token node check value" / "encrypted all uncharged token node check values of this transaction" recorded in the recharged token node is consistent with the check value calculated according to the corresponding uncharged token node in the uncharged token node linked list generated by itself.
[0137] Specifically, corresponding to the different methods used by the palm machine in the above S2-6 step, the node verification method based on the "recharged token node linked list" in this step is also different:
[0138] The node verification method corresponding to method one (i.e. "form one" in Figure 2 is as follows:
[0139] D-1, the electricity selling system uses the public key of the palm machine to decrypt the "encrypted corresponding uncharged token node check value of the uncharged token node corresponding to the recharged token node" recorded in the recharged token node, to obtain the corresponding uncharged token node check value;
[0140] E-1, the electricity selling system obtains the corresponding uncharged token node from the uncharged token node linked list generated by itself, and calculates the check value; and judges whether the calculated check value is consistent with the decrypted check value.
[0141] The node verification method corresponding to method two (i.e. "form two" in Figure 2 is as follows:
[0142] d-1, the electricity selling system first uses the public key of the palm machine to decrypt the "encrypted all uncharged token node check values of this transaction" recorded in the recharged token node, to obtain "all uncharged token node check values of this transaction";
[0143] e-1, then obtains all uncharged token nodes corresponding thereto from the uncharged token node linked list generated by itself, and calculates the check value;
[0144] f-1, finally, judges whether the calculated check value is consistent with the decrypted check value.
[0145] Here, by verifying each of the recharged token nodes in the recharged token node linked list, it can be ensured that the electricity selling transaction process is real and legal and compliant.
[0146] In the embodiment, if the above S3-2 to S3-4 steps are all verified, it is indicated that the data on the token node list after charging is not tampered, that is, the electricity selling transaction data is not tampered, and the electricity selling transaction satisfies the authenticity, legality and reliability throughout the whole process.
[0147] S3-5: The electricity selling system calculates the corresponding electricity purchase amount to be paid according to the number of accumulated token nodes of the current electricity selling, and displays the electricity purchase amount to be paid. The operator of the electricity selling system verifies whether the electricity purchase amount to be paid calculated by the system is consistent with the amount paid by the electricity seller.
[0148] IV. Aftercare
[0149] If the electricity selling verification is passed, the electricity selling system notifies the palm computer to initialize and destroy all data of the current electricity selling, and the destroyed data includes but is not limited to: the uncharged token list, the charged token node list and other related records.
[0150] Preferably, the electricity selling system also cancels the uncharged token that is not used.
[0151] Through the step, the uncharged token that is not used can be destroyed in time to prevent it from being used for illegal profiteering.
[0152] In the embodiment, through the above electricity selling verification and aftercare, the authenticity, legality and safety of the electricity selling transaction and the safety of the token can be guaranteed, thereby effectively guaranteeing the property safety of the power company.
[0153] The electricity meter offline electricity selling method based on asymmetric encryption provided in the embodiment is realized by the following steps: first, the electricity selling system generates a token and safely issues the token to the palm computer; second, the palm computer is used for electricity selling and charging, and the token is issued to the electricity meter to complete the charging. Thus, the electricity selling can be safely and reliably completed in an offline state.
[0154] Figure 3 A composition schematic diagram of an electricity meter offline electricity selling system based on asymmetric encryption provided in the embodiment of the application; Figure 4 An electricity meter offline electricity selling interaction schematic diagram provided in the embodiment of the application.
[0155] As Figure 3 shown, the electricity meter offline electricity selling system based on asymmetric encryption provided in the embodiment includes an electricity selling system, a palm computer and a plurality of electricity meters (electricity meter 1 to electricity meter n in the figure); the electricity selling system and the palm computer can be connected in communication through a wired and / or wireless mode; the electricity meters and the palm computer can be connected in communication through Bluetooth or radio frequency;
[0156] The electricity selling system is configured to be able to realize all steps performed by the electricity selling system in the electricity meter offline electricity selling method based on asymmetric encryption described in the above embodiments.
[0157] The palm machine is configured to be able to realize all steps performed by the palm machine in the electricity meter offline electricity selling method based on asymmetric encryption described in the above embodiments.
[0158] Here, the specific step content will not be repeated, please refer to the description of the above embodiments for details.
[0159] As shown in Figure 4 In some specific embodiments, the electricity meter offline electricity selling system based on asymmetric encryption realizes electricity meter offline electricity selling through the interaction shown in Figure 4
[0160] The electricity meter offline electricity selling system based on asymmetric encryption provided in this embodiment can complete electricity selling in the offline state of the electricity selling system, and the electricity selling transaction has security, reliability and effectiveness guarantee throughout the whole process.
[0161] Based on any of the above embodiments, the present application also provides a specific application scenario to help better understand.
[0162] It is agreed here that the encryption method is encrypt, the decryption method is decrypt, the signature method is sign, and the signature verification method is checkSign.
[0163] I. Electricity seller registration and palm machine-electricity selling system key exchange
[0164] 1. The electricity selling system and the palm machine each generate a public key and a private key;
[0165] It is agreed here that the public key of the electricity selling system is identified as sysPubKey, and the private key is identified as sysPrivKey; the public key of the palm machine is identified as appPubKey, and the private key is identified as appPrivKey.
[0166] 2. The electricity selling system and the palm machine exchange public keys;
[0167] After the electricity seller inputs the unique code password pre-configured by him / her, the electricity selling system and the palm machine exchange their respective public keys, the electricity selling system stores the palm machine public key appPubKey and the electricity selling system private key sysPrivKey; the palm machine stores the electricity selling system public key sysPubKey and the private key encrypted using the unique code input by the electricity seller tmpPrivKey=encrypt(palm machine private key appPrivKey, electricity seller unique code password).
[0168] II. Batch generation of tokens
[0169] 1. Suppose that a user's average electricity consumption in the past half year is quantity, the table number is IDNumber, and the method for generating the corresponding token is gen_token. If the electricity is divided into N parts, then N tokens will be generated for this electricity user, and each token = gen_token(quantity / N);
[0170] 2. Generate a node on the chain for each token; each node contains three parts: part1 is the md5 check value of the previous node, part2 is the table number, and part3 is the encrypted token. Part1 = encrypt(md5 check value(last part1 + last part2 + last part3), electricity sales system public key sysPubKey), part2 = table number IDNumber, and part3 = encrypt(token, app public key appPubKey);
[0171] 3. Distribute the uncharged token chain table composed of all uncharged token nodes to the app.
[0172] Three, electricity sales
[0173] 1. Suppose that the user with table number IDNumber wants to buy electricity, and the quantity is M. It is particularly noted that the quantity here may be the electricity quantity or the amount according to the business model. The electricity seller inputs the quantity M into the app and inputs the password password. The app scans the N available nodes in the uncharged token chain table through the table number IDNumber.
[0174] First, decrypt the app private key appPrivKey = decrypt(tmpPrivKey, password) through the unique code password of the electricity seller; then, decrypt the token = decrypt(part3, app private key appPrivKey) one by one, and the corresponding charged quantity curQuantity can be obtained in the token;
[0175] 2. Decrypt the nodes one by one until the sum of the recharge quantity curQuantity of the decrypted nodes exceeds the planned electricity purchase quantity M (the last decrypted node is actually useless decryption). Assuming that the sale quantity saleNumber of tokens needs to be decrypted finally for the purchase of the quantity M of electricity as much as possible, for the effective decryption, the node of the recharged token is generated, which also contains 3 parts, marked as dpartl, dpart2, dpart3 respectively. Among them, dpartl = signature sign (md5 (partl + part2 + part3), appPrivKey), dpart2 = recharge quantity curQuantity, dpart3 = signature sign (recharge quantity curQuantity, appPrivKey);
[0176] 3. Scan the number of recharged token nodes, assuming that there are NUM, then calculate the signature numSign = signature sign (NUM, appPrivKey) of the number, and finally save it to the database table;
[0177] 4. Actual sale quantity = sale quantity saleNumber Recharge quantity curQuantity, then the receivable amount = sale quantity saleNumber Recharge quantity curQuantity Tariff tariff, tariff tariff represents how much one degree of electricity sells. Here, if the quantity of the electric meter recharge represents the amount of electricity, then tariff represents the rate of the electricity company price, if the quantity of the electric meter recharge represents the amount, then tariff = 1.
[0178] 5. The electricity seller collects the receivable amount from the user.
[0179] Four, financial reconciliation and token destruction
[0180] 1. The electricity seller carries the palm computer back to the business hall and hands it over to the electricity selling system operator for verification;
[0181] 2. The electricity selling system synchronizes the data in the palm computer to the system.
[0182] 3. Check whether the data of the uncharged token chain table obtained from the palm computer is completely consistent with the data of the uncharged token chain table issued by the electricity selling system;
[0183] 4. Count the number of recharged tokens totalCount, and then verify the signature checkSign (the number of recharged tokens TotalCount, appPubKey);
[0184] 5. Verify each recharged token node. First, verify the signature checkSign(dpart1, handheld public key appPubKey) to obtain the md5 check value. Then, iterate through each node in the unrecharged token chain to see if the node's md5 check value (part1+part2+part3) matches the obtained md5 check value.
[0185] 6. Verify dpart3, verify the signature checkSign(dpart3, handheld public key appPubKey)=dpart2;
[0186] 7. Sum the dpart2 values of each recharged token node, then multiply by the rate (tariff) to obtain the amount the electricity salesperson should remit for this transaction. Finally, verify the amount remitted with the actual amount remitted.
[0187] 8. After the comparison is confirmed to be correct, the electricity sales system notifies the handheld device to destroy the record.
[0188] The offline electricity sales method and system based on asymmetric encryption provided in the above specific application scenarios have at least the following advantages:
[0189] (1) Security:
[0190] The recharge token is encrypted using the handheld device's public key, and can only be decrypted using the private key built into the handheld device; the recharge record is signed using the handheld device's private key, indicating that the record truly originates from the handheld device.
[0191] (2) Recharge records cannot be deleted:
[0192] After each recharge is completed, the total number of recharged tokens is signed and overwritten into the handheld device's database to prevent recharge records from being deleted.
[0193] (3) Financial accounting:
[0194] Based on the above two points, the authenticity of the recharge records can be guaranteed. Combined with the original token records stored in the electricity sales system, the recharged tokens and unrecharged tokens can be compared to obtain the actual electricity sales amount, which is convenient for calculating the amount due with the electricity salesperson.
[0195] (4) Effect:
[0196] This enables offline electricity sales. Power companies can generate tokens in batches and give them to electricity salespersons, who can then go to users' homes to sell electricity. Unsold tokens can be destroyed by the power company to ensure the security of unrecharged tokens.
[0197] It is to be noticed that the term "comprising", used in the claims, should not be interpreted as being restricted to the means listed thereafter; it does not exclude other elements or steps. It is thus to be interpreted as specifying the presence of the stated features but not precluding the presence of further features. In the claims, the word "a" or "an" means "one or more" when used in the context of "comprising". The word "first", "second", "third", etc. does not necessarily mean "one", but can mean "one or more" when used in the context of "comprising". The word "another" means "at least a second or more". The word "another" means "at least a second or more". The word "some" means "one or more". The word "another" means "at least a second or more". The word "some" means "one or more".
[0198] While the preferred embodiments of the application have been described above, it should be understood that many modifications and adaptations thereof will be apparent to those skilled in the art in view of the foregoing description. Accordingly, the patent should not be limited to the preferred embodiments but should be given the broadest scope in accordance with the principles and the scope of the appended claims.
[0199] Obviously, numerous modifications and variations of the present application are possible in light of the above teachings. It is therefore to be understood that within the scope of the appended claims and their equivalents, the application can be practiced otherwise than as specifically described.
[0200] In the description of the present application, it is to be understood that the terms "first", "second", "third" and the like, do not connote any absolute priority or importance, but are used to distinguish one element from another. Thus, a "first", "second", or "third" feature can include one or more such features. In the description of the present application, the term "plurality" means two or more, unless otherwise specifically defined.
[0201] In the present application, unless otherwise explicitly specified and limited, the terms "mounting", "connecting", "connecting", "fixing" and the like should be interpreted broadly, for example, it can be fixed connection, or detachable connection, or integral; it can be mechanical connection, or electrical connection; it can be direct connection, or indirect connection through intermediate medium; it can be internal communication of two elements or interaction relationship between two elements. For those skilled in the art, the specific meaning of the above terms in the present application can be understood according to the specific circumstances.
[0202] In the present disclosure, unless specifically stated and limited otherwise, a first feature "on" or "under" a second feature can be directly in contact with the second feature, or indirectly in contact with the second feature through an intermediate medium. Also, a first feature "over", "above" and "on top of" a second feature can mean the first feature is directly above or obliquely above the second feature, or simply means the first feature is horizontally higher than the second feature. A first feature "under", "below" and "underneath" a second feature can mean the first feature is directly below or obliquely below the second feature, or simply means the first feature is horizontally lower than the second feature.
[0203] In the description of the present disclosure, the description of the terms "one embodiment", "some embodiments", "an example", "a specific example", or "some examples" and the like means that the specific features, structures, materials or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present disclosure. In the present disclosure, the illustrative description of the above terms should not be understood as necessarily referring to the same embodiment or example. Also, the specific features, structures, materials or characteristics described can be combined in any appropriate manner in any one or more embodiments or examples. In addition, the skilled person in the art can combine and combine the different embodiments or examples described in the present disclosure and the features of the different embodiments or examples without contradiction.
[0204] The above is only an embodiment of the present disclosure, and does not limit the patent scope of the present disclosure, and any equivalent transformation or direct or indirect application in the related technical field by using the content of the present disclosure and the drawings is also included in the patent protection scope of the present disclosure.
Claims
1. A method for off-line electricity vending by a power meter based on asymmetric encryption, characterized in that, The application comprises: a unique code of a power seller is configured; a corresponding public-private key pair is generated by a power selling system; a corresponding public-private key pair is generated by a palm machine according to the unique code of the power seller; the power selling system and the palm machine exchange public keys; the power selling system generates an uncharged token chain table connected by two or more uncharged token nodes, and stores it in the palm machine; each uncharged token node contains a previous node check value encrypted by the public key of the power selling system, a unique meter identifier, and a charged token encrypted by the public key of the palm machine; when selling power, the palm machine verifies the unique code of the power seller, and then calls the private key of the palm machine; the palm machine retrieves a matching uncharged token node from the uncharged token chain table according to the target meter unique identifier of the current transaction, and receives an instruction from the power seller to select a target uncharged token node for the current transaction; the palm machine obtains the charged token for the current transaction by using method one or method two; method one comprises: the palm machine uses its private key to decrypt the target uncharged token node for the current transaction one by one, obtains the corresponding charged token, and generates a one-to-one charged token node, which is sequentially connected to the charged token node chain table; each charged token node contains a corresponding uncharged token node check value encrypted by the private key of the palm machine, and a charged amount encrypted by the private key of the palm machine; method two comprises: the palm machine uses its private key to decrypt the target uncharged token node for the current transaction one by one, obtains the corresponding charged token, and generates a charged token node corresponding to the current transaction, which is connected to the charged token node chain table; each charged token node contains a check value of all uncharged token nodes for the current transaction encrypted by the private key of the palm machine, a charged amount for the current transaction, and a charged amount for the current transaction encrypted by the private key of the palm machine; the palm machine updates the cumulative charged token amount recorded using the private key of the palm machine according to the number of successfully decrypted charged tokens for each transaction.
2. The non-symmetrical encryption based off-line electricity vending method for electricity meter as claimed in claim 1, wherein, The application further comprises: when verifying power selling, the palm machine synchronizes the uncharged token chain table and the charged token node chain table after power selling to the power selling system; the power selling system compares the uncharged token chain table after power selling with the uncharged token chain table generated by itself to determine whether each uncharged token node in the uncharged token chain table after power selling has been tampered with; if the palm machine uses method one, the power selling system counts the cumulative charged token node amount for the current round of power selling according to the number of charged token nodes in the charged token node chain table after power selling, decrypts the cumulative charged token amount recorded by the palm machine using the public key of the palm machine to obtain the cumulative charged token amount for the current round of power selling, and compares the cumulative charged token node amount for the current round of power selling with the cumulative charged token amount for the current round of power selling; and The power selling system verifies each of the recharged token nodes in the recharged token node linked list after power selling; the verification includes: verifying whether the encrypted corresponding uncharged token node check value recorded in the recharged token node is consistent with the check value calculated according to the corresponding uncharged token node in the uncharged token node linked list generated by itself.
3. The non-symmetrical encryption based off-line electricity vending method for electricity meter as claimed in claim 2, wherein, The judgment of whether each uncharged token node in the recharged uncharged token node linked list is tampered with further includes: If the game machine uses method two, the power selling system obtains the cumulative recharged token node quantity of the current round of power selling according to the recharged quantity of the current transaction recorded in each recharged token node in the recharged token node linked list after power selling; decrypts the cumulative recharged token quantity recorded by the game machine using the public key of the game machine to obtain the cumulative recharged token quantity of the current round of power selling; and compares the cumulative recharged token node quantity of the current round of power selling with the cumulative recharged token quantity of the current round of power selling. The power selling system verifies each of the recharged token nodes in the recharged token node linked list after power selling; the verification includes: verifying whether the encrypted corresponding uncharged token node check value recorded in the recharged token node is consistent with the check value calculated according to the corresponding uncharged token node in the uncharged token node linked list generated by itself.
4. The non-symmetric encryption based off-line electricity vending method for electricity meter as claimed in claim 2 or 3, wherein, The power selling verification further includes: The power selling system calculates and displays the corresponding electricity purchase amount according to the cumulative recharged token node quantity of the current round of power selling.
5. The non-symmetrical encryption-based electricity meter off-line electricity selling method according to claim 2 or 3, characterized by, Further includes: If the power selling verification passes, the power selling system notifies the game machine to initialize and destroys all data of the current power selling.
6. The non-symmetrical encryption based off-line electricity vending method for electricity meter as claimed in claim 1, wherein, Further includes: The target meter receives the recharged token through manual input or Bluetooth communication or radio frequency communication and performs recharging of the corresponding quantity.
7. The non-symmetrical encryption based off-line electricity vending method for electricity meter as claimed in claim 1, wherein, The power selling system generates an uncharged token linked list connected by two or more uncharged token nodes, including: The power selling system generates two or more recharged tokens for each meter; The uncharged token nodes corresponding to each recharged token are sequentially generated, and an uncharged token linked list sequentially connected by each uncharged token node is obtained.
8. The non-symmetrical encryption based off-line electricity vending method for electricity meter as claimed in claim 1, wherein, The power selling system generates an uncharged token linked list connected by two or more uncharged token nodes, including: The power selling system generates two or more quantitative recharged tokens for the corresponding meter according to the potential electricity purchasing users and their potential electricity purchasing quantity predicted based on the historical electricity consumption data of the users; The uncharged token nodes corresponding to each recharged token are sequentially generated, and an uncharged token linked list sequentially connected by each uncharged token node is obtained.
9. An electricity meter off-line electricity selling system based on asymmetric encryption, characterized by, The power selling system, the game machine and the meter are included; the power selling system and the game machine are connected through wired and / or wireless communication; The electricity selling system is configured to implement the steps performed by the electricity selling system in the electricity meter offline electricity selling method based on asymmetric encryption according to any one of claims 1 to 8. The palm computer is configured to implement the steps performed by the palm computer in the electricity meter offline electricity selling method based on asymmetric encryption according to any one of claims 1 to 8.
10. The off-line electricity vending system for electricity meters based on asymmetric cryptography as claimed in claim 9, wherein, The electricity meter and the palm computer are connected through Bluetooth or radio frequency communication.
Citation Information
Patent Citations
Method and device for charging prepayment electricity meters
CN106157439A
A method and system for selling electricity of a distributed smart meter
CN109272384A