Data tamper-proofing method and device, equipment, storage medium and program product

By using the signature verification mechanism in interface call requests and responses, the problem that traditional interface request data is easily tampered with is solved, and the secure transmission and integrity of data are achieved.

CN118944893AInactive Publication Date: 2024-11-12CHINA SOUTHERN POWER GRID INTERNET SERVICE CO LTD

Patent Information

Application Number
CN202411173549.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-26
Publication Date
2024-11-12
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Traditional interface request data is easily tampered with during transmission, resulting in serious security risks.

Method used

In interface call requests and responses, the integrity of the data is ensured by generating signatures and configuring them in the request header and response header so that the server and client can verify the request parameters and response parameters. The specific steps include the client generating a signature and configuring it on the request header, the server generating a verification signature and verifying the request header, and the client and the server encrypt and decrypt the response parameters to determine whether the data has been tampered with.

Benefits of technology

It effectively prevents tampering of request and response data during transmission, ensuring data integrity and security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118944893A_ABST
    Figure CN118944893A_ABST
Patent Text Reader

Abstract

The invention relates to a data tamper-proofing method and device, equipment, a storage medium and a program product. The method is applied to a client and comprises the following steps: acquiring a request parameter in a process of generating an interface calling request; generating a first signature according to the request parameter, configuring the first signature in a request header, and configuring the request parameter in a request body to obtain the interface calling request; the interface calling request is sent to a server side, the interface calling request is used for the server side to generate a first verification signature according to the request parameters in the request body, and verification processing is conducted on the first signature in the request header according to the first verification signature so as to determine whether the request parameters are tampered or not. By adopting the method, the data can be prevented from being tampered in the transmission process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of big data technology, and in particular to a data tamper-proofing method, device, equipment, storage medium and program product. Background Art

[0002] With the rapid development of information technology, the scale and complexity of network applications are constantly increasing. Under the current microservice technology architecture, traditional interface requests are mostly request-response mode. The client sends a request to the data interface of the server, and the server processes the interface request and responds to achieve data transmission and data exchange.

[0003] However, traditional interface request data is easily tampered with during transmission, and the response data returned based on the request data is also easily tampered with, resulting in serious security risks. Summary of the invention

[0004] Based on this, it is necessary to provide a data tamper-proof method, device, equipment, storage medium and program product that can prevent data from being tampered with during transmission in response to the above technical problems.

[0005] In a first aspect, the present application provides a data tamper-proof method, which is applied to a client, and the method comprises:

[0006] In the process of generating an interface call request, obtain request parameters;

[0007] Generate a first signature according to the request parameters, configure the first signature in the request header, and configure the request parameters in the request body to obtain an interface call request;

[0008] The interface call request is sent to the server, and the interface call request is used by the server to generate a first verification signature according to the request parameters in the request body, and verify the first signature in the request header according to the first verification signature to determine whether the request parameters have been tampered with.

[0009] In one embodiment, the request parameter includes a parameter name and a parameter value corresponding to the parameter name, and the step of generating the first signature according to the request parameter includes:

[0010] The parameter name and the parameter value are concatenated according to a preset concatenation format to obtain a concatenated parameter;

[0011] Generate a first signature according to the concatenation parameters.

[0012] In one embodiment, configuring the request parameters in the request body includes:

[0013] Encrypt the parameter value to obtain the encrypted request parameter;

[0014] Configure the encrypted request parameters and parameter names in the request body.

[0015] In one embodiment, the method further comprises:

[0016] Receive an interface call response to the interface call request sent by the server, where the interface call response is returned by the server after determining that the request parameters have not been tampered with, and the interface call response includes a response header and a response body, where the second signature is configured in the response header, and the response parameters are configured in the response body;

[0017] Generate a second verification signature according to the response parameter;

[0018] The second signature is verified according to the second verification signature to determine whether the response parameter has been tampered with.

[0019] In one embodiment, the response body includes an encrypted response parameter, which is obtained by the server encrypting the target response parameter corresponding to the parameter name, and the second verification signature is generated according to the response parameter, including:

[0020] Decrypting the encrypted response parameter to obtain a target response parameter, where the target response parameter includes multiple parameter fields;

[0021] A second verification signature is generated based on the plurality of parameter fields.

[0022] In a second aspect, the present application provides a data tamper-proof method, which is applied to a server, and the method includes:

[0023] Receive an interface call request sent by a client, the interface call request including a request header and a request body, the request header is configured with a first signature generated by the client according to the obtained request parameters, and the request body is configured with the request parameters;

[0024] Generate a first verification signature according to the request parameters;

[0025] The first signature is verified according to the first verification signature to determine whether the request parameters have been tampered with.

[0026] In one embodiment, the request body includes an encrypted request parameter and a parameter name, the encrypted request parameter is obtained by the client encrypting a parameter value corresponding to the parameter name, and the first verification signature is generated according to the request parameter, including:

[0027] Decrypt the encrypted request parameters to obtain parameter values;

[0028] Generate a first verification signature based on the parameter value and parameter name.

[0029] In one embodiment, the method further comprises:

[0030] If it is determined that the request parameters have not been tampered with, the response parameters corresponding to the parameter names are obtained;

[0031] Generate a second signature according to the response parameters, configure the second signature in the response header, and configure the response parameters in the response body to obtain an interface call response;

[0032] The interface call response is sent to the client, and the interface call response is used by the client to generate a second verification signature according to the response parameters in the interface call response, and verify the second signature according to the second verification signature to determine whether the response parameters have been tampered with.

[0033] In one embodiment, the generating of the second signature according to the response parameter includes:

[0034] Performing format conversion processing on the response parameter to obtain a target response parameter, the target response parameter includes multiple parameter fields;

[0035] A second signature is generated based on the plurality of parameter fields.

[0036] In one embodiment, configuring the response parameters in the response body includes:

[0037] Encrypting the target response parameter to obtain an encrypted response parameter;

[0038] Configure the encrypted response parameters in the response body.

[0039] In a third aspect, the present application further provides a data tamper-proof device, which is applied to a client, and the device includes:

[0040] The acquisition module is used to obtain request parameters in the process of generating an interface call request;

[0041] A configuration module, used to generate a first signature according to the request parameters, configure the first signature in the request header, and configure the request parameters in the request body to obtain an interface call request;

[0042] The sending module is used to send the interface call request to the server. The interface call request is used by the server to generate a first verification signature according to the request parameters in the request body, and verify the first signature in the request header according to the first verification signature to determine whether the request parameters have been tampered with.

[0043] In a fourth aspect, the present application further provides a data tamper-proof device, which is applied to a server, and the device includes:

[0044] A receiving module, used to receive an interface call request sent by a client, the interface call request including a request header and a request body, the request header is configured with a first signature generated by the client according to the obtained request parameters, and the request body is configured with the request parameters;

[0045] A generation module, used to generate a first verification signature according to the request parameters;

[0046] The verification module is used to verify the first signature according to the first verification signature to determine whether the request parameters have been tampered with.

[0047] In a fifth aspect, the present application further provides a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the method described in the first aspect or the second aspect are implemented.

[0048] In a sixth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method described in the first aspect or the second aspect above are implemented.

[0049] In a seventh aspect, the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the method described in the first aspect or the second aspect above.

[0050] The above-mentioned data tamper-proof method, device, equipment, storage medium and program product obtain request parameters in the process of generating an interface call request, generate a first signature according to the request parameters, configure the first signature in the request header, and configure the request parameters in the request body to obtain an interface call request, and send the interface call request to the server. The interface call request is used by the server to generate a first verification signature according to the request parameters in the request body, and verify the first signature in the request header according to the first verification signature to determine whether the request parameters have been tampered with. In this method, the client generates a first signature according to the request parameters, configures the first signature in the request header, and configures the request parameters in the request body. In this way, during the data transmission process, if the request parameters in the request body are tampered with, the first signature in the request header includes information about the request parameters before the tampering, and the first signature can be used to determine whether the request parameters in the request body have been tampered with. For the server, the server generates a first verification signature based on the request parameters in the request body, and verifies the first signature based on the first verification signature. For example, if the first verification signature is inconsistent with the first signature, it indicates that the request parameters obtained by the server are inconsistent with the request parameters sent by the client. It can be determined whether the request parameters have been tampered with. The present application can effectively prevent the request parameters from being tampered with by generating a first signature based on the request parameters, thereby ensuring the integrity of the data. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0052] FIG1 is a diagram showing an application environment of a data tamper-proof method according to an embodiment;

[0053] FIG2 is a schematic diagram of a flow chart of a data tamper-proof method in one embodiment;

[0054] FIG3 is a schematic diagram of a flow chart of a data tamper-proof method in another embodiment;

[0055] FIG4 is a schematic diagram of a flow chart of a data tamper-proof method in another embodiment;

[0056] FIG5 is a schematic diagram of a flow chart of a data tamper-proof method in another embodiment;

[0057] FIG6 is a schematic flow chart of a data tamper-proof method in another embodiment;

[0058] FIG7 is a schematic diagram of a flow chart of a data tamper-proof method in one embodiment;

[0059] FIG8 is a schematic diagram of a flow chart of a data tamper-proof method in another embodiment;

[0060] FIG9 is a schematic flow chart of a data tamper-proof method in another embodiment;

[0061] FIG10 is a schematic diagram of a flow chart of a data tamper-proof method in another embodiment;

[0062] FIG11 is a schematic flow chart of a data tamper-proof method in another embodiment;

[0063] FIG12 is a schematic diagram of a flow chart of a data tamper-proof method in one embodiment;

[0064] FIG13 is a schematic diagram of a flow chart of a data tamper-proof method in one embodiment;

[0065] FIG14 is a schematic diagram of the overall process of a data tamper-proof method in one embodiment;

[0066] FIG15 is a structural block diagram of a data tamper-proof device in one embodiment;

[0067] FIG16 is a structural block diagram of a data tamper-proof device in one embodiment;

[0068] FIG. 17 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0069] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0070] With the rapid development of information technology, the scale and complexity of network applications are constantly increasing. Under the current microservice technology architecture, traditional interface requests are mostly request-response mode. The client sends a request to the data interface of the server, and the server processes the interface request and responds to achieve data transmission and data exchange.

[0071] However, during the transmission of traditional interface request data, some sensitive information is transmitted in plain text and is easy to be tampered with. At the same time, the response data returned based on the request data is also easy to be tampered with, which leads to serious security risks.

[0072] Therefore, the embodiments of the present application provide a data tamper-proof method, device, equipment, storage medium and program product, which can solve the above-mentioned technical problems.

[0073] The data tamper-proof method provided by the embodiment of the present application can be applied in the implementation environment as shown in Figure 1. Among them, the client 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. In the process of generating a call interface request, the client 102 obtains the request parameters, generates a first signature configured in the request header according to the request parameters, and configures the request parameters in the request body to obtain the interface call request, and the client 102 sends the interface call request to the server 104, and the server 104 generates a first verification signature according to the request parameters in the request body, and verifies the first signature in the request header according to the first verification signature to determine whether the request parameters are tampered. Among them, the above-mentioned client 102 can be, but not limited to, various personal computers, laptops, smart phones and tablet devices, and the server 104 can be implemented with an independent server or a server cluster composed of multiple servers.

[0074] In one embodiment, as shown in FIG. 2 , a data tamper-proof method is provided, which is described by taking the method used in the client 102 in FIG. 1 as an example. The method includes the following steps:

[0075] S202, in the process of generating an interface call request, obtaining request parameters.

[0076] An interface call request refers to sending a request to a specific interface address over the network to obtain data, perform operations, or obtain specific services, usually involving the use of HTTP or HTTPS protocols to communicate with a remote server. Request parameters refer to additional information passed to the server in an HTTP request to specify the details or conditions of the request. The request parameters can be query string parameters, path parameters, request body parameters, or form parameters.

[0077] In an embodiment of the present application, the client may obtain a request parameter input by a user, and the request parameter may be, for example, "name=test&type=1".

[0078] S204, generate a first signature according to the request parameters, configure the first signature in the request header, and configure the request parameters in the request body to obtain an interface call request.

[0079] The first signature is a signature generated by the client based on the request parameters, which is a security mechanism used to verify the legitimacy and integrity of the request. It can ensure that the source of the request is credible and prevent the request from being tampered with or replayed.

[0080] In an embodiment of the present application, the client may process the request parameters using an existing digest generation algorithm or a signature generation algorithm to generate a first signature based on the request parameters. The signature generation algorithm may be, for example, the national encryption SM3 algorithm.

[0081] In a possible implementation, the client may combine the request parameters in a preset combination manner to obtain combined request parameters, and use a signature generation algorithm to generate a signature for the combined request parameters to obtain a first signature.

[0082] In another possible implementation, the client may first encrypt the request parameters, combine the encrypted request parameters according to a preset combination method to obtain combined request parameters, and use a signature generation algorithm to generate a signature for the combined request parameters to obtain a first signature.

[0083] After generating the first signature, the client may configure the first signature as a value corresponding to a signature parameter in the request header, for example, configuring the first signature as a value of an X-Request-Sign parameter in the request header.

[0084] After configuring the first signature in the request header, encrypt the request parameters and configure them in the request body, determine to use a request method that supports the request body, such as the POST method or the PUT method, construct a data structure containing the request parameters, and configure the request parameters in the request body. Generate an interface call request based on the configured request header and request body.

[0085] S206, sending the interface call request to the server.

[0086] In an embodiment of the present application, the client may send an interface call request carrying a request header and a request body to the server. The interface call request is used by the server to generate a first verification signature according to the request parameters in the request body, and to verify the first signature in the request header according to the first verification signature to determine whether the request parameters have been tampered with.

[0087] Among them, the server can receive the interface call request sent by the client, the interface call request includes a request header and a request body, the request header is configured with a first signature generated by the client according to the obtained request parameters, and the request body is configured with the request parameters.

[0088] The server can obtain the request body in the interface call request and generate a first verification signature based on the request parameters in the request body. In an embodiment of the present application, the server can generate the first verification signature in the same way as the client generates the first signature. The first verification signature is generated by the server according to the request parameters in the interface call request, and the first signature is generated by the client according to the obtained request parameters. To prevent the request parameters from being tampered with, the server can verify the first signature of the request header based on the first verification signature. For example, a string comparison can be performed on the first verification signature and the first signature to determine whether the characters at each position in the first verification signature are the same as the characters at the corresponding positions in the first signature, so as to determine whether the request parameters have been tampered with.

[0089] The above data tamper-proof method is applied to the client, and in the process of generating an interface call request, the request parameters are obtained, a first signature is generated according to the request parameters, the first signature is configured in the request header, and the request parameters are configured in the request body, and the interface call request is obtained, and the interface call request is sent to the server. The interface call request is used by the server to generate a first verification signature according to the request parameters in the request body, and the first signature in the request header is verified according to the first verification signature to determine whether the request parameters have been tampered with. In this method, the client generates a first signature according to the request parameters, and configures the first signature in the request header, and configures the request parameters in the request body. In this way, during the data transmission process, if the request parameters in the request body are tampered with, the first signature in the request header includes the information of the request parameters before the tampering, and the first signature can be used to determine whether the request parameters in the request body have been tampered with.

[0090] In the above embodiment, it is mentioned that the first signature is generated according to the request parameters. Next, an implementation method of the server 102 generating the first signature according to the request parameters is described.

[0091] Based on the embodiment shown in FIG. 2 , referring to FIG. 3 , the above S204 may include the following steps:

[0092] S302: concatenate the parameter name and the parameter value according to a preset concatenation format to obtain a concatenated parameter.

[0093] The request parameters include a parameter name and a parameter value corresponding to the parameter name. For example, the parameter name is "name" and the parameter value is "test".

[0094] In the embodiment of the present application, the client can sequentially concatenate the parameter name and the parameter value according to the parameter order, and the concatenation rule is the method of adding the parameter name and the parameter value to obtain the concatenated parameter. For example, the request parameter "name=test&type=1" and the concatenated parameter are "nametesttype1". Alternatively, the client can encrypt the parameter name and the parameter value, and sequentially concatenate the encrypted parameter value and the encrypted parameter name according to the parameter order to obtain the concatenated parameter.

[0095] S304: Generate a first signature according to the concatenation parameters.

[0096] In an embodiment of the present application, the client can add a timestamp or a random number to the header or tail of the splicing parameter, and the uniqueness of the generated first signature can be ensured according to the timestamp or the random number. The client can use the signature generation algorithm to generate a signature for the splicing parameter and the timestamp or the random number to obtain the first signature. For example, the generated first signature can be "faffc35afa795a8ee3dcde3c939c0b6f1e587a6613d669ac217787a417dd95cc".

[0097] In this way, through the above method, the parameter name and parameter value are concatenated to obtain the concatenated parameters, and the first signature is generated according to the concatenated parameters. The signature generation process is relatively simple and intuitive, does not rely on complex encryption mechanisms, and can effectively improve the security and reliability of data transmission.

[0098] In the above embodiment, it is mentioned that the request parameters are configured in the request body. Next, an implementation method of the client 102 configuring the request parameters in the request body is described.

[0099] Based on the embodiment shown in FIG. 2 , referring to FIG. 4 , the above S204 may include the following steps:

[0100] S402: Encrypt the parameter value to obtain an encrypted request parameter.

[0101] In the embodiment of the present application, in order to prevent data leakage during data transmission, the client can encrypt the parameter value in the request parameter to obtain an encrypted parameter value, and replace the original parameter value with the encrypted parameter value to obtain an encrypted request parameter. The encryption process can be performed using the national encryption SM4 symmetric algorithm.

[0102] S404, configuring the encrypted request parameters and parameter names in the request body.

[0103] In the embodiment of the present application, for the parameter name and parameter value in the original request parameter, the client can replace the parameter value in the original request parameter with the encrypted request parameter, and configure the encrypted request parameter and parameter name in the request body according to the original data format. For example, the encrypted request parameter and parameter name in the request body can be "name=837433d3f3afa6c3b0a24&type=ded239ea58bf6df3ae9c80".

[0104] In this way, through the above method, the parameter value is encrypted to obtain the encrypted request parameter, and the encrypted request parameter and parameter name are configured in the request body. Encrypting the parameter value can ensure that the parameter value will not be leaked. Configuring the encrypted request parameter and parameter name in the request body can enable the server to determine whether the request parameter has been tampered with based on the encrypted request parameter and parameter name.

[0105] In the above embodiment, it is mentioned that the interface call request is sent to the server. Next, an implementation method of processing the interface call response returned by the server by the client is described.

[0106] Based on the embodiment shown in FIG. 2 , referring to FIG. 5 , the data tamper-proofing method in the embodiment of the present application may further include the following steps:

[0107] S502, receiving an interface call response sent by the server to the interface call request.

[0108] Among them, the interface call response is returned by the server after determining that the request parameters have not been tampered with. The interface call response includes a response header and a response body. The response header is configured with the second signature, and the response body is configured with response parameters.

[0109] In the embodiment of the present application, if the server determines that the first verification signature is consistent with the first signature, it determines that the request parameter has not been tampered with. The server can respond to the interface call request, read the parameter name included in the request body in the interface call request, and obtain the corresponding response parameter according to the parameter name. The response parameter includes the data or information required by the client. For example, the response parameter can be:

[0110] {

[0111] "name": "Test",

[0112] "age": 1,

[0113] "type": "1"

[0114] }

[0115] The server needs to send the response parameters to the client in response to the interface call request sent by the client. To prevent the response parameters from being tampered with during the process of the server returning the response parameters, the server can generate a second signature based on the response parameters. The second signature is a signature generated by the server based on the response parameters. After the server generates the second signature, the server can configure the second signature in the response header, and configure the second signature as the value corresponding to the signature parameter in the response header, for example, configure the second signature as the value of the X-Request-Sign parameter in the response header.

[0116] After configuring the second signature in the response header, the response parameters are encrypted and configured in the response body. The process of configuring the response parameters in the response body can refer to the process of configuring the request parameters in the request body, which will not be repeated here. Finally, the server generates an interface call response based on the response header and the response body, and sends the interface call response to the client.

[0117] S504: Generate a second verification signature according to the response parameters.

[0118] In an embodiment of the present application, for an interface call response sent by the server, the client can obtain response parameters in the interface call response and generate a second verification signature based on the response parameters.

[0119] In a possible implementation, the client may generate a second verification signature in the same manner as the server generates the second signature. For example, the client may read multiple parameter fields in the response parameters, generate signatures for the multiple parameter fields using a signature generation algorithm, and obtain a second verification signature.

[0120] In another possible implementation, the response parameter is an encrypted response parameter, and the client may decrypt the encrypted response parameter to obtain the response parameter, and generate a second verification signature according to the response parameter.

[0121] S506: Verify the second signature according to the second verification signature to determine whether the response parameter has been tampered with.

[0122] In an embodiment of the present application, the second verification signature is generated by the client according to the response parameters in the interface call response, and the second signature is generated by the server according to the obtained response parameters. To prevent the response parameters from being tampered with, the client can verify the second signature according to the second verification signature. For example, the second verification signature and the second signature can be compared by a string comparison to determine whether the characters at each position in the second verification signature are the same as the characters at the corresponding positions in the second signature, so as to determine whether the response parameters have been tampered with.

[0123] In this way, by receiving the interface call response sent by the server for the interface call request, the interface call response is returned by the server when it is determined that the request parameters have not been tampered with, and the interface call response includes a response header and a response body, the response header is configured with a second signature, and the response body is configured with response parameters. A second verification signature is generated according to the response parameters, and the second signature is verified according to the second verification signature to determine whether the response parameters have been tampered with. The second verification signature is generated according to the response parameters, and the second signature can be verified based on the second verification signature. For example, it is determined whether the second verification signature is consistent with the second signature. If they are inconsistent, it indicates that the response parameters obtained by the client are inconsistent with the response parameters sent by the server, and it can be determined that the response parameters have been tampered with. In this way, the response parameters can be effectively prevented from being tampered with and the integrity of the data can be ensured.

[0124] In the above embodiment, it is mentioned that the second verification signature is generated according to the response parameters. Next, an implementation method of the client 102 generating the second verification signature according to the response parameters is described.

[0125] Based on the embodiment shown in FIG5 , referring to FIG6 , the above S504 may include the following steps:

[0126] S602, decrypt the encrypted response parameter to obtain the target response parameter.

[0127] The response body includes encrypted response parameters, which are obtained by the server encrypting the target response parameters corresponding to the parameter names. The target response parameters include multiple parameter fields, and the target response parameters are response parameters in a preset format.

[0128] In an embodiment of the present application, the client receives an interface call response, reads the response body in the interface call response, and obtains the encrypted response parameters in the response body. The client can use the decryption algorithm corresponding to the encryption algorithm used by the server to encrypt the response parameters to decrypt the encrypted response parameters to obtain the target response parameters.

[0129] S604: Generate a second verification signature according to multiple parameter fields.

[0130] In an embodiment of the present application, for multiple parameter fields, the client can use a signature generation algorithm to generate signatures for the multiple parameter fields to obtain a second verification signature, and the signature generation method of the second verification signature is consistent with the signature generation method of the second signature.

[0131] In this way, through the above method, the encrypted response parameters are decrypted to obtain the target response parameters, and a second verification signature is generated according to multiple parameter fields, which can ensure that the generation method of the second verification signature is consistent with the generation method of the second signature. In this way, when the second verification signature and the second signature are compared, the accuracy and reliability of the comparison result can be ensured.

[0132] In one embodiment, as shown in FIG. 7 , a data tamper-proof method is provided. The method is described by taking the method used in the server 104 in FIG. 1 as an example. The method includes the following steps:

[0133] S702: Receive an interface call request sent by a client.

[0134] Among them, the interface call request is a request for the client to obtain data. The interface call request includes a request header and a request body. The request header is configured with a first signature generated by the client based on the obtained request parameters, and the request body is configured with request parameters. For the generation process of the interface call request, please refer to the contents in the above embodiments, which will not be repeated here.

[0135] S704: Generate a first verification signature according to the request parameters.

[0136] In an embodiment of the present application, in order to verify whether the request parameters have been tampered with, the server may generate a first verification signature to verify the first signature based on the request parameters.

[0137] In one possible implementation, the server may generate a first verification signature in the same manner as the client generates the first signature. For example, the server may obtain the parameter name and parameter value included in the request parameters, concatenate the parameter value and parameter name to obtain concatenated parameters, and use a signature generation algorithm to generate a signature for the concatenated parameters to obtain a first verification signature.

[0138] In another possible implementation, the request parameters in the request body are encrypted request parameters. The server may decrypt the encrypted request parameters to obtain the request parameters, and generate the first verification signature in the same manner as the client generates the first signature.

[0139] S706: Verify the first signature according to the first verification signature to determine whether the request parameters have been tampered with.

[0140] In an embodiment of the present application, the server can perform a string comparison on the first verification signature and the first signature to determine whether the characters at each position in the first verification signature are the same as the characters at the corresponding positions in the first signature, so as to determine whether the request parameters have been tampered with. If the characters at each position in the first verification signature are the same as the characters at the corresponding positions in the first signature, it is determined that the request parameters have not been tampered with. If the characters at each position in the first verification signature are different from the characters at the corresponding positions in the first signature at any position, it is determined that the request parameters have been tampered with. The server can determine that the interface call request is an illegal request and reject the call.

[0141] The above data tamper-proof method is applied to the server side, by receiving the interface call request sent by the client, the interface call request includes a request header and a request body, the request header is configured with a first signature generated by the client according to the obtained request parameters, and the request body is configured with the request parameters; a first verification signature is generated according to the request parameters; the first signature is verified according to the first verification signature to determine whether the request parameters have been tampered with. In this method, the server side generates a first verification signature according to the request parameters in the request body, and verifies the first signature according to the first verification signature. For example, if the first verification signature is inconsistent with the first signature, it indicates that the request parameters obtained by the server side are inconsistent with the request parameters sent by the client, and it can be determined whether the request parameters have been tampered with. This application can effectively prevent the request parameters from being tampered with by generating the first signature based on the request parameters, thereby ensuring the integrity of the data.

[0142] In the above embodiment, it is mentioned that the first verification signature is generated according to the request parameters. Next, an implementation method of the server 104 generating the first verification signature according to the request parameters is described.

[0143] Based on the embodiment shown in FIG. 7 , referring to FIG. 8 , the above S704 may include the following steps:

[0144] S802: Decrypt the encrypted request parameter to obtain the parameter value.

[0145] The request body includes encrypted request parameters and parameter names. The encrypted request parameters are obtained by encrypting the parameter values ​​corresponding to the parameter names by the client.

[0146] In an embodiment of the present application, the server receives an interface call request, reads the request body in the interface call request, obtains the encrypted request parameters and unencrypted parameter names in the request body, and the server can use the decryption algorithm corresponding to the encryption algorithm used by the client to encrypt the parameter value to decrypt the encrypted request parameters to obtain the parameter value.

[0147] S804: Generate a first verification signature according to the parameter value and the parameter name.

[0148] In an embodiment of the present application, the server may concatenate the parameter name and parameter value according to a preset concatenation format to obtain concatenation parameters, generate a signature for the concatenation parameters using a signature generation algorithm, and obtain a first verification signature. The generation method of the first verification signature is consistent with the generation method of the first signature.

[0149] In this way, through the above method, the encrypted request parameters are decrypted to obtain the parameter value, and the first verification signature is generated according to the parameter value and the parameter name, which can ensure the consistency between the first verification signature and the first signature. In this way, when comparing the first verification signature and the first signature, the accuracy and reliability of the comparison result can be ensured.

[0150] The above embodiment mentions determining whether the request parameters have been tampered with. Next, an implementation method of processing the interface call request by the server 104 when determining that the request parameters have not been tampered with is described.

[0151] Based on the embodiment shown in FIG. 7 , referring to FIG. 9 , the data tamper-proof method in the embodiment of the present application may further include the following steps:

[0152] S902: If it is determined that the request parameter has not been tampered with, obtain the response parameter corresponding to the parameter name.

[0153] In an embodiment of the present application, the server can respond to the interface call request, read the parameter name included in the request body of the interface call request, and obtain the corresponding response parameter according to the parameter name, and the response parameter includes the data or information required by the client.

[0154] S904, generate a second signature according to the response parameters, configure the second signature in the response header, and configure the response parameters in the response body to obtain an interface call response.

[0155] In an embodiment of the present application, the second signature is a signature generated based on the response parameters. The server can use a signature generation algorithm to generate a signature for the response parameters to obtain the second signature. The signature generation algorithm can, for example, be the national encryption SM3 algorithm.

[0156] In a possible implementation, the server may obtain response parameters, convert the response parameters into parameters in a target format, for example, into parameters in a JSON format, and generate a signature for the response parameters after the format conversion using a signature generation algorithm to obtain a second signature.

[0157] In another possible implementation, the server may encrypt the response parameters to obtain encrypted response parameters, and based on the encrypted response parameters, generate a signature for the encrypted response parameters using a signature generation algorithm to obtain a second signature.

[0158] After generating the second signature, the server can configure the second signature as the value corresponding to the signature parameter in the response header. After configuring the second signature in the response header, the server can encrypt the response parameter as a whole and configure it in the response body, and generate an interface call response based on the response header and the response body.

[0159] S906, sending the interface call response to the client.

[0160] The interface call response is used by the client to generate a second verification signature according to the response parameters in the interface call response, and to verify the second signature according to the second verification signature to determine whether the response parameters have been tampered with. For the process of the client processing the interface call response, please refer to the content in the above embodiment, which will not be repeated here.

[0161] In this way, through the above method, if it is determined that the request parameter has not been tampered with, the response parameter corresponding to the parameter name is obtained, and the second signature is generated according to the response parameter, and the second signature is configured in the response header, and the response parameter is configured in the response body, and the interface call response is obtained, and the interface call response is sent to the client. The interface call response is used by the client to generate a second verification signature according to the response parameters in the interface call response, and the second signature is verified according to the second verification signature to determine whether the response parameter has been tampered with. The server generates a second signature according to the response parameter, and configures the second signature in the response header, and configures the response parameter in the response body. In this way, during the data transmission process, if the response parameter in the response body is tampered with, the second signature in the response header still includes the information of the response parameter before the tampering, and the second signature can be used to determine whether the response parameter in the response body has been tampered with.

[0162] In the above embodiment, it is mentioned that the second signature is generated according to the response parameters. Next, an implementation method of the server 104 generating the second signature according to the response parameters is described.

[0163] Based on the embodiment shown in FIG. 9 , referring to FIG. 10 , the above S904 includes the following steps:

[0164] S1002, performing format conversion processing on the response parameters to obtain target response parameters.

[0165] In the embodiment of the present application, the server can convert the response parameter into a target format, characterize the response parameter as a plurality of parameter fields, and obtain a target response parameter. The target response parameter includes a plurality of parameter fields.

[0166] S1004: Generate a second signature according to multiple parameter fields.

[0167] In the embodiment of the present application, the server can add a timestamp or a random number to the head or tail of multiple parameter fields, and the uniqueness of the generated second signature can be ensured according to the timestamp or the random number. The server can generate signatures for multiple parameter fields using a signature generation algorithm to obtain a second signature. For example, "5e543f90f8c40c0a1d33644e154f67cdb6aeafcd97c6c03b070c4f9770373d94".

[0168] In this way, through the above method, the response parameters are format converted to obtain the target response parameters, and a second signature is generated based on multiple parameter fields of the target response parameters. The signature generation process is relatively simple and intuitive, does not rely on complex encryption mechanisms, and can effectively improve the security and reliability of data transmission.

[0169] In the above embodiment, it is mentioned that the response parameters are configured in the response body. Next, an implementation method of configuring the response parameters in the response body by the server 104 is described.

[0170] Based on the embodiment shown in FIG. 10 , referring to FIG. 11 , the above S904 includes the following steps:

[0171] S1102, encrypt the target response parameter to obtain an encrypted response parameter.

[0172] In the embodiment of the present application, the target response parameter is encrypted to obtain the encrypted response parameter, which is to encrypt the target response parameter as a whole. The target response parameter as a whole can be encrypted using an encryption algorithm, and the encryption algorithm can be, for example, the national encryption SM4 symmetric algorithm. The encrypted response parameter can be "6b20eb98a0ce41d461175dfdf876dc8a2f0f9430".

[0173] S1104, configure the encrypted response parameters in the response body.

[0174] In this way, by encrypting the response parameters in the above manner, it is possible to ensure that the response parameters will not be leaked, and by configuring the encrypted response parameters in the response body, the client can determine whether the response parameters have been tampered with based on the encrypted response parameters.

[0175] In one embodiment, a data tamper-proof method is provided for use in a client 102. Referring to FIG. 12 , the method includes the following steps:

[0176] S1201, in the process of generating an interface call request, obtaining request parameters;

[0177] S1202, concatenating the parameter name and the parameter value according to a preset concatenation format to obtain a concatenated parameter;

[0178] S1203, generating a first signature according to the concatenated parameters, and configuring the first signature in the request header;

[0179] S1204, encrypt the parameter value to obtain an encrypted request parameter;

[0180] S1205, configuring the encrypted request parameters and parameter names in the request body to obtain an interface call request;

[0181] S1206, sending the interface call request to the server;

[0182] S1207, receiving an interface call response sent by the server to the interface call request;

[0183] S1208, decrypt the encrypted response parameter to obtain a target response parameter, where the target response parameter includes multiple parameter fields;

[0184] S1209, generating a second verification signature according to multiple parameter fields;

[0185] S1210: Verify the second signature according to the second verification signature to determine whether the response parameter has been tampered with.

[0186] The following is an exemplary description of the implementation of the data tamper-proofing method of the above embodiment.

[0187] As shown in Figure 12, in the process of generating an interface call request, request parameters are obtained, parameter names and parameter values ​​are spliced ​​according to a preset splicing format to obtain splicing parameters, a first signature is generated according to the splicing parameters, and the first signature is configured in the request header, the parameter values ​​are encrypted to obtain encrypted request parameters, the encrypted request parameters and the parameter names are configured in the request body to obtain the interface call request, the interface call request is sent to the server, the interface call response sent by the server to the interface call request is received, the encrypted response parameters are decrypted to obtain target response parameters, the target response parameters include multiple parameter fields, a second verification signature is generated according to the multiple parameter fields, and the second signature is verified according to the second verification signature to determine whether the response parameters have been tampered with.

[0188] In one embodiment, a data tamper-proof method is provided for use at the server 104. Referring to FIG. 13 , the method includes the following steps:

[0189] S1301, receiving an interface call request sent by a client;

[0190] S1302, decrypt the encrypted request parameter to obtain the parameter value;

[0191] S1303, generating a first verification signature according to the parameter value and parameter name;

[0192] S1304, verifying the first signature according to the first verification signature to determine whether the request parameters have been tampered with;

[0193] S1305, if it is determined that the request parameter has not been tampered with, obtain the response parameter corresponding to the parameter name;

[0194] S1306, performing format conversion processing on the response parameter to obtain a target response parameter, where the target response parameter includes multiple parameter fields;

[0195] S1307, generating a second signature according to the multiple parameter fields, and configuring the second signature in the response header;

[0196] S1308, encrypting the target response parameter to obtain an encrypted response parameter;

[0197] S1309, configuring the encrypted response parameters in the response body to obtain an interface call response;

[0198] S1310, sending an interface call response to the client.

[0199] The following is an exemplary description of the implementation of the data tamper-proofing method of the above embodiment.

[0200] As shown in Figure 13, the interface call request sent by the client is received, the encrypted request parameters are decrypted to obtain the parameter values, a first verification signature is generated according to the parameter values ​​and parameter names, the first signature is verified according to the first verification signature to determine whether the request parameters have been tampered with, if it is determined that the request parameters have not been tampered with, the response parameters corresponding to the parameter names are obtained, the response parameters are format converted to obtain target response parameters, the target response parameters include multiple parameter fields, a second signature is generated according to the multiple parameter fields, and the second signature is configured in the response header, the target response parameters are encrypted to obtain encrypted response parameters, the encrypted response parameters are configured in the response body, the interface call response is obtained, and the interface call response is sent to the client.

[0201] In one embodiment, a schematic diagram of the overall process of a data tamper-proof method is provided, referring to FIG14 , and the method comprises the following steps:

[0202] S1401, the client obtains request parameters during the process of generating an interface call request;

[0203] S1402, the client concatenates the parameter name and the parameter value according to a preset concatenation format to obtain a concatenated parameter;

[0204] S1403, the client generates a first signature according to the concatenated parameters, and configures the first signature in the request header;

[0205] S1404, the client encrypts the parameter value to obtain an encrypted request parameter;

[0206] S1405, the client configures the encrypted request parameters and parameter names in the request body to obtain an interface call request;

[0207] S1406, the client sends an interface call request to the server;

[0208] S1407, the server decrypts the encrypted request parameter to obtain the parameter value;

[0209] S1408, the server generates a first verification signature according to the parameter value and parameter name;

[0210] S1409, the server verifies the first signature according to the first verification signature to determine whether the request parameters have been tampered with;

[0211] S1410, if the server determines that the request parameter has not been tampered with, it obtains the response parameter corresponding to the parameter name;

[0212] S1411, the server performs format conversion processing on the response parameter to obtain a target response parameter, where the target response parameter includes multiple parameter fields;

[0213] S1412, the server generates a second signature according to the multiple parameter fields, and configures the second signature in the response header;

[0214] S1413, the server encrypts the target response parameter to obtain an encrypted response parameter;

[0215] S1414, the server configures the encrypted response parameters in the response body and obtains an interface call response;

[0216] S1415, the server sends an interface call response to the client;

[0217] S1416, the client decrypts the encrypted response parameter to obtain the target response parameter;

[0218] S1417, the client generates a second verification signature according to the multiple parameter fields;

[0219] S1418, the client verifies the second signature according to the second verification signature to determine whether the response parameters have been tampered with.

[0220] The following is an exemplary description of the implementation of the data tamper-proofing method of the above embodiment.

[0221] Referring to Figure 14, in the process of generating an interface call request, the client obtains request parameters, concatenates the parameter name and the parameter value according to a preset concatenation format to obtain the concatenated parameters, generates a first signature according to the concatenated parameters, configures the first signature in the request header, encrypts the parameter value to obtain encrypted request parameters, configures the encrypted request parameters and the parameter name in the request body to obtain the interface call request, sends the interface call request to the server, and the server decrypts the encrypted request parameters to obtain the parameter value, generates a first verification signature according to the parameter value and the parameter name, and verifies the first signature according to the first verification signature to determine whether the request parameters have been tampered with. If it is determined that the request parameters have not been tampered with, the server will If the interface has been tampered with, the response parameter corresponding to the parameter name is obtained, the response parameter is formatted and processed to obtain the target response parameter, the target response parameter includes multiple parameter fields, a second signature is generated according to the multiple parameter fields, and the second signature is configured in the response header, the target response parameter is encrypted to obtain the encrypted response parameter, the encrypted response parameter is configured in the response body, and the interface call response is obtained, the interface call response is sent to the client, the client decrypts the encrypted response parameter to obtain the target response parameter, the target response parameter includes multiple parameter fields, a second verification signature is generated according to the multiple parameter fields, and the second signature is verified according to the second verification signature to determine whether the response parameter has been tampered with.

[0222] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0223] Based on the same inventive concept, the embodiment of the present application also provides a data tamper-proof device for implementing the data tamper-proof method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more data tamper-proof device embodiments provided below can refer to the limitations of the data tamper-proof method above, and will not be repeated here.

[0224] In one embodiment, as shown in FIG. 15 , a data tamper-proof device is provided, which is applied to a client and includes: an acquisition module 1501, a configuration module 1502, and a sending module 1503, wherein:

[0225] The acquisition module 1501 is used to acquire request parameters in the process of generating an interface call request;

[0226] Configuration module 1502, used to generate a first signature according to the request parameters, configure the first signature in the request header, and configure the request parameters in the request body to obtain an interface call request;

[0227] The sending module 1503 is used to send the interface call request to the server. The interface call request is used by the server to generate a first verification signature according to the request parameters in the request body, and verify the first signature in the request header according to the first verification signature to determine whether the request parameters have been tampered with.

[0228] In another embodiment, another data tamper-proof device is provided. Based on the above embodiment, the request parameter includes a parameter name and a parameter value corresponding to the parameter name. The configuration module 1502 includes a splicing unit and a first signature generation unit, wherein:

[0229] A splicing unit, used for splicing parameter names and parameter values ​​according to a preset splicing format to obtain splicing parameters;

[0230] The first signature generating unit is used to generate a first signature according to the splicing parameters.

[0231] In another embodiment, another data tamper-proof device is provided. Based on the above embodiment, the configuration module 1502 further includes a request encryption unit and a request configuration unit, wherein:

[0232] A request encryption unit, used to encrypt the parameter value to obtain an encrypted request parameter;

[0233] The request configuration unit is used to configure the encrypted request parameters and parameter names in the request body.

[0234] In another embodiment, another data tamper-proof device is provided. Based on the above embodiment, the device further includes a response receiving module, a verification signature generating module and a response verification module, wherein:

[0235] A response receiving module, used to receive an interface call response sent by the server to the interface call request, the interface call response is returned by the server when it is determined that the request parameters have not been tampered with, and the interface call response includes a response header and a response body, the response header is configured with a second signature, and the response body is configured with response parameters;

[0236] A verification signature generation module, used to generate a second verification signature according to the response parameters;

[0237] The response verification module is used to verify the second signature according to the second verification signature to determine whether the response parameter has been tampered with.

[0238] In another embodiment, another data tamper-proof device is provided. Based on the above embodiment, the response body includes an encrypted response parameter, which is obtained by the server end encrypting the target response parameter corresponding to the parameter name. The verification signature generation module includes a second decryption unit and a second verification unit, wherein:

[0239] A second decryption unit is used to decrypt the encrypted response parameter to obtain a target response parameter, where the target response parameter includes a plurality of parameter fields;

[0240] The second verification unit is used to generate a second verification signature according to multiple parameter fields.

[0241] In one embodiment, as shown in FIG. 16 , a data tamper-proof device is provided, which is applied to a server and includes: a receiving module 1601, a generating module 1602, and a verifying module 1603, wherein:

[0242] The receiving module 1601 is used to receive an interface call request sent by a client, where the interface call request includes a request header and a request body. The request header is configured with a first signature generated by the client according to the acquired request parameters, and the request body is configured with the request parameters.

[0243] A generating module 1602, configured to generate a first verification signature according to the request parameters;

[0244] The verification module 1603 is used to verify the first signature according to the first verification signature to determine whether the request parameters are tampered with.

[0245] In another embodiment, another data tamper-proof device is provided. Based on the above embodiment, the request body includes an encrypted request parameter and a parameter name. The encrypted request parameter is obtained by encrypting the parameter value corresponding to the parameter name by the client. The generation module 1602 includes a first decryption unit and a first verification unit, wherein:

[0246] A first decryption unit, used to decrypt the encrypted request parameter to obtain a parameter value;

[0247] The first verification unit is used to generate a first verification signature according to the parameter value and the parameter name.

[0248] In another embodiment, another data tamper-proof device is provided. Based on the above embodiment, the device further includes a parameter acquisition module, a response configuration module and a response sending module, wherein:

[0249] The parameter acquisition module is used to obtain the response parameter corresponding to the parameter name if it is determined that the request parameter has not been tampered with;

[0250] A response configuration module, used to generate a second signature according to the response parameters, configure the second signature in the response header, and configure the response parameters in the response body to obtain an interface call response;

[0251] The response sending module is used to send the interface call response to the client. The interface call response is used by the client to generate a second verification signature according to the response parameters in the interface call response, and verify the second signature according to the second verification signature to determine whether the response parameters have been tampered with.

[0252] In another embodiment, another data tamper-proof device is provided. Based on the above embodiment, the response configuration module includes a format conversion unit and a second signature generation unit, wherein:

[0253] A format conversion unit, used for performing format conversion processing on the response parameter to obtain a target response parameter, where the target response parameter includes a plurality of parameter fields;

[0254] The second signature generating unit is used to generate a second signature according to multiple parameter fields.

[0255] In another embodiment, another data tamper-proof device is provided. Based on the above embodiment, the response configuration module further includes a response encryption unit and a response configuration unit, wherein:

[0256] A response encryption unit, used for encrypting the target response parameter to obtain an encrypted response parameter;

[0257] The response configuration unit is used to configure the encrypted response parameters in the response body.

[0258] Each module in the above-mentioned data tamper-proof device can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0259] In an exemplary embodiment, a computer device is provided, which can be a terminal or a server. Taking a terminal as an example, its internal structure diagram can be shown in FIG17. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a data tamper-proof method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covered on the display screen, or a key, a trackball or a touch pad set on the computer device housing, or an external keyboard, touch pad or mouse, etc.

[0260] Those skilled in the art will understand that the structure shown in FIG. 17 is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0261] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.

[0262] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0263] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0264] It should be noted that the data involved in this application (including but not limited to data used for analysis, storage, display, etc.) are all data fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0265] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0266] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0267] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A data tamper-proof method, characterized in that: Applied to a client, the method comprises: In the process of generating an interface call request, obtain request parameters; Generate a first signature according to the request parameters, configure the first signature in the request header, and configure the request parameters in the request body to obtain the interface call request; The interface call request is sent to the server, and the interface call request is used by the server to generate a first verification signature according to the request parameters in the request body, and verify the first signature in the request header according to the first verification signature to determine whether the request parameters have been tampered with.

2. The method according to claim 1, characterized in that The request parameter includes a parameter name and a parameter value corresponding to the parameter name, and generating a first signature according to the request parameter includes: Concatenate the parameter name and the parameter value according to a preset concatenation format to obtain a concatenated parameter; The first signature is generated according to the splicing parameters.

3. The method according to claim 2, characterized in that The configuring the request parameters in the request body includes: Encrypting the parameter value to obtain an encrypted request parameter; The encrypted request parameter and the parameter name are configured in the request body.

4. The method according to claim 1, characterized in that: The method further comprises: Receiving an interface call response sent by the server for the interface call request, the interface call response being returned by the server when it is determined that the request parameters have not been tampered with, the interface call response comprising a response header and a response body, the response header being configured with a second signature, and the response body being configured with response parameters; Generate a second verification signature according to the response parameter; The second signature is verified according to the second verification signature to determine whether the response parameter has been tampered with.

5. The method according to claim 4, characterized in that The response body includes an encrypted response parameter, which is obtained by the server end encrypting the target response parameter corresponding to the parameter name, and generating a second verification signature according to the response parameter includes: Decrypting the encrypted response parameter to obtain the target response parameter, wherein the target response parameter includes a plurality of parameter fields; The second verification signature is generated according to the multiple parameter fields.

6. A data tamper-proof method, characterized in that: Applied to the server, the method includes: Receive an interface call request sent by a client, the interface call request comprising a request header and a request body, the request header being configured with a first signature generated by the client according to the acquired request parameters, and the request body being configured with the request parameters; Generate a first verification signature according to the request parameters; The first signature is verified according to the first verification signature to determine whether the request parameters have been tampered with.

7. The method according to claim 6, characterized in that The request body includes an encrypted request parameter and a parameter name, wherein the encrypted request parameter is obtained by the client encrypting a parameter value corresponding to the parameter name, and generating a first verification signature according to the request parameter includes: Decrypting the encrypted request parameter to obtain the parameter value; The first verification signature is generated according to the parameter value and the parameter name.

8. The method according to claim 6, characterized in that The method further comprises: If it is determined that the request parameter has not been tampered with, then obtaining the response parameter corresponding to the parameter name; Generate a second signature according to the response parameters, configure the second signature in the response header, and configure the response parameters in the response body to obtain an interface call response; The interface call response is sent to the client, and the interface call response is used by the client to generate a second verification signature according to the response parameters in the interface call response, and verify the second signature according to the second verification signature to determine whether the response parameters have been tampered with.

9. The method according to claim 8, characterized in that The generating a second signature according to the response parameter comprises: Performing format conversion processing on the response parameter to obtain a target response parameter, wherein the target response parameter includes a plurality of parameter fields; The second signature is generated according to the plurality of parameter fields.

10. The method according to claim 9, characterized in that The configuring the response parameters in the response body includes: Encrypting the target response parameter to obtain an encrypted response parameter; The encrypted response parameters are configured in the response body.

11. A data tamper-proof device, characterized in that: Applied to a client, the device comprises: The acquisition module is used to obtain request parameters in the process of generating an interface call request; A configuration module, configured to generate a first signature according to the request parameters, configure the first signature in the request header, and configure the request parameters in the request body to obtain the interface call request; A sending module is used to send the interface call request to the server, and the interface call request is used by the server to generate a first verification signature according to the request parameters in the request body, and to verify the first signature in the request header according to the first verification signature to determine whether the request parameters have been tampered with.

12. A data tamper-proof device, characterized in that: Applied to the server, the device comprises: A receiving module, configured to receive an interface call request sent by a client, wherein the interface call request includes a request header and a request body, wherein the request header is configured with a first signature generated by the client according to the acquired request parameters, and the request body is configured with the request parameters; A generating module, used to generate a first verification signature according to the request parameters; A verification module is used to verify the first signature according to the first verification signature to determine whether the request parameters have been tampered with.

13. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 10 are implemented.

14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.

15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.

Citation Information

Patent Citations

  • Tamper-proof system and method based on bidirectional data flow

    CN115795506A

  • Service link encryption method and system

    CN117424714A

  • API (Application Program Interface) secure access method and device, electronic equipment and storage medium

    CN117640109A

Cited By

  • License verification method and device, equipment and storage medium

    CN121333587A