Data transmission method and system

By introducing counters and encryption verification code mechanisms between the server and the gas meter equipment, the problem of gas meter equipment being subject to replay attacks is solved, and the security guarantee for gas business operations is achieved.

CN119922003AActive Publication Date: 2025-05-02BEIJING YAHUA WULIAN TECH DEV CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202510109147.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-23
Publication Date
2025-05-02
Estimated Expiration
2045-01-23

AI Technical Summary

Technical Problem

The prior art lacks effective means to resist replay attacks from gas meter equipment, resulting in adverse impact on gas business operations.

Method used

By introducing a counter mechanism between the server and the gas meter device, the server updates the counter value after receiving the request, and verifies the legitimacy of the operation through the encryption and verification code mechanism, so as to perform the target operation when the gas meter device receives the legitimate count value and ciphertext.

Benefits of technology

It effectively resists the playback attacks of gas meter equipment and ensures the safety and stability of gas business operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119922003A_ABST
    Figure CN119922003A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and discloses a data transmission method and system, and the method comprises the steps: a server updates a count value of a first counter on the server to a first count value; sending the first count value, the ciphertext and the first check code to the gas meter equipment; when the received count value is not greater than the current count value of a second counter on the gas meter equipment, the gas meter equipment determines that the target operation fails to be executed; when the received count value is greater than the current count value, determining a second check code according to the count value and the ciphertext received by the gas meter equipment; when the first check code is different from the second check code, it is determined that execution of the target operation fails; when the first check code is the same as the second check code, executing the target operation according to the parameter, after the target operation is executed, determining that the target operation is executed successfully, and updating the count value of the second counter to the first count value; and sending the feedback information to the server.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a data transmission method and system. Background Art

[0002] In the operation of gas services, gas meter devices often need to perform some operations such as recharge operations, fee deduction operations, etc. Illegal attackers may perform replay attacks on gas meter devices related to corresponding operations.

[0003] Currently, there is a lack of means to resist replay attacks on gas meter equipment related to corresponding operations. Once a gas meter device is attacked by a replay attack, it will have an adverse impact on the operation of the gas business. How to resist replay attacks on gas meter equipment has become a problem that needs to be solved. Summary of the invention

[0004] In view of this, an embodiment of the present disclosure provides a data transmission method and system.

[0005] In a first aspect, an embodiment of the present disclosure provides a data transmission method, the method comprising:

[0006] The service end receives a request indicating that the gas meter device needs to perform a target operation, and updates a count value of a first counter on the service end corresponding to the gas meter device and the target operation type of the target operation from a current count value of the first counter to a first count value, wherein the first count value is greater than the current count value;

[0007] The server encrypts the parameters of the target operation to obtain the ciphertext of the parameters;

[0008] The server determines a first verification code according to the first count value and the ciphertext;

[0009] The service end sends the first count value, the ciphertext, and the first check code to the gas meter device;

[0010] The gas meter device determines that the target operation fails to be executed when the received count value is not greater than the current count value of the second counter corresponding to the target operation type on the gas meter device;

[0011] When the count value received by the gas meter device is greater than the current count value of the second counter, the gas meter device determines a second check code according to the count value received by the gas meter device and the ciphertext;

[0012] When the first verification code and the second verification code are different, the gas meter device determines that the target operation execution fails;

[0013] The gas meter device decrypts the ciphertext to obtain the parameter when the first check code is the same as the second check code, performs the target operation according to the parameter, and after the target operation is completed, determines that the target operation is successfully executed, and updates the count value of the second counter from the current count value of the second counter to the first count value;

[0014] The gas meter device sends feedback information to the service end indicating that the gas meter device determines that the target operation is successfully executed or that the target operation fails to be executed.

[0015] In a possible implementation, after the gas meter device sends the feedback information to the service end, the method further includes:

[0016] When the gas meter device determines that the target operation is successfully performed, the gas meter device updates the count value of the second counter from the first count value to a second count value greater than the first count value;

[0017] The gas meter device encrypts the response parameter of the target operation to obtain the ciphertext of the response parameter of the target operation;

[0018] The gas meter device determines a third check code according to the second count value and the ciphertext of the response parameter of the target operation;

[0019] The gas meter device sends the second count value, the ciphertext of the response parameter of the target operation, and the third check code to the server;

[0020] When the received count value corresponding to the gas meter device is not greater than the current count value of the first counter, the server determines that the target operation fails to be executed;

[0021] When the count value corresponding to the gas meter device received by the server is greater than the current count value of the first counter, the server determines a fourth check code according to the ciphertext of the count value corresponding to the gas meter device and the response parameter of the target operation received by the server;

[0022] When the third verification code is different from the fourth verification code, the server determines that the target operation has failed to execute;

[0023] When the third verification code is the same as the fourth verification code, the server determines that the target operation is executed successfully, updates the count value of the first counter to the second count value, and updates information corresponding to the target operation type according to the response parameter of the target operation.

[0024] In a possible implementation, determining a first check code according to the first count value and the ciphertext includes:

[0025] Determine a first check code using a key corresponding to the target operation type and according to the first count value and a ciphertext of a parameter of the target operation; and

[0026] Determining the second check code according to the count value received by the gas meter device and the ciphertext includes:

[0027] The second verification code is determined by using a key corresponding to the target operation type and according to the count value received by the gas meter device and the ciphertext of the parameters of the target operation.

[0028] In a possible implementation, determining the third verification code according to the second count value and the ciphertext of the response parameter of the target operation includes:

[0029] Determine a third verification code using a key corresponding to the target operation type and according to the second count value and the ciphertext of the response parameter of the target operation; and

[0030] Determining the fourth check code according to the ciphertext of the count value of the gas meter device and the response parameter of the target operation received by the server includes:

[0031] The fourth check code is determined by using the key corresponding to the target operation type and according to the received ciphertext of the count value corresponding to the gas meter device and the response parameter of the target operation.

[0032] In a possible implementation, the target operation is one of the following: a recharge operation and a deduction operation.

[0033] In a second aspect, an embodiment of the present disclosure provides a data transmission system, the data transmission system comprising: a service end, a gas meter device;

[0034] A service end, for receiving a request indicating that a gas meter device needs to perform a target operation, updating a count value of a first counter corresponding to the gas meter device and a target operation type of the target operation on the service end from a current count value of the first counter to a first count value, wherein the first count value is greater than the current count value; encrypting a parameter of the target operation to obtain a ciphertext of the parameter; determining a first check code according to the first count value and the ciphertext; and sending the first count value, the ciphertext, and the first check code to the gas meter device;

[0035] A gas meter device, used for determining that a target operation fails to be executed when a received count value is not greater than a current count value of a second counter corresponding to a target operation type on the gas meter device; determining a second check code based on the count value received by the gas meter device and the ciphertext when the received count value is greater than the current count value of the second counter; determining that the target operation fails to be executed when the first check code is different from the second check code; decrypting the ciphertext to obtain the parameters when the first check code is the same as the second check code, executing the target operation according to the parameters, and determining that the target operation is successfully executed after the target operation is completed, and updating the count value of the second counter from the current count value of the second counter to the first count value; and sending feedback information to a service end indicating that the gas meter device determines that the target operation is successfully executed or the target operation fails to be executed.

[0036] In a possible implementation, the gas meter device is also used to update the count value of the second counter from the first count value to a second count value greater than the first count value when the gas meter device determines that the target operation is successfully executed after the gas meter device sends the feedback information to the server; encrypt the response parameters of the target operation to obtain the ciphertext of the response parameters of the target operation; determine the third verification code based on the second count value and the ciphertext of the response parameters of the target operation; send the second count value, the ciphertext of the response parameters of the target operation, and the third verification code to the server; the server is also used to receive the count value corresponding to the gas meter device When the third check code is not greater than the current count value of the first counter, it is determined that the target operation has failed to execute; when the received count value corresponding to the gas meter device is greater than the current count value of the first counter, the fourth check code is determined according to the count value corresponding to the gas meter device and the ciphertext of the response parameter of the target operation received by the server; when the third check code is different from the fourth check code, it is determined that the target operation has failed to execute; when the third check code is the same as the fourth check code, it is determined that the target operation has been successfully executed, and the count value of the first counter is updated to the second count value, and according to the response parameter of the target operation, the information corresponding to the target operation type is updated.

[0037] In one possible implementation, the server is also used to determine the first verification code based on the first count value and the ciphertext of the parameters of the target operation by using the key corresponding to the target operation type; the gas meter device is also used to determine the second verification code based on the count value and the ciphertext of the parameters of the target operation received by the gas meter device by using the key corresponding to the target operation type.

[0038] In one possible implementation, the gas meter device is also used to determine the third verification code based on the second count value and the ciphertext of the response parameters of the target operation by using the key corresponding to the target operation type; the server is also used to determine the fourth verification code based on the received ciphertext of the count value and the response parameters of the target operation by using the key corresponding to the target operation type.

[0039] The data transmission method provided in the embodiment of the present disclosure takes into account that if the attacker performs a replay attack on the gas meter device related to the corresponding operation, the information including the same count value before the current moment will be repeatedly sent. The update of the count value of the counter in the data transmission method provided in the embodiment of the present disclosure can make it so that under normal circumstances, the count value received by the gas meter device before the current moment will not be greater than the current count value of the counter on the gas meter device. In the case where the attacker performs a replay attack on the gas meter device related to the corresponding operation, the gas meter device can determine that a replay attack has occurred based on the count value of the counter being no greater than the current count value of the corresponding counter on the gas meter device, and will not perform the corresponding operation. This resists replay attacks and improves the safety of gas operations. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the specific embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0041] Figure 1 is a structural diagram of a data transmission system provided by an embodiment of the present disclosure;

[0042] Figure 2 is a flowchart of a data transmission method provided by an embodiment of the present disclosure;

[0043] Figure 3 It is a flowchart of an example of a gas meter device determining whether a target operation is successfully executed or a target operation is failed to execute;

[0044] Figure 4 It is a flowchart of an example of a server determining whether a target operation is successfully executed or whether the target operation fails to execute. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.

[0046] refer to Figure 1 , which shows a schematic diagram of the structure of the data transmission system provided by an embodiment of the present disclosure.

[0047] Gas meter equipment can also be called remote gas meter equipment. Figure 1 Gas meter devices such as gas meter device 1 and gas meter device 2 are shown. The gas meter devices are connected to the service end through wireless communication methods such as LTE and 5G communication.

[0048] Gas meter device 1 stores keys corresponding to the recharge operation type, namely the recharge key, and keys corresponding to the deduction operation type, namely the deduction key, etc. Gas meter device 2 stores keys corresponding to the recharge operation type, namely the recharge key, and keys corresponding to the deduction operation type, namely the deduction key, etc.

[0049] The gas meter device 1 has a counter corresponding to the charging operation type and a counter corresponding to the fee deduction operation type. The gas meter device 2 has a counter corresponding to the charging operation type and a counter corresponding to the fee deduction operation type.

[0050] The service end may include one or more servers. The service end stores a key corresponding to the recharge operation type, namely, a recharge key, a key corresponding to the deduction operation type, namely, a deduction key, etc. The service end has a counter corresponding to the gas meter device 1 and the recharge operation type, and a counter corresponding to the gas meter device 1 and the deduction operation type. The service end has a counter corresponding to the gas meter device 2 and the recharge operation type, and a counter corresponding to the gas meter device 2 and the deduction operation type.

[0051] It should be noted that the counter corresponding to the recharge operation type on the gas meter device and the counter corresponding to the recharge operation type on the service end both have the same initial count value, for example, 1. The initial value is the count value of the counter corresponding to the recharge operation type before the data transmission method provided by the embodiment of the present disclosure is first executed. The counter corresponding to the deduction operation type on the gas meter device and the counter corresponding to the deduction operation type on the service end both have the same initial count value, for example, 1.

[0052] refer to Figure 2 , which shows a flow chart of the data transmission method provided by an embodiment of the present disclosure.

[0053] It should be noted that, in the embodiment of the present disclosure, the current count value of the corresponding counter does not specifically refer to the count value of the corresponding counter at a certain moment, and the current count value of the corresponding counter refers to the step at which the current count value of the corresponding counter appears.

[0054] In step S201, the service end receives a request indicating that the gas meter device needs to perform a target operation, and updates the count value of a first counter corresponding to the gas meter device and the target operation type of the target operation on the service end to a first count value.

[0055] In the embodiment of the present disclosure, the operation type of the target operation is called the target operation type of the target operation.

[0056] The target operation may be any operation that the gas meter device can perform.

[0057] As an example, the target operation is a recharge operation or a deduction operation. The first counter on the service end corresponding to the target operation type of the gas meter device and the target operation is: the first counter on the service end corresponding to the gas meter device and the recharge operation type or the first counter on the service end corresponding to the gas meter device and the deduction operation type.

[0058] It should be noted that, for operation type i, the counter corresponding to operation type i on the gas meter device and the counter corresponding to operation type i on the server both have the same initial count value, for example, 1. The initial value is the count value of the counter corresponding to operation type i before the data transmission method provided by the embodiment of the present disclosure is executed for the first time.

[0059] The first count value may be: the current count value of the first counter corresponding to the gas meter device and the target operation type of the target operation on the service end + 1.

[0060] It should be noted that the current count value of the count value of the first counter of the target operation type corresponding to the gas meter device and the target operation in step S201 may refer to: the count value of the first counter of the target operation type corresponding to the gas meter device and the target operation on the server when step S201 starts to be executed.

[0061] In step S202, the server encrypts the parameters of the target operation using a key corresponding to the target operation type to obtain a ciphertext of the parameters of the target operation.

[0062] As an example, the target operation is a recharge operation, and the parameter of the target operation is a recharge value of the recharge operation. In step S202, the recharge value of the recharge operation is encrypted using a symmetric encryption algorithm according to a key corresponding to the recharge operation type to obtain a ciphertext of the recharge value of the recharge operation.

[0063] As another example, the target operation is a deduction operation, and the parameter of the target operation is the deduction amount of the deduction operation. In step S202, the deduction amount of the deduction operation is encrypted using a symmetric encryption algorithm according to a key corresponding to the deduction operation type to obtain a ciphertext of the deduction amount of the deduction operation.

[0064] In step S203, the server determines a first verification code according to the first count value and the ciphertext of the parameter of the target operation.

[0065] In a possible implementation, in step S203, the server determines the first verification code according to the first count value and the ciphertext of the parameter of the target operation, including: concatenating the first count value with the ciphertext of the parameter of the target operation to obtain a concatenation result of the first count value and the ciphertext of the parameter of the target operation. The concatenation result of the first count value and the ciphertext of the parameter of the target operation consists of the first count value and the ciphertext of the parameter of the target operation. The concatenation result of the first count value and the ciphertext of the parameter of the target operation is used as the first verification code.

[0066] In another possible implementation, in step S203, the server determines the first verification code according to the first count value and the ciphertext of the parameter of the target operation, including: concatenating the first count value with the ciphertext of the parameter of the target operation to obtain a concatenation result of the first count value and the ciphertext of the parameter of the target operation. Using a symmetric encryption algorithm, the concatenation result of the first count value and the ciphertext of the parameter of the target operation is encrypted according to a key corresponding to the target operation type to obtain the first verification code.

[0067] In step S204, the service end sends the first count value, the ciphertext of the parameters of the target operation, and the first verification code to the gas meter device.

[0068] In step S204, the service end may send a command including a first count value, a ciphertext of a parameter of a target operation, and a first verification code to the gas meter device.

[0069] As an example, the target operation is a recharge operation. In step S204, the server sends a recharge command including a first count value, a ciphertext of parameters of the recharge operation, and a first verification code to the gas meter device.

[0070] As another example, the target operation is a deduction operation. In step S204, the service end sends a deduction command including a first count value, a ciphertext of parameters of the deduction operation, and a first verification code to the gas meter device.

[0071] In step S205, when the gas meter device determines that the count value received by the gas meter device is not greater than the current count value of the second counter corresponding to the target operation type on the gas meter device, the gas meter device determines that the target operation has failed to be executed.

[0072] It should be noted that the current count value of the second counter corresponding to the target operation type in step S205 may refer to: the count value of the second counter corresponding to the target operation type at the moment when the gas meter device receives the count value received by the gas meter device.

[0073] If the gas meter device determines that the received count value is not greater than the current count value of the second counter corresponding to the target operation type on the gas meter device, then in step S205, the gas meter device may determine that a replay attack has occurred. The gas meter device determines that the target operation has failed to execute when the gas meter device determines that the received count value is not greater than the current count value of the second counter corresponding to the target operation type on the gas meter device.

[0074] In step S206, when the gas meter device determines that the count value received by the gas meter device is greater than the current count value of the second counter corresponding to the target operation type on the gas meter device, the gas meter device determines the second verification code based on the count value received by the gas meter device and the ciphertext of the parameters of the target operation.

[0075] The current count value of the second counter corresponding to the target operation type in step S206 may refer to: the count value of the second counter corresponding to the target operation type at the moment when the gas meter device receives the count value received by the gas meter device.

[0076] It should be noted that if the count value received by the gas meter device is the first count value, then in step S206, the gas meter device may determine that the count value received by the gas meter device is greater than the current count value of the second counter corresponding to the target operation type on the gas meter device.

[0077] In a possible implementation, in step S206, according to the count value received by the gas meter device and the ciphertext of the parameter of the target operation, determining the second verification code includes: the gas meter device concatenates the count value received by the gas meter device with the ciphertext of the parameter of the target operation to obtain a concatenation result of the count value received by the gas meter device and the ciphertext of the parameter of the target operation. The concatenation result of the count value received by the gas meter device and the ciphertext of the parameter of the target operation is composed of the count value received by the gas meter device and the ciphertext of the parameter of the target operation. The concatenation result of the count value received by the gas meter device and the ciphertext of the parameter of the target operation is used as the second verification code.

[0078] In another possible implementation, in step S206, determining the second verification code according to the count value received by the gas meter device and the ciphertext of the parameter of the target operation includes: the gas meter device concatenates the count value received by the gas meter device with the ciphertext of the parameter of the target operation to obtain the concatenation result of the count value received by the gas meter device and the ciphertext of the parameter of the target operation. Using a symmetric encryption algorithm, the concatenation result of the count value received by the gas meter device and the ciphertext of the parameter of the target operation is encrypted according to a key corresponding to the target operation type to obtain the second verification code.

[0079] In step S207, when the gas meter device determines that the first verification code is different from the second verification code, the gas meter device determines that the target operation fails to be executed.

[0080] In step S208, when the gas meter device determines that the first verification code is the same as the second verification code, the gas meter device decrypts the ciphertext of the parameters of the target operation to obtain the ciphertext of the parameters of the target operation, and performs the target operation according to the ciphertext of the parameters of the target operation. After the target operation is completed, the gas meter device determines that the target operation is successfully executed, and updates the count value of the second counter corresponding to the target operation type on the gas meter device from the current count value of the second counter to the first count value.

[0081] It should be noted that if the count value received by the gas meter device is the first count value, the first check code is the same as the second check code. The first count value is greater than the current count value of the second counter.

[0082] In step S209, the gas meter device sends feedback information to the service end indicating that the gas meter device determines that the target operation is executed successfully or fails to execute the target operation.

[0083] If the gas meter device determines that the target operation is executed successfully, the gas meter device sends feedback information indicating that the gas meter device determines that the target operation is executed successfully to the service end. If the gas meter device determines that the target operation is executed unsuccessfully, the gas meter device sends feedback information indicating that the gas meter device determines that the target operation is executed unsuccessfully to the service end.

[0084] In a possible implementation, after the gas meter device sends feedback information indicating that the gas meter device determines that the target operation is successfully executed or the target operation is failed to be executed to the service end, it also includes: step S210-step S217.

[0085] In step S210, when the gas meter device determines that the target operation is successfully performed, the gas meter device updates a second counter corresponding to the target operation type on the gas meter device from a first count value to a second count value greater than the first count value.

[0086] The second count value may be: the first count value+1.

[0087] In step S211, the gas meter device encrypts the response parameter of the target operation using the key corresponding to the target operation type to obtain the ciphertext of the response parameter of the target operation.

[0088] The response parameter of the target operation may be: a value corresponding to the target operation type stored by the gas meter device after the target operation is completed.

[0089] As an example, the target operation is a recharge operation, and the parameter of the target operation is a recharge value. The recharge value is the recharge amount or the recharged cubic meters. The response parameter of the target operation is: the value corresponding to the recharge operation type stored by the gas meter device after the recharge operation is completed, and the value corresponding to the recharge operation type is the remaining amount or the remaining cubic meter count stored by the gas meter device. The remaining amount can indicate how much gas is available for the user of the gas meter device. The remaining cubic meter count can indicate how many cubic meters of gas is available for the user of the gas meter device. The value corresponding to the recharge operation type stored by the gas meter device after the recharge operation is performed is: the sum of the value corresponding to the recharge operation type stored by the gas meter device at the moment of starting the recharge operation and the recharge value.

[0090] As another example, the target operation is a deduction operation, and the parameter of the target operation is a deduction value. The deduction value is the deduction amount or the cubic meter of the deduction. The response parameter of the deduction operation is: the value corresponding to the deduction operation stored by the gas meter device after the deduction operation is completed, and the value corresponding to the deduction operation is the remaining amount or the remaining cubic meter count stored by the gas meter device. After the deduction operation is performed, the value corresponding to the deduction operation stored by the gas meter device is: the value stored by the gas meter device at the time of starting to execute the deduction operation minus the deduction value.

[0091] In step S212, the gas meter device determines a third check code according to the second count value and the ciphertext of the response parameter of the target operation.

[0092] In a possible implementation, in step S212, the gas meter device determines the third verification code according to the second count value and the ciphertext of the response parameter of the target operation, including: splicing the second count value with the ciphertext of the response parameter of the target operation to obtain a splicing result of the second count value and the ciphertext of the response parameter of the target operation. The splicing result of the second count value and the ciphertext of the response parameter of the target operation consists of the second count value and the ciphertext of the response parameter of the target operation. The splicing result of the second count value and the ciphertext of the response parameter of the target operation is used as the third verification code.

[0093] In another possible implementation, in step S212, the gas meter device determines the third verification code according to the second count value and the ciphertext of the response parameter of the target operation, including: concatenating the second count value with the ciphertext of the response parameter of the target operation to obtain a concatenation result of the second count value and the ciphertext of the response parameter of the target operation. Using a symmetric encryption algorithm, according to a key corresponding to the target operation type, the concatenation result of the second count value and the ciphertext of the response parameter of the target operation is encrypted to obtain the third verification code.

[0094] In step S213, the gas meter device sends the second count value, the ciphertext of the response parameter of the target operation, and the third verification code to the service end.

[0095] In step S214, when the server determines that the count value corresponding to the gas meter device received by the server is not greater than the current count value of the first counter corresponding to the gas meter device and the target operation type on the server, the server determines that the target operation fails to be executed.

[0096] It should be noted that the current count value of the first counter corresponding to the gas meter device and the target operation type in step S214 may refer to: the count value of the first counter corresponding to the gas meter device and the target operation type at the moment of receiving the count value corresponding to the gas meter device. The current count value of the first counter corresponding to the gas meter device and the target operation type in step S214 is actually: the first count value.

[0097] In step S215, when the server determines that the count value corresponding to the gas meter device received by the server is greater than the current count value of the first counter corresponding to the gas meter device and the target operation type on the server, the server determines the fourth verification code based on the ciphertext of the count value corresponding to the gas meter device and the response parameters of the target operation received by the server.

[0098] It should be noted that the current count value of the first counter corresponding to the gas meter device and the target operation type in step S215 is actually: the first count value.

[0099] In step S215, if the count value corresponding to the gas meter device received by the server is the second count value, the server can determine that the count value corresponding to the gas meter device received by the server is greater than the current count value of the first counter corresponding to the gas meter device and the target operation type on the server, that is, the first count value.

[0100] In a possible implementation, in step S215, according to the ciphertext of the count value of the gas meter device and the response parameter of the target operation received by the service end, determining the fourth verification code includes: splicing the ciphertext of the count value of the gas meter device and the response parameter of the target operation received by the service end, and obtaining the splicing result of the ciphertext of the count value of the gas meter device and the response parameter of the target operation received by the service end. The splicing result of the ciphertext of the count value of the gas meter device and the response parameter of the target operation received by the service end is composed of the ciphertext of the count value of the gas meter device and the response parameter of the target operation received by the service end. The splicing result of the ciphertext of the count value of the gas meter device and the response parameter of the target operation received by the service end is used as the fourth verification code.

[0101] In another possible implementation, in step S215, according to the ciphertext of the count value of the gas meter device and the response parameter of the target operation received by the server, determining the fourth verification code includes: splicing the ciphertext of the count value of the gas meter device and the response parameter of the target operation received by the server to obtain the splicing result of the ciphertext of the count value of the gas meter device and the response parameter of the target operation received by the server. Using a symmetric encryption algorithm, according to a key corresponding to the target operation type, the splicing result of the ciphertext of the count value of the gas meter device and the response parameter of the target operation received by the server is encrypted to obtain the fourth verification code.

[0102] In step S216, when the server determines that the third verification code is different from the fourth verification code, the server determines that the target operation fails to be executed.

[0103] In step S217, when the server determines that the third verification code is the same as the fourth verification code, the server determines that the target operation is executed successfully, and updates the count value of the first counter corresponding to the gas meter device and the target operation type on the server to the second count value, and updates the information corresponding to the target operation type according to the response parameters of the target operation.

[0104] Updating the count value of the first counter corresponding to the gas meter device and the target operation type on the service end to the second count value may specifically mean: updating the count value of the first counter corresponding to the gas meter device and the target operation type on the service end from the first count value to the second count value.

[0105] The information corresponding to the target operation type may be: information that needs to be updated when the operation of the target operation type is successfully executed. The information corresponding to the target operation type and the response parameter of the target operation may be information of the same type.

[0106] In step S217, information corresponding to the target operation type may be updated as a response parameter of the target operation.

[0107] As an example, the target operation is a recharge operation, and the parameter of the target operation is a recharge value. The recharge value is the recharge amount or the recharged cubic meter. The response parameter of the target operation is: the value corresponding to the recharge operation type stored by the gas meter device after the recharge operation is performed, and the value corresponding to the recharge operation type stored by the gas meter device is the remaining amount or the remaining cubic meter count stored by the gas meter device. The information corresponding to the recharge operation type is: the value corresponding to the recharge operation type stored by the service end. The remaining amount can indicate how much gas is available for the user of the gas meter device. The remaining cubic meter count can indicate how many cubic meters of gas is available for the user of the gas meter device. The value corresponding to the recharge operation type stored by the gas meter device after the recharge operation is: the sum of the value corresponding to the recharge operation type stored by the gas meter device at the time of starting the recharge operation and the recharge value. In step S217, the value corresponding to the recharge operation type stored by the service end is updated to the response parameter of the target operation.

[0108] As another example, the target operation is a deduction operation, and the parameter of the target operation is a deduction value. The deduction value is the deduction amount or the cubic meter of the deduction. The deduction value is the deduction amount or the cubic meter of the deduction. The response parameter of the deduction operation is: the value corresponding to the deduction operation stored by the gas meter device after the deduction operation is performed, and the value corresponding to the deduction operation stored by the gas meter device is the remaining amount or the remaining cubic meter count stored by the gas meter device. The information corresponding to the deduction operation type is: the value corresponding to the deduction operation type stored by the service end. The value corresponding to the deduction operation stored by the gas meter device after the deduction operation is performed is: the value stored by the gas meter device at the time of starting the deduction operation minus the deduction value. In step S217, the value corresponding to the recharge operation type stored by the service end is updated to the response parameter of the target operation.

[0109] refer to Figure 3 , which shows a flowchart of an example of a gas meter device determining whether a target operation is successfully executed or a target operation is failed to execute.

[0110] In this example, the gas meter device is gas meter device A, the target operation is a recharge operation, and the key corresponding to the recharge operation type is called a recharge key.

[0111] The server adds 1 to the current count value of the first counter pCNT corresponding to the gas meter device A and the recharging operation type on the server to obtain a first count value pCNTnew.

[0112] The server uses the recharge key to encrypt the recharge parameter, i.e., the recharge parameter, to obtain the ciphertext of the recharge parameter, i.e., ENC1.

[0113] The server uses the recharge key to obtain the first verification code, namely MAC1, according to the concatenation result of the first count value and the ciphertext of the recharge parameter, namely pCNTnew+ENC1.

[0114] The server sends a recharge command including pCNTnew1, ENC1, and MAC1 to gas meter device A.

[0115] When the gas meter device A determines that the received count value is not greater than the current count value of the second counter dCNT corresponding to the recharge operation type on the gas meter device A, the gas meter device A determines that the recharge operation has failed.

[0116] When the gas meter device A determines that the received count value is greater than the current count value of the dCNT on the gas meter device A, the gas meter device A uses the recharge key to determine the second check code MAC2 according to the concatenation result of the received count value and ENC1, that is, the received count value + ENC1. If the gas meter device A determines that MAC1 is the same as MAC2, the gas meter device A performs the recharge operation according to the recharge parameters. After the recharge operation is completed, the gas meter device A determines that the recharge operation is successfully executed. When the gas meter device A determines that the recharge operation is successfully executed, the gas meter device A updates the count value of the dCNT on the gas meter device A to the first count value, that is, pCNTnew. When the gas meter device A determines that the recharge operation is successfully executed, the gas meter device A returns feedback information to the service end indicating that the gas meter device A determines that the recharge operation is successfully executed.

[0117] It should be noted that if the count value received by the gas meter device A is PCNTnew, the gas meter device A determines that the received count value is greater than the current count value of dCNT on the gas meter device A.

[0118] When the gas meter device A determines that the received count value is not greater than the current count value of dCNT, the gas meter device A returns feedback information to the service end indicating that the gas meter device A determines that the recharging operation has failed.

[0119] refer to Figure 4 , which shows a flow chart of an example of a server determining whether a target operation is successfully executed or whether the target operation fails to execute.

[0120] In this example, the gas meter device is gas meter device A, and the target operation is a charging operation.

[0121] After the recharging operation of the gas meter device A is successfully performed, the gas meter device A adds the current count value of the dCNT on the gas meter device A, ie, pCNTnew+1, to obtain a second count value, ie, dCNTnew.

[0122] The gas meter device A uses the recharge key to encrypt the response parameter of the recharge operation, that is, the recharge response parameter, to obtain the ciphertext ENC2 of the response parameter of the recharge operation.

[0123] The gas meter device A uses the recharge key to determine the third check code MAC3 according to the concatenation result of the second count value and the ciphertext of the response parameter of the recharge operation, that is, dCNTnew+ENC2.

[0124] Gas meter device A sends dCNTnew, ENC2, and MAC3 to the server.

[0125] When the server determines that the count value corresponding to the gas meter device A received by the server is not greater than the current count value of pCNT, that is, pCNTnew, it determines that the recharge operation has failed.

[0126] When the server determines that the count value corresponding to the gas meter device A received by the server is greater than the current count value of pCNT on the server, i.e., pCNTnew, the server uses the recharge key to determine the fourth check code, i.e., MAC4, based on the ciphertext of the count value corresponding to the gas meter device A and the response parameters of the recharge operation received by the server.

[0127] It should be noted that if the count value corresponding to the gas meter device A received by the server is the second count value, namely dCNTnew, the server determines that the count value corresponding to the gas meter device A received by the server is greater than the current count value of pCNT on the server, namely pCNTnew.

[0128] When the server determines that MAC3 and MAC4 are different, it is determined that the recharge operation has failed.

[0129] When the server determines that MAC3 and MAC4 are the same, it determines that the recharge operation is successfully executed, and updates the count value of pCNT on the server to dCNTnew.

[0130] The embodiments of the present disclosure provide a data transmission system. The system is used to implement the above embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "unit" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0131] The data transmission system includes: service end, gas meter equipment;

[0132] A service end, for receiving a request indicating that a gas meter device needs to perform a target operation, updating a count value of a first counter corresponding to the gas meter device and a target operation type of the target operation on the service end from a current count value of the first counter to a first count value, wherein the first count value is greater than the current count value; encrypting a parameter of the target operation to obtain a ciphertext of the parameter; determining a first check code according to the first count value and the ciphertext; and sending the first count value, the ciphertext, and the first check code to the gas meter device;

[0133] A gas meter device, used for determining that a target operation fails to be executed when a received count value is not greater than a current count value of a second counter corresponding to a target operation type on the gas meter device; determining a second check code based on the count value received by the gas meter device and the ciphertext when the received count value is greater than the current count value of the second counter; determining that the target operation fails to be executed when the first check code is different from the second check code; decrypting the ciphertext to obtain the parameters when the first check code is the same as the second check code, executing the target operation according to the parameters, and determining that the target operation is successfully executed after the target operation is completed, and updating the count value of the second counter from the current count value of the second counter to the first count value; and sending feedback information to a service end indicating that the gas meter device determines that the target operation is successfully executed or the target operation fails to be executed.

[0134] In a possible implementation, the gas meter device is also used to update the count value of the second counter from the first count value to a second count value greater than the first count value when the gas meter device determines that the target operation is successfully executed after the gas meter device sends the feedback information to the server; encrypt the response parameters of the target operation to obtain the ciphertext of the response parameters of the target operation; determine the third verification code based on the second count value and the ciphertext of the response parameters of the target operation; send the second count value, the ciphertext of the response parameters of the target operation, and the third verification code to the server; the server is also used to receive the count value corresponding to the gas meter device When the third check code is not greater than the current count value of the first counter, it is determined that the target operation has failed to execute; when the received count value corresponding to the gas meter device is greater than the current count value of the first counter, the fourth check code is determined according to the count value corresponding to the gas meter device and the ciphertext of the response parameter of the target operation received by the server; when the third check code is different from the fourth check code, it is determined that the target operation has failed to execute; when the third check code is the same as the fourth check code, it is determined that the target operation has been successfully executed, and the count value of the first counter is updated to the second count value, and according to the response parameter of the target operation, the information corresponding to the target operation type is updated.

[0135] In one possible implementation, the server is also used to determine the first verification code based on the first count value and the ciphertext of the parameters of the target operation by using the key corresponding to the target operation type; the gas meter device is also used to determine the second verification code based on the count value and the ciphertext of the parameters of the target operation received by the gas meter device by using the key corresponding to the target operation type.

[0136] In one possible implementation, the gas meter device is also used to determine the third verification code based on the second count value and the ciphertext of the response parameters of the target operation by using the key corresponding to the target operation type; the server is also used to determine the fourth verification code based on the received ciphertext of the count value and the response parameters of the target operation by using the key corresponding to the target operation type.

[0137] Although the embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A data transmission method, characterized in that: The method comprises: The service end receives a request indicating that the gas meter device needs to perform a target operation, and updates a count value of a first counter on the service end corresponding to the gas meter device and the target operation type of the target operation from a current count value of the first counter to a first count value, wherein the first count value is greater than the current count value; The server encrypts the parameters of the target operation to obtain the ciphertext of the parameters; The server determines a first verification code according to the first count value and the ciphertext; The service end sends the first count value, the ciphertext, and the first check code to the gas meter device; The gas meter device determines that the target operation fails to be executed when the received count value is not greater than the current count value of the second counter corresponding to the target operation type on the gas meter device; When the count value received by the gas meter device is greater than the current count value of the second counter, the gas meter device determines a second check code according to the count value received by the gas meter device and the ciphertext; When the first verification code and the second verification code are different, the gas meter device determines that the target operation execution fails; The gas meter device decrypts the ciphertext to obtain the parameter when the first check code is the same as the second check code, performs the target operation according to the parameter, and after the target operation is completed, determines that the target operation is successfully executed, and updates the count value of the second counter from the current count value of the second counter to the first count value; The gas meter device sends feedback information to the service end indicating that the gas meter device determines that the target operation is successfully executed or that the target operation fails to be executed.

2. The method according to claim 1, characterized in that After the gas meter device sends the feedback information to the service end, the method further includes: When the gas meter device determines that the target operation is successfully performed, the gas meter device updates the count value of the second counter from the first count value to a second count value greater than the first count value; The gas meter device encrypts the response parameter of the target operation to obtain the ciphertext of the response parameter of the target operation; The gas meter device determines a third check code according to the second count value and the ciphertext of the response parameter of the target operation; The gas meter device sends the second count value, the ciphertext of the response parameter of the target operation, and the third check code to the server; When the received count value corresponding to the gas meter device is not greater than the current count value of the first counter, the server determines that the target operation fails to be executed; When the count value corresponding to the gas meter device received by the server is greater than the current count value of the first counter, the server determines a fourth check code according to the ciphertext of the count value corresponding to the gas meter device and the response parameter of the target operation received by the server; When the third verification code is different from the fourth verification code, the server determines that the target operation has failed to execute; When the third verification code is the same as the fourth verification code, the server determines that the target operation is executed successfully, updates the count value of the first counter to the second count value, and updates information corresponding to the target operation type according to the response parameter of the target operation.

3. The method according to claim 1, characterized in that The determining a first check code according to the first count value and the ciphertext includes: Determine a first verification code according to the first count value and the ciphertext of the parameters of the target operation using a key corresponding to the target operation type; and Determining the second check code according to the count value received by the gas meter device and the ciphertext includes: The second verification code is determined by using a key corresponding to the target operation type and according to the count value received by the gas meter device and the ciphertext of the parameters of the target operation.

4. The method according to claim 2, characterized in that: The determining the third verification code according to the second count value and the ciphertext of the response parameter of the target operation includes: Determine a third verification code using a key corresponding to the target operation type and according to the second count value and the ciphertext of the response parameter of the target operation; and The determining of the fourth check code according to the ciphertext of the count value of the gas meter device and the response parameter of the target operation received by the service end comprises: The fourth check code is determined by using the key corresponding to the target operation type and according to the ciphertext of the count value of the gas meter device and the response parameter of the target operation received by the service end.

5. The method according to any one of claims 1 to 4, characterized in that The target operation is one of the following: recharge operation, deduction operation.

6. A data transmission system, characterized in that: The system comprises: a service end and a gas meter device; A service end, for receiving a request indicating that a gas meter device needs to perform a target operation, updating a count value of a first counter corresponding to the gas meter device and a target operation type of the target operation on the service end from a current count value of the first counter to a first count value, wherein the first count value is greater than the current count value; encrypting a parameter of the target operation to obtain a ciphertext of the parameter; determining a first check code according to the first count value and the ciphertext; and sending the first count value, the ciphertext, and the first check code to the gas meter device; A gas meter device, used for determining that a target operation fails to be executed when a received count value is not greater than a current count value of a second counter corresponding to a target operation type on the gas meter device; determining a second check code based on the count value received by the gas meter device and the ciphertext when the received count value is greater than the current count value; determining that the target operation fails to be executed when the first check code is different from the second check code; decrypting the ciphertext to obtain the parameters when the first check code is the same as the second check code, executing the target operation according to the parameters, and determining that the target operation is successfully executed after the target operation is completed, and updating the count value of the second counter from the current count value of the second counter to the first count value; and sending feedback information to a service end indicating that the gas meter device determines that the target operation is successfully executed or the target operation fails to be executed.

7. The system according to claim 6, characterized in that The gas meter device is further configured to update the count value of the second counter from the first count value to a second count value greater than the first count value when the gas meter device determines that the target operation is successfully executed after the gas meter device sends the feedback information to the service end; Encrypting the response parameters of the target operation to obtain the ciphertext of the response parameters of the target operation; Determine a third check code according to the second count value and the ciphertext of the response parameter of the target operation; Sending a second count value, a ciphertext of a response parameter of the target operation, and a third check code to the server; the server is further configured to determine that the target operation has failed to execute when the received count value corresponding to the gas meter device is not greater than the current count value of the first counter; and determining a fourth check code based on the count value corresponding to the gas meter device and the ciphertext of the response parameter of the target operation received by the server when the received count value corresponding to the gas meter device is greater than the current count value of the first counter; When the third verification code is different from the fourth verification code, determining that the target operation fails to be executed; When the third verification code is the same as the fourth verification code, it is determined that the target operation is successfully executed, and the count value of the first counter is updated to the second count value, and information corresponding to the target operation type is updated according to a response parameter of the target operation.

8. The system according to claim 6, characterized in that The server is also used to use the key corresponding to the target operation type to determine the first verification code based on the first count value and the ciphertext of the parameters of the target operation; the gas meter device is also used to use the key corresponding to the target operation type to determine the second verification code based on the count value and the ciphertext of the parameters of the target operation received by the gas meter device.

9. The system according to claim 7, characterized in that The gas meter device is also used to use the key corresponding to the target operation type to determine the third verification code based on the second count value and the ciphertext of the response parameters of the target operation; the server is also used to use the key corresponding to the target operation type to determine the fourth verification code based on the received ciphertext of the count value corresponding to the gas meter device and the response parameters of the target operation.

10. The system according to any one of claims 6 to 9, characterized in that: The target operation is one of the following: recharge operation, deduction operation.

Citation Information

Patent Citations

  • Replay attack identification method, system and device and readable storage medium

    CN113098880A

  • Method and device for determining attack message and equipment

    CN114040387A

  • Data transmission method and related device

    CN114884622A

  • Data protection method and system based on symmetric keys

    CN116015830A

  • Sending and receiving methods and devices, unmanned equipment and storage medium

    CN116506061A