Data transmission method and apparatus, electronic device, and storage medium
By matching the dynamic signature algorithm between the terminal and the server, the target request is generated and verified, which solves the problem of data theft or forgery during data transmission and improves the security of data transmission.
Patent Information
- Application Number
- CN202410858663.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2044-06-28
AI Technical Summary
In existing technologies, data transmission between terminals and servers is at risk of being stolen or forged, especially in advertising services, where fixed request signature methods are not very effective at preventing theft and forgery.
The terminal sends terminal information to the server to obtain the corresponding signature algorithm, generates and sends the target request, and the server verifies the legitimacy of the request by dynamically matching the signature algorithm to reduce the probability of data theft or forgery.
By using dynamic signature algorithms for matching, the probability of data being stolen or forged is reduced, and the security of data transmission is improved.
Smart Images

Figure CN118631470B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, and particularly relates to a data transmission method and device, electronic equipment and storage medium. BACKGROUND
[0002] In the related art, when a terminal and a server perform data transmission, an important challenge is to prevent data from being stolen or forged, i.e., to prevent a real terminal request from being forged or key information in the request from being tampered with. For example, for an advertisement service, by requesting an advertisement service interface, a billing link of an advertisement can be extracted from response data, and then the link is directly used to initiate a billing request, which will have a serious adverse effect on the advertisement service, such as data theft or forgery.
[0003] At present, a fixed request signature method is usually used to encrypt the entire response data, or when the terminal sends a data request to the server, the fixed request signature method is used to directly encrypt the data of the request, but such methods have poor anti-theft and anti-forgery effects. SUMMARY
[0004] In view of this, to solve some or all of the above technical problems, the embodiments of the present application provide a data transmission method and device, electronic equipment and storage medium.
[0005] In a first aspect, the embodiments of the present application provide a data transmission method, which is applied to a terminal, and the method comprises the following steps.
[0006] sending terminal information to a server, so that the server determines a signature algorithm corresponding to the terminal information based on a preset correspondence relationship, wherein the terminal information is used by the server to determine the corresponding signature algorithm, and the preset correspondence relationship represents a correspondence relationship between terminal information and a signature algorithm;
[0007] receiving algorithm information sent by the server, wherein the algorithm information represents a signature algorithm corresponding to the terminal information;
[0008] determining an original request of the terminal, wherein the original request represents a request before signature according to the signature algorithm;
[0009]
[0009] signing the original request according to the signature algorithm to generate a target request, wherein the target request represents a request after signature according to the signature algorithm, and the target request is used for data transmission between the terminal and the server.
[0010] In one possible implementation, the signature algorithm is used to indicate an algorithm for generating a signature value of the original request; and
[0011] The signing of the original request according to the signature algorithm comprises:
[0012] The signature value of the original request is generated according to the signature algorithm;
[0013] The signature value is added to the original request to sign the original request.
[0014] In one possible implementation, the terminal information further comprises an application version of a target application of the terminal, the target application being an application installed on the terminal; and
[0015] The signature value is added to the original request to sign the original request.
[0016] The signature value and the application version are added to the original request to sign the original request.
[0017] In one possible implementation, the algorithm information is contained in configuration information sent by the server, wherein the configuration information is used to configure the target application.
[0018] In one possible implementation, the signature value comprises a field value of a signature field, and the signature algorithm is used to indicate an algorithm for processing the field value; and
[0019] The signature value of the original request is generated according to the signature algorithm, comprising:
[0020] The field value is processed according to the signature algorithm to obtain a first processing result;
[0021] The signature value of the original request is generated based on the first processing result.
[0022] In one possible implementation, the signature value comprises a random number, and the signature algorithm is used to indicate an algorithm for processing the random number; and
[0023] The signature value of the original request is generated according to the signature algorithm, comprising:
[0024] The random number is processed according to the signature algorithm to obtain a second processing result;
[0025] The signature value of the original request is generated based on the second processing result.
[0026] In one possible implementation, the signing of the original request according to the signature algorithm comprises:
[0027] splicing the original request, the signature value of the original request and the application version of the target application according to a splicing order indicated by the signature algorithm to sign the original request;
[0028] The target application is an application installed in the terminal, and the splicing order indicates a sequence of splicing the original request, the signature value of the original request and the target application.
[0029] In a second aspect, an embodiment of the present application provides a verification method, which is applied to a server side, and includes the following steps:
[0030] receiving a target request sent by a terminal;
[0031] determining whether the target request is generated by using a target method, to obtain discrimination information, wherein the target method is any of the data transmission methods, and the discrimination information indicates that the initial request is for the target request;
[0032] based on the discrimination information, determining whether the terminal is verified.
[0033] In one possible implementation, when the target method indicates that the target request is spliced by the original request, a signature value and an application version according to the signature algorithm, the determining whether the target request is generated by using the target method includes the following steps:
[0034] determining whether the target request contains target information, wherein the target information includes the signature value and the application version;
[0035] based on whether the target request contains the target information, determining whether the target request is generated by using the target method.
[0036] In one possible implementation, the determining whether the target request is generated by using the target method based on whether the target request contains the target information includes the following steps:
[0037] when the target request does not contain the target information, determining that the target request is not generated by using the target method;
[0038] when the target request contains the target information, performing the following steps:
[0039] determining algorithm information matched with the application version in the target request, wherein the algorithm information indicates a signature algorithm;
[0040] determining an original request in the target request;
[0041] generate a signature value of the original request in the target request according to a signature algorithm indicated by the algorithm information matched with the application version in the target request, to obtain a target signature value;
[0042] determine whether the target request is generated by a target method based on the target signature value and the signature value in the target request.
[0043] In a third aspect, an embodiment of the present application provides a data transmission apparatus, the apparatus being arranged in a terminal, and the apparatus comprising:
[0044] a sending unit configured to send terminal information to a server, so that the server determines a signature algorithm corresponding to the terminal information based on a preset correspondence relationship, wherein the terminal information is used by the server to determine the corresponding signature algorithm, and the preset correspondence relationship represents a correspondence relationship between terminal information and a signature algorithm;
[0045] a first receiving unit configured to receive algorithm information sent by the server, wherein the algorithm information indicates a signature algorithm corresponding to the terminal information;
[0046] a first determining unit configured to determine an original request of the terminal, wherein the original request represents a request before signature according to the signature algorithm;
[0047] a generating unit configured to sign the original request according to the signature algorithm, to generate a target request, wherein the target request represents a request after signature according to the signature algorithm, and the target request is used for data transmission between the terminal and the server.
[0048] In one possible implementation, the signature algorithm is used to indicate an algorithm for generating a signature value of the original request; and
[0049] the signing the original request according to the signature algorithm comprises:
[0050] generating a signature value of the original request according to the signature algorithm;
[0051] adding the signature value to the original request to sign the original request.
[0052] In one possible implementation, the terminal information further comprises an application version of a target application of the terminal, and the target application is an application installed in the terminal; and
[0053] the adding the signature value to the original request to sign the original request comprises:
[0054] add the signature value and the application version to the original request to sign the original request.
[0055] In a possible implementation, the algorithm information is included in configuration information sent by the server, and the configuration information is used to configure the target application.
[0056] In a possible implementation, the signature value includes a field value of a signature field, and the signature algorithm is used to indicate an algorithm for processing the field value.
[0057] The signature value of the original request is generated according to the signature algorithm, and the signature value includes a field value of a signature field.
[0058] The field value is processed according to the signature algorithm to obtain a first processing result.
[0059] The signature value of the original request is generated based on the first processing result.
[0060] In a possible implementation, the signature value includes a random number, and the signature algorithm is used to indicate an algorithm for processing the random number.
[0061] The signature value of the original request is generated according to the signature algorithm, and the signature value includes a random number.
[0062] The random number is processed according to the signature algorithm to obtain a second processing result.
[0063] The signature value of the original request is generated based on the second processing result.
[0064] In a possible implementation, the original request is signed according to the signature algorithm, and the signing includes:
[0065] The original request, the signature value of the original request, and an application version of a target application are spliced according to a splicing order indicated by the signature algorithm to sign the original request.
[0066] The target application is an application installed on the terminal, and the splicing order indicates an order of splicing the original request, the signature value of the original request, and the target application.
[0067] In a fourth aspect, an embodiment of the present application provides a verification device, and the device is arranged on a server. The device includes:
[0068] A second receiving unit is configured to receive a target request sent by a terminal.
[0069] a second determining unit, configured to determine whether the target request is generated by using the target method, to obtain discrimination information, wherein the target method is the data transmission method described in any of the above embodiments, and the discrimination information indicates that the initial request is the target request;
[0070] a third determining unit, configured to determine whether the terminal is verified based on the discrimination information.
[0071] In one possible implementation, when the target method indicates that the target request is obtained by splicing the original request, a signature value and an application version according to the signature algorithm, the determining whether the target request is generated by using the target method includes:
[0072] determining whether the target request contains target information, wherein the target information includes the signature value and the application version;
[0073] determining whether the target request is generated by using the target method based on whether the target request contains the target information.
[0074] In one possible implementation, the determining whether the target request is generated by using the target method based on whether the target request contains the target information includes:
[0075] when the target request does not contain the target information, determining that the target request is not generated by using the target method;
[0076] when the target request contains the target information, performing the following steps:
[0077] determining algorithm information matched with the application version in the target request, wherein the algorithm information indicates the signature algorithm;
[0078] determining the original request in the target request;
[0079] generating a signature value of the original request in the target request according to the signature algorithm indicated by the algorithm information matched with the application version in the target request, to obtain a target signature value;
[0080] determining whether the target request is generated by using the target method based on the target signature value and the signature value in the target request.
[0081] In a fifth aspect, an embodiment of the present application provides an electronic device, including:
[0082] a memory, configured to store a computer program;
[0083] The processor is configured to execute a computer program stored in the memory, and the computer program, when executed, implements the method of any one of the embodiments of the first aspect or the second aspect.
[0084] In a sixth aspect, an embodiment of the present application provides a computer readable storage medium, which stores a computer program, and the computer program, when executed by a processor, implements the method of any one of the embodiments of the first aspect or the second aspect.
[0085] In a seventh aspect, an embodiment of the present application provides a computer program product, which includes computer readable code, and when the computer readable code is run on a device, the processor in the device implements the method of any one of the embodiments of the first aspect or the second aspect.
[0086] The data transmission method provided by the embodiments of the present application is applied to a terminal, and the method can send terminal information to a server, so that the server determines a signature algorithm corresponding to the terminal information based on a preset correspondence relationship, wherein the terminal information is used by the server to determine the corresponding signature algorithm, and the preset correspondence relationship represents the correspondence relationship between the terminal information and the signature algorithm. Then, algorithm information sent by the server is received, wherein the algorithm information represents the signature algorithm corresponding to the terminal information. Then, an original request of the terminal is determined, wherein the original request represents a request before signature according to the signature algorithm. Then, the original request is signed according to the signature algorithm to generate a target request, wherein the target request represents a request after signature according to the signature algorithm, and the target request is used for data transmission between the terminal and the server. Therefore, the server can send algorithm information matched with the terminal information of the terminal to the terminal, so as to dynamically determine the signature algorithm of different terminals, and then different terminals can use different signature algorithms to sign the request, so as to generate the target request. In this way, compared with using a single fixed static signature algorithm, the probability of data being stolen or counterfeited can be reduced. BRIEF DESCRIPTION OF DRAWINGS
[0087] The accompanying drawings, which are incorporated herein and form part of the specification, illustrate embodiments consistent with the present application and, together with the description, further serve to explain the principles of the application.
[0088] In order to more clearly illustrate the technical solutions of the embodiments of the present application or the prior art, the accompanying drawings needed to be used in the embodiments or prior art description will be briefly introduced as follows. Obviously, for those skilled in the art, other drawings can also be obtained from these drawings without any creative effort.
[0089] One or more embodiments are illustrated by way of example in the drawings and described herein in connection with the enumerated embodiments. These embodiments are not intended to limit the scope of the application, but rather, the intent is to cover all modification and alternative embodiments falling within the scope of the claims. Various
[0090] Figure 1 A flowchart of a data transmission method according to an embodiment of the present application;
[0091] Figure 2 A flowchart of another data transmission method according to an embodiment of the present application;
[0092] Figure 3 A flowchart of a verification method according to an embodiment of the present application;
[0093] Figure 4 A structural diagram of a data transmission apparatus according to an embodiment of the present application;
[0094] Figure 5 A structural diagram of a verification apparatus according to an embodiment of the present application;
[0095] Figure 6 A structural diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0096] Various exemplary embodiments of the present application will now be described in detail with reference to the accompanying drawings. The described embodiments are merely some embodiments of the present application and other embodiments can be made without departing from the scope of the present application. It should be noted that the relative arrangement of the components and steps, numerical expressions, and numerical values set forth in the embodiments are not intended to limit the scope of the present application unless otherwise specifically stated.
[0097] Those skilled in the art can understand that the terms "first", "second", and the like in the embodiments of the present application are merely used to distinguish different steps, devices, or modules, and do not represent any specific technical meaning, nor represent a logical sequence between them.
[0098] It should also be understood that "a plurality of" in the present embodiments can mean two or more, and "at least one" can mean one, two, or more.
[0099] It should also be understood that for any component, data, or structure mentioned in the embodiments of the present application, one or more can be understood in general unless specifically limited or given a contrary implication from the context.
[0100] In addition, the term "and / or" in the present application is merely used to describe an associated relationship between associated objects, and can represent three relationships, for example, A and / or B can represent three cases of A alone, A and B together, and B alone. In addition, the character " / " in the present application generally represents an "or" relationship between the front and rear associated objects.
[0101] It should also be understood that the description of the various embodiments of the present application focuses on the differences between the various embodiments, and the same or similar parts can be referred to each other, and will not be described one by one for the sake of brevity.
[0102] The following description of at least one example embodiment is merely illustrative in nature and is in no way intended to limit the application or its application or use.
[0103] Techniques, methods, and equipment known to those of ordinary skill in the relevant art can not be discussed in detail, but should be considered as part of the specification when appropriate.
[0104] It should be noted that similar reference numbers and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further discussed in subsequent drawings.
[0105] It should be noted that the embodiments and features in the present application can be combined with each other without conflict, and for the sake of understanding the embodiments of the present application, the following will be described in detail with reference to the drawings and in combination with the embodiments. Obviously, the described embodiments are part of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor are within the scope of protection of the present application.
[0106] In order to solve the technical problems of easy data fraud or forgery in the prior art, the present application provides a data transmission method, which can reduce the probability of data fraud or forgery.
[0107] Figure 1 A flowchart of a data transmission method provided by an embodiment of the present application is shown. The method can be applied to one or more terminals such as smart phones, notebook computers, desktop computers, portable computers, etc. In addition, the execution subject of the method can be hardware or software. When the execution subject is hardware, the execution subject can be one or more of the terminals. For example, a single terminal can execute the method, or multiple terminals can cooperate with each other to execute the method. When the execution subject is software, the method can be implemented as multiple software or software modules, or as a single software or software module. No specific limitation is made here.
[0108] As shown in Figure 1 The method specifically comprises the following steps:
[0109] In step 101, terminal information is sent to a server, so that the server determines a signature algorithm corresponding to the terminal information based on a preset correspondence relationship, wherein the terminal information is used by the server to determine the corresponding signature algorithm, and the preset correspondence relationship represents a correspondence relationship between the terminal information and the signature algorithm.
[0110] In this embodiment, the terminal information can include at least one of the following information of the terminal: name, model, unique identifier.
[0111] The preset correspondence relationship can represent a correspondence relationship between the terminal information and the signature algorithm. For example, the unique identifier of each terminal can correspond to one signature algorithm. Different unique identifiers can correspond to different signature algorithms (but not necessarily). The correspondence relationship between the above-mentioned unique identifier and algorithm information can be stored and maintained via the above-mentioned server.
[0112] For another example, the application version of the target application installed on each terminal can correspond to one signature algorithm. Different application versions can correspond to different signature algorithms (but not necessarily). The correspondence relationship between the above-mentioned application version and signature algorithm can be stored and maintained via the above-mentioned server.
[0113] In step 102, algorithm information sent by the server is received, wherein the algorithm information represents a signature algorithm corresponding to the terminal information.
[0114] In this embodiment, the terminal can receive the algorithm information sent by the server.
[0115] The algorithm information represents a signature algorithm corresponding to the terminal information. For example, the algorithm information can represent at least one of the following signature algorithms: a generation mode of a signature value, a splicing position and order of a signature value, an original request and an application version, a processing mode of a field value, a processing mode of a random number, etc.
[0116] The above-mentioned signature value can be a signature value of the original request. For example, the signature value can be a result obtained by encrypting the field value in the original request (the encryption algorithm can be determined via the algorithm information), or the signature value can also be part of the characters in the result obtained by encrypting the field value in the original request.
[0117] The above-mentioned field value can be a value of a signature field. Generally, when the terminal and the server perform data transmission, the field value needs to be transmitted together.
[0118] The application version can represent a version number of an application installed or run by the terminal. Different application versions can correspond to different algorithm information, and the same application version can correspond to the same algorithm information.
[0119] The random number can be a result generated by using various random number generation algorithms. Generally, the field value enables data transmission between the terminal and the server, and can improve the security of data transmission.
[0120] In some cases, the random number can be a salt. The salt refers to inserting a specific string at an arbitrary fixed position of a password, so that the result of the hash does not match the hash result of the original password. This process is called "salting".
[0121] Generally, when a field is subjected to hash processing (such as MD5), a hash value is generated, and the hash value generally cannot obtain the original field by a specific algorithm. However, in some cases, by searching the MD5 value in the table, it is possible to find the real field content corresponding to the hash value in a very short time.
[0122] The salted hash value can reduce the risk of data leakage due to user data theft. Even if the original content corresponding to the hash value is found, because of the salt, the inserted string disturbs the real password, so that the probability of obtaining the real password is greatly reduced.
[0123] In addition, in some cases, the algorithm information can be synchronized with other configuration information of the terminal and issued, to avoid being cracked and identified. Of course, the specific rule content and format are not limited, for example, data in JSON (JavaScript Object Notation) format: {“v”:2,“d”:“a,b,d,f”,“s”:“xy7n”}, or other formats such as XML (Extensible Markup Language) data.
[0124] Step 103, determining the original request of the terminal.
[0125] In this embodiment, the original request represents a request before signing according to the signature algorithm. The original request can be an original request generated by the terminal. As an example, the original request can be “https: / / hostname.com / path?q=v1&d=v2&a=3&f=4&b=a”.
[0126] Wherein, a, b, d, f represent signature fields, and the field values corresponding thereto are 3, a, v2, and 4 respectively.
[0127] Step 104, signing the original request according to the signature algorithm to generate a target request, wherein the target request represents a request signed according to the signature algorithm, and the target request is used for data transmission between the terminal and the server.
[0128] In this embodiment, in the case where the original request is "https: / / hostname.com / path?q=v1&d=v2&a=3&f=4&b=a", the above step 104 can be performed in the following manner:
[0129] First, the field values corresponding to the signature fields a, b, d, and f in the original request are extracted, which are 3, a, v2, and 4 respectively. Then, "3av24" is formed according to the rule order (which can be determined by the signature algorithm), and then "3av24-xy7n" is obtained by adding the salt (the position and order of the concatenation can be determined by the signature algorithm). Then, the MD5 value is calculated (the processing method can be determined by the signature algorithm), which is "8b0668e981af56bffc48402c24b5426e". Then, the 8th to 15th characters (the position and number can be determined by the signature algorithm) are extracted to obtain the final signature value "81af56b". Here, the MD5 value can also be calculated using other hash algorithms.
[0130] Second, the generated signature value and the corresponding application version are added to the original request (the adding method can be determined by the signature algorithm) to obtain the target request "https: / / hostname.com / path?q=v1&d=v2&a=3&f=4&b=a&s=81af56b&v=2".
[0131] In some optional implementations of this embodiment, the original request can be signed according to the signature algorithm in the following manner:
[0132] According to the concatenation order indicated by the signature algorithm, the original request, the signature value of the original request, and the application version of the target application are concatenated to sign the original request.
[0133] The target application is an application installed on the terminal. The concatenation order represents the order of concatenating the original request, the signature value of the original request, and the target application.
[0134] Here, the signature algorithm described above can indicate how the original request, signature value, and application version are concatenated. For example, the signature algorithm can indicate concatenation of the original request, signature value, and application version in that order to obtain the target request. As another example, the signature algorithm can also indicate concatenation of the original request, application version, and signature value in that order to obtain the target request.
[0135] It is understandable that, among the above optional implementation methods, different terminals can use different concatenation methods to concatenate the original request, signature value, and application version to obtain the target request. This further reduces the probability of data theft or forgery. Furthermore, the concatenation algorithms described above are relatively simple, reducing the probability of terminal-induced performance issues, and processing time typically does not increase significantly.
[0136] The data transmission method provided in this application is applied to a terminal. The method receives algorithm information sent by a server, where the algorithm information represents a signature algorithm corresponding to the terminal information. Then, it determines the terminal's original request, which represents the request before signing according to the signature algorithm. Next, it signs the original request according to the signature algorithm to generate a target request, where the target request represents the request after signing according to the signature algorithm. The target request is used for data transmission between the terminal and the server. Thus, the server can send algorithm information matching the terminal information to the terminal to dynamically determine the signature algorithm for different terminals. This allows different terminals to use different signature algorithms to sign requests and generate target requests. Compared to using a single, fixed, static signature algorithm, this reduces the probability of data theft or forgery.
[0137] Figure 2 This is a flowchart illustrating another data transmission method provided in an embodiment of this application. This method can be applied to one or more terminals such as smartphones, laptops, desktop computers, and portable computers. Furthermore, the executing entity of this method can be hardware or software. When the executing entity is hardware, it can be one or more of the aforementioned terminals. For example, a single terminal can execute this method, or multiple terminals can cooperate with each other to execute this method. When the executing entity is software, this method can be implemented as multiple software programs or software modules, or as a single software program or software module. No specific limitations are made here.
[0138] like Figure 2 As shown, the method specifically includes:
[0139] In step 201, terminal information is sent to a server, so that the server determines a signature algorithm corresponding to the terminal information based on a preset correspondence relationship, wherein the terminal information is used by the server to determine the corresponding signature algorithm, and the preset correspondence relationship represents a correspondence relationship between terminal information and a signature algorithm.
[0140] In this embodiment, step 201 is basically the same as step 101 in the corresponding embodiment, and will not be described here again. Figure 1
[0141] In step 202, algorithm information sent by the server is received, wherein the algorithm information represents a signature algorithm corresponding to the terminal information.
[0142] In this embodiment, step 202 is basically the same as step 102 in the corresponding embodiment, and will not be described here again. Figure 1
[0143] In step 203, an original request of the terminal is determined, wherein the original request represents a request before signature according to the signature algorithm.
[0144] In this embodiment, step 203 is basically the same as step 103 in the corresponding embodiment, and will not be described here again. Figure 1
[0145] In step 204, a signature value of the original request is generated according to the signature algorithm.
[0146] In this embodiment, the signature algorithm can indicate a generation manner of the signature value. As an example, the signature algorithm can indicate that a field value in the original request and a salt are sequentially spliced, and then the spliced result is encrypted, and then characters at a predetermined position in the encrypted result are intercepted, so as to obtain the signature value of the original request. Wherein each signature algorithm can (but not necessarily) correspond to a predetermined position, and different signature algorithms can correspond to different predetermined positions.
[0147] In step 205, the signature value is added to the original request to sign the original request, wherein the target request represents a request after signature according to the signature algorithm, and the target request is used for data transmission between the terminal and the server.
[0148] In this embodiment, the signature value can be added to the original request in various ways to sign the original request.
[0149] As an example, the signature value and the original request can be spliced to sign the original request, so as to take the spliced result as the target request.
[0150] As a further example, the salt, the signature value and the original request can also be concatenated to sign the original request, and the concatenation result is taken as the target request.
[0151] As a further example, the signature value can also be encrypted first (the encryption algorithm can be determined by the signature algorithm), and then the encryption result and the original request are concatenated to sign the original request, and the concatenation result is taken as the target request.
[0152] In some optional implementations of the embodiment, the terminal information further includes an application version of a target application of the terminal, the target application being an application installed on the terminal.
[0153] The application version can represent a version number of an application installed or run by the terminal. Different application versions can correspond to different algorithm information, and the same application version can correspond to the same algorithm information.
[0154] On this basis, the signature value can be added to the original request to sign the original request in the following manner:
[0155] The signature value and the application version are added to the original request to sign the original request.
[0156] As an example, the signature value, the original request and the application version can be concatenated to sign the original request, and the concatenation result is taken as the target request. The concatenation order can be determined via the algorithm information (indicating the signature algorithm).
[0157] As a further example, the signature value can also be encrypted, and then the encryption result, the original request and the application version are concatenated to sign the original request, and the concatenation result is taken as the target request. The concatenation order and the encryption manner can be determined via the algorithm information (indicating the signature algorithm).
[0158] It can be understood that in the above optional implementations, the target request can be generated based on the signature value, the original request and the application version, so that the probability of data being stolen or counterfeited can be further reduced.
[0159] In some application scenarios of the above optional implementations, the algorithm information is contained in configuration information sent by the server, and the configuration information is used to configure the target application.
[0160] It can be understood that in the above application scenarios, the algorithm information can be synchronously issued with other configuration information of the terminal, so as to avoid being cracked and identified.
[0161] In some application scenarios of the optional implementation, before the receiving of the algorithm information sent by the server, the application version of the target application of the terminal can be further sent to the server.
[0162] The target application can be any application installed on the terminal. For example, the target application can be a video playing platform, a shopping software, etc.
[0163] Here, after the terminal starts the target application, the terminal can send the application version of the target application installed on the terminal to the server.
[0164] On this basis, the algorithm information sent by the server can be received in the following manner:
[0165] The algorithm information sent by the server and matched with the application version is received.
[0166] Here, after the server receives the application version sent by the terminal, the server can determine the algorithm information matched with the application version based on the application version and the algorithm information stored and maintained by the server. Then, the server can send the algorithm information to the terminal.
[0167] It can be understood that in the above application scenario, the server can send the algorithm information matched with the application version of the terminal to the terminal, so that terminals with different application versions can use different signature algorithms to generate target requests, thereby only the correspondence between different application versions and algorithm information needs to be maintained, and the data maintenance cost is reduced.
[0168] In some optional implementations of the embodiment, the signature value includes a field value of a signature field, and the signature algorithm is used to indicate an algorithm for processing the field value.
[0169] On this basis, the signature value of the original request can be generated according to the signature algorithm in the following manner:
[0170] First, the field value is processed according to the signature algorithm to obtain a first processing result.
[0171] The signature algorithm can represent a processing manner of the field value. For example, the signature algorithm can represent an MD5 algorithm.
[0172] The first processing result can represent a result of processing the field value according to the signature algorithm.
[0173] Second, the signature value of the original request is generated based on the first processing result.
[0174] Here, the first processing result can be directly determined as the signature value of the original request. Alternatively, a character at a predetermined position in the first processing result can be determined as the signature value of the original request.
[0175] It can be understood that in the optional implementation described above, the field value of the signature field in the algorithm information can be processed according to the signature algorithm to generate the signature value of the original request, thereby further reducing the probability of data being stolen or forged.
[0176] In some optional implementations of the embodiment, the signature value includes a random number, and the signature algorithm is used to indicate an algorithm for processing the random number.
[0177] On this basis, the signature value of the original request can be generated according to the signature algorithm in the following manner:
[0178] First, the random number is processed according to the signature algorithm to obtain a second processing result.
[0179] The signature algorithm can represent a processing manner of the random number (for example, salt). For example, the signature algorithm can represent an MD5 algorithm.
[0180] The second processing result can represent a result of processing the random number according to the signature algorithm.
[0181] Second, the signature value of the original request is generated based on the second processing result.
[0182] Here, the second processing result can be directly determined as the signature value of the original request. Alternatively, a character at a predetermined position in the second processing result can be determined as the signature value of the original request.
[0183] It can be understood that in the optional implementation described above, the field value of the signature field in the algorithm information can be processed according to the signature algorithm to generate the signature value of the original request, thereby further reducing the probability of data being stolen or forged.
[0184] It should be noted that in addition to the above-described content, the embodiment can also include Figure 1 the corresponding technical features described in the corresponding embodiments, thereby achieving Figure 1 the technical effects of the verification method shown, and specific reference is made to Figure 1 the related description, which will not be repeated here for brevity.
[0185] The data transmission method provided by the embodiment can generate a signature value of an original request according to a signature algorithm matched with a terminal, and then generate a target request. Thus, the probability of data being stolen or forged can be further reduced.
[0186] Figure 3 A flowchart of a verification method provided by an embodiment of the present application is shown. The method can be applied on a server. In addition, the execution subject of the method can be hardware or software. When the execution subject is hardware, the execution subject can be one or more servers. For example, a single server can execute the method, or multiple servers can cooperate with each other to execute the method. When the execution subject is software, the method can be implemented as multiple software or software modules, or as a single software or software module. No specific limitation is imposed herein.
[0187] As shown in Figure 3 , the method specifically includes the following steps.
[0188] Step 301: receiving a target request sent by a terminal.
[0189] In this embodiment, the target request can be any request sent by any terminal. The target request can be a target request generated by the data transmission method described in any of the above embodiments, or can be another target request.
[0190] Step 302: determining whether the target request is generated by a target method, to obtain determination information, wherein the target method is the data transmission method described in any of the above embodiments, and the determination information indicates that the initial request is for the target request.
[0191] In this embodiment, the determination information can indicate whether the target request is generated by the target method.
[0192] Here, the target request can be determined to be generated by the target method in multiple ways. For details, please refer to the description below, which is not described herein.
[0193] Step 303: determining whether the terminal passes verification based on the determination information.
[0194] In this embodiment, when the determination information indicates that the target request is generated by the target method, it can be determined that the terminal passes verification. When the determination information indicates that the target request is not generated by the target method, it can be determined that the terminal does not pass verification.
[0195] In some optional implementations of this embodiment, when the target method indicates that the target request is spliced from the original request, a signature value, and an application version according to the signature algorithm, the target request can be determined to be generated by the target method in the following way.
[0196] First, it is determined whether the target request contains target information.
[0197] The target information includes a signature value and an application version. In other words, it is determined whether the target request contains the signature value, and it is determined whether the target request contains the application version.
[0198] The signature value can be a signature value of the original request. For example, the signature value can be a result of encrypting a field value in the original request, or the signature value can be part of the result of encrypting the field value in the original request.
[0199] The application version can represent a version number of an application installed or running on the terminal. Different application versions can correspond to different algorithm information, and the same application version can correspond to the same algorithm information.
[0200] As an example, in the process of generating the target request using the above data transmission method, a predetermined character can be used to identify the signature value and the application version. Thus, it can be determined whether the target request contains the target information by determining whether the target request sent by the terminal received in step 301 contains the above predetermined character.
[0201] Specifically, in the case where the target request is "https: / / hostname.com / path? q=v1&d=v2&a=3&f=4&b=a&s=81af56b&v=2", if "s" is used to identify the signature value and "v" is used to identify the application version, it can be determined that the signature value is "81af56b" and the application version is "2". As can be seen, in the above example, the target request contains the target information.
[0202] Second, based on whether the target request contains the target information, it is determined whether the target request is generated using the target method.
[0203] In some application scenarios of the above optional implementation, the following method can be used to determine whether the target request is generated using the target method based on whether the target request contains the target information:
[0204] Case one, in the case where the target request does not contain the target information, it is determined that the target request is not generated using the target method.
[0205] In some cases, in the case where the target request does not contain the target information (for example, the target request does not contain the signature value, or the target request does not contain the application version), it can be further determined that the target request is a stolen request.
[0206] Case two, in the case where the target request contains the target information, the following steps (including the first step to the fourth step) are performed:
[0207] In a first step, algorithm information matching the application version in the target request is determined.
[0208] The algorithm information indicates a signature algorithm.
[0209] The server can maintain a matching relationship between all application versions and algorithm information.
[0210] The application version can represent the version number of an application installed or run by the terminal. Different application versions can correspond to different algorithm information, and the same application version can correspond to the same algorithm information.
[0211] The algorithm information can indicate at least one of the following signature algorithms: a generation method of a signature value, a splicing position, order of a signature value, an original request, and an application version, a processing method of a field value, a processing method of a random number, etc.
[0212] In a second step, the original request in the target request is determined.
[0213] The target request can be parsed to determine the original request in the target request.
[0214] In a third step, a signature value of the original request in the target request is generated according to a signature algorithm indicated by the algorithm information matching the application version in the target request, to obtain a target signature value.
[0215] The target signature value can be a signature value of the original request in the target request generated according to a signature algorithm indicated by the algorithm information matching the application version in the target request.
[0216] In the case where the target request is "https: / / hostname.com / path?q=v1&d=v2&a=3&f=4&b=a&s=81af56b&v=2", the signature algorithm can represent a signature value of the original request in the target request generated in the following manner:
[0217] First, it is determined that the original request in the above target request is "https: / / hostname.com / path?q=v1&d=v2&a=3&f=4&b=a".
[0218] After that, the signature fields a, b, d, f in the original request are extracted, and the corresponding field values 3, a, v2, 4 in the original request are extracted. Then, "3av24" is spliced according to the rule order (the order can be determined by the signature algorithm), and then the salt is added to become "3av24-xy7n" (the splicing position and order can be determined by the signature algorithm), and then the MD5 value is calculated (the processing method can be determined by the signature algorithm) to be: "8b0668e981af56bffc48402c24b5426e", and then the characters 8-15 (the position and number can be determined by the signature algorithm) are intercepted to obtain the final signature value (that is, the target signature value): "81af56b". Here, the MD5 value can also be calculated by using other hash algorithms.
[0219] In the fourth step, based on the target signature value and the signature value in the target request, it is determined whether the target request is generated by using the target method.
[0220] As an example, in the case where the target signature value and the signature value in the target request are consistent, it can be determined that the target request is generated by using the target method; in the case where the target signature value and the signature value in the target request are inconsistent, it can be determined that the target request is not generated by using the target method.
[0221] In some cases, in the case where the target signature value and the signature value in the target request are inconsistent, it can be further determined that the target request is a fake request.
[0222] It can be understood that in the above application scenarios, the server can generate the signature value of the original request in the request sent by the terminal according to the signature algorithm indicated by the algorithm information matched with the application version, and compare it with the signature value received in the request, so as to determine whether the target request is generated by using the target method, and determine whether the terminal passes the verification, so that the probability of data being stolen or forged can be further reduced, and the security of data transmission can be improved.
[0223] The verification method provided by the embodiments of the present application is applied to the server, and the method can receive a target request sent by a terminal, then determine whether the target request is generated by using a target method to obtain discrimination information, wherein the target method is the data transmission method described in any of the above embodiments, and the discrimination information represents that the initial request is the target request, and then based on the discrimination information, it is determined whether the terminal passes the verification. Therefore, after the server receives the target request sent by the terminal, it can be determined whether the target request is generated by using the signature algorithm matched with the terminal, and then the target request is verified, so that the accuracy of terminal verification can be improved.
[0224] The following will exemplarily illustrate the embodiments of the present application, but it should be noted that the embodiments of the present application can have the features described below, but the following description does not constitute a limitation on the protection scope of the embodiments of the present application.
[0225] When the client (i.e. the target application described above) transmits data to the server, an important challenge is to prevent the data from being stolen or forged, i.e. to forge the request of a real client or tamper with the key information. For example, for an advertising service, by requesting an advertising service interface, the billing link of the advertisement can be extracted from the response data, and then the link is directly used to initiate a billing request, which will have a serious adverse effect on the advertising service. Currently, the commonly used methods include encrypting the response data as a whole or directly MD5 processing the requested data when the client sends the data request, but these methods are easy to find and have the risk of being cracked, and at the same time, the encryption method may cause performance problems when processing a large amount of data, because it will significantly increase the processing time.
[0226] Therefore, in order to neither consume performance nor improve cracking difficulty, a request signature method is proposed. That is, a rule (i.e. the signature algorithm described above) in a dynamic signature algorithm table is first issued from the server, which corresponds to the version number (i.e. the application version described above) of the client. The content of the dynamic rule table includes the version number, which fields participate in the signature, and the salt. For example, 2_a, b, d, f_xy7n, then the client can find the signature algorithm specified for the content (i.e. the algorithm information matched with the application version "2") by searching the rule table when sending the specific data content to the server, then extract the content of the specified field from the content according to the rule, and splice it in the order of the field and add the salt to produce new content, and then MD5 process the content, then take one segment as a digital signature and add it to the original content, and at the same time, the algorithm version number can also be added to the content. Then the server receives the content to determine whether there is a signature field, and checks according to the version. In this way, it is determined whether the content comes from a real client to achieve verification.
[0227] Specifically, the method includes the following steps:
[0228] 1. After the client starts, the server issues dynamic rule information (i.e. the above algorithm information), including version and rules, for example: the issued content is 2_a,b,d,f_xy7n, then the first "2" represents the version number of the current rule, "a,b,d,f" represents the field name that needs to participate in signature, and "xy7n" represents the salt (i.e. the above random number) of the encryption algorithm. This information can be issued synchronously with other configuration information of the client to avoid being cracked and identified. Of course, the specific rule content and format can also use data in JSON format: { "v": 2, "d": "a,b,d,f", "s": "xy7n"}, or other forms which are not limited here.
[0229] 2. When the client initiates a request to the server, the above signature algorithm information is read, and then the request URL (universal resource locator) is dynamically signed, for example: the original URL (i.e. the above original request) of the request is: https: / / hostname.com / path?q=v1&d=v2&a=3&f=4&b=a. Then the algorithm information is generated according to the read rule table as follows:
[0230] a. First, extract the parameter values (i.e. the above field values) corresponding to "a,b,d,f" in the above URL, which are "3", "a", "v2", and "4" respectively, then concatenate them in the order of the rules to form "3av24", and then add the salt to become "3av24-xy7n", and then calculate the MD5 value as: "8b0668e981af56bffc48402c24b5426e", and then intercept the characters from 8 to 15 to obtain the final signature value: "81af56b". Here, the MD5 value can also be calculated using other hash algorithms.
[0231] b. Fill the generated signature value and the corresponding rule version number into the original URL to obtain https: / / hostname.com / path?q=v1&d=v2&a=3&f=4&b=a&s=81af56b&v=2, which is the above target request.
[0232] 3. After the server receives the client request, the corresponding rule is located according to the version number, and then the signature is calculated according to the above steps of the client, and then it is judged whether it is consistent with the request. If it is not consistent, it is judged that the request is fake, and if there is no signature or version information in the request, it is determined as a stolen card.
[0233] It should be noted that in addition to the above, the present embodiment can also include the technical features described in the above embodiments, and further achieve the technical effects of the above data transmission method or verification method. For brevity, the above description is not repeated here.
[0234] The data transmission method or verification method provided by the embodiments of the present application has strong concealment. The signature field is added to the URL, and the signature algorithm information can be disguised as ordinary configuration information and is not easy to locate. In addition, the method has high security, and the rules can be upgraded and iterated to effectively avoid rule leakage. In terms of efficiency, the signature algorithm has high execution efficiency and no performance problems. In terms of cracking difficulty, request theft and forgery can be reduced or even prevented, and adverse effects on online services can be reduced or even avoided.
[0235] Figure 4 A structural schematic diagram of a data transmission device provided by the embodiments of the present application. The device is arranged in a terminal and specifically includes:
[0236] The sending unit 401 is configured to send terminal information to a server, so that the server determines a signature algorithm corresponding to the terminal information based on a preset correspondence relationship. The terminal information is used by the server to determine the corresponding signature algorithm, and the preset correspondence relationship represents the correspondence between the terminal information and the signature algorithm.
[0237] The first receiving unit 402 is configured to receive algorithm information sent by the server, wherein the algorithm information represents a signature algorithm corresponding to the terminal information.
[0238] The first determining unit 403 is configured to determine an original request of the terminal, wherein the original request represents a request before signature according to the signature algorithm.
[0239] The generating unit 404 is configured to sign the original request according to the signature algorithm to generate a target request, wherein the target request represents a request after signature according to the signature algorithm, and the target request is used for data transmission between the terminal and the server.
[0240] In one possible implementation, the signing the original request according to the signature algorithm includes:
[0241] Generating a signature value of the original request according to the signature algorithm;
[0242] Adding the signature value to the original request to sign the original request.
[0243] In a possible implementation, the terminal information further includes an application version of a target application of the terminal, the target application being an application installed on the terminal; and
[0244] The adding of the signature value to the original request to sign the original request includes:
[0245] The adding of the signature value and the application version to the original request to sign the original request.
[0246] In a possible implementation, before the receiving of the algorithm information sent by the server, the apparatus further includes:
[0247] A sending unit (not shown in the figure) configured to send, to a server, an application version of a target application of the terminal, the target application being an application installed on the terminal; and
[0248] The receiving of the algorithm information sent by the server includes:
[0249] Receiving algorithm information sent by a server and matching the application version.
[0250] In a possible implementation, the algorithm information is contained in configuration information sent by the server, wherein the configuration information is used to configure the target application.
[0251] In a possible implementation, the signature value includes a field value of a signature field, and the signature algorithm is used to indicate an algorithm for processing the field value; and
[0252] The generating of the signature value of the original request according to the signature algorithm includes:
[0253] Processing the field value according to the signature algorithm to obtain a first processing result;
[0254] Generating the signature value of the original request based on the first processing result.
[0255] In a possible implementation, the signature value includes a random number, and the signature algorithm is used to indicate an algorithm for processing the random number; and
[0256] The generating of the signature value of the original request according to the signature algorithm includes:
[0257] Processing the random number according to the signature algorithm to obtain a second processing result;
[0258] Generating the signature value of the original request based on the second processing result.
[0259] 8. In one possible implementation, signing the original request according to the signature algorithm includes:
[0260] The original request, the signature value of the original request, and the application version of the target application are concatenated according to the concatenation order indicated by the signature algorithm in order to sign the original request.
[0261] Wherein, the target application is the application installed on the terminal, and the splicing order refers to the order in which the original request, the signature value of the original request, and the target application are spliced.
[0262] The data transmission device provided in this embodiment can be as follows: Figure 4 The data transmission device shown can execute all the steps of the data transmission methods described above, thereby achieving the technical effects of the data transmission methods described above. For details, please refer to the relevant descriptions above. For the sake of brevity, further details are not provided here.
[0263] Figure 5 This is a schematic diagram of a verification device provided in an embodiment of this application. The device is located on a server and specifically includes:
[0264] The second receiving unit 411 is configured to receive a target request sent by the terminal.
[0265] The second determining unit 412 is configured to determine whether the target request is generated using a target method and obtain discrimination information, wherein the target method is the data transmission method described in any of the above embodiments, and the discrimination information indicates that the initial request is the target request;
[0266] The third determining unit 413 is configured to determine whether the terminal has passed verification based on the discrimination information.
[0267] In one possible implementation, when the target method represents the target request being constructed by concatenating the original request, signature value, and application version according to the signature algorithm, determining whether the target request was generated using the target method includes:
[0268] Determine whether the target request contains target information, wherein the target information includes: a signature value and an application version;
[0269] Based on whether the target request contains the target information, determine whether the target request was generated using the target assembly method.
[0270] In one possible implementation, determining whether the target request was generated using the target method based on whether the target request contains the target information includes:
[0271] In a case where the target request does not contain the target information, it is determined that the target request is not generated by the target device;
[0272] In a case where the target request contains the target information, the following steps are performed:
[0273] determining algorithm information matched with the application version in the target request, wherein the algorithm information indicates a signature algorithm;
[0274] determining an original request in the target request;
[0275] generating a signature value of the original request in the target request according to the signature algorithm indicated by the algorithm information matched with the application version in the target request, to obtain a target signature value;
[0276] determining whether the target request is generated by the target device based on the target signature value and the signature value in the target request.
[0277] The verification device provided in the embodiment can be a verification device as shown in Figure 5 , can perform all steps of each verification method described above, and further achieve the technical effects of each verification method described above. For brevity, the related description is not repeated here.
[0278] Figure 6 A structural schematic diagram of an electronic device provided in the embodiment of the present application is shown in Figure 6 The electronic device 500 shown in the figure includes at least one processor 501, a memory 502, at least one network interface 504 and other user interfaces 503. Each component in the electronic device 500 is coupled together through a bus system 505. It can be understood that the bus system 505 is used to realize the connection and communication between the components. In addition to the data bus, the bus system 505 also includes a power bus, a control bus and a status signal bus. However, for the purpose of clear illustration, all kinds of buses are marked as the bus system 505 in the figure. Figure 6
[0279] The user interface 503 can include a display, a keyboard or a clicking device (for example, a mouse, a trackball, a touchpad or a touch screen, etc.).
[0280] It is to be understood that the memory 502 in the embodiments of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (Read-Only Memory, ROM), a programmable read-only memory (Programmable ROM, PROM), an erasable programmable read-only memory (Erasable PROM, EPROM), an electrically erasable programmable read-only memory (Electrically EPROM, EEPROM) or a flash memory. The volatile memory can be a random access memory (Random Access Memory, RAM) used as an external cache. By way of example, but not by way of limitation, many forms of RAM are available, such as static random access memory (Static RAM, SRAM), dynamic random access memory (Dynamic RAM, DRAM), synchronous dynamic random access memory (Synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (Double Data Rate SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (Enhanced SDRAM, ESDRAM), synchronous link dynamic random access memory (Synch link DRAM, SLDRAM) and direct memory bus random access memory (Direct Rambus RAM, DRRAM). The memory 502 described herein is intended to include, but not limited to, these and any other suitable types of memory.
[0281] In some embodiments, the memory 502 stores the following elements, executable units or data structures, or a subset of them, or an extended set of them: an operating system 5021 and an application program 5022.
[0282] The operating system 5021 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks. The application program 5022 includes various application programs, such as a media player (Media Player), a browser (Browser), etc., for implementing various application services. The program for implementing the method of the embodiments of the present application can be included in the application program 5022.
[0283] In the present embodiment, by calling the program or instruction stored in the memory 502, specifically, the program or instruction stored in the application program 5022, the processor 501 is used to execute the method steps provided by each method embodiment, for example, including:
[0284] sending terminal information to a server, so that the server determines a signature algorithm corresponding to the terminal information based on a preset correspondence relationship, wherein the terminal information is used by the server to determine the corresponding signature algorithm, and the preset correspondence relationship represents a correspondence relationship between terminal information and a signature algorithm; receiving algorithm information sent by the server, wherein the algorithm information represents a signature algorithm corresponding to the terminal information;
[0285] determining an original request of the terminal, wherein the original request represents a request before signature according to the signature algorithm;
[0286] signing the original request according to the signature algorithm to generate a target request, wherein the target request represents a request after signature according to the signature algorithm, and the target request is used for data transmission between the terminal and the server.
[0287] or,
[0288] obtaining a target request sent by a terminal;
[0289] determining whether the target request is generated by a target method to obtain discrimination information, wherein the target method is the data transmission method described in any of the above embodiments, and the discrimination information represents that the initial request is the target request;
[0290] determining whether the terminal is verified based on the discrimination information.
[0291] The method disclosed by the embodiments of the present application can be applied to the processor 501 or implemented by the processor 501. The processor 501 can be an integrated circuit chip having a signal processing capability. In the implementation process, the steps of the method can be completed by an integrated logic circuit or an instruction in the form of software in the processor 501. The processor 501 described above can be a general processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in conjunction with the embodiments of the present application can be directly embodied as a hardware code processor for execution, or a combination of hardware and software units in the code processor for execution. The software unit can be located in a random access memory, a flash memory, a read only memory, a programmable read only memory or an electrically erasable programmable memory, a register or other mature storage medium in the art. The storage medium is located in the memory 502, and the processor 501 reads the information in the memory 502 and combines the hardware to complete the steps of the above method.
[0292] It can be understood that the embodiments described herein can be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), general purpose processors, controllers, micro-controllers, microprocessors, other electronic units designed to perform the functions described above for the present application, or a combination thereof.
[0293] For software implementation, the technology described herein can be implemented by means of the units described above for performing the functions described herein. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.
[0294] The electronic device provided in the embodiment can be an electronic device as shown in Figure 6 The electronic device provided in the embodiment can be an electronic device as shown in
[0295] The embodiment of the present application further provides a storage medium (computer readable storage medium). The storage medium stores one or more programs. The storage medium can include a volatile memory such as a random access memory, and / or a non-volatile memory such as a read-only memory, a flash memory, a hard disk, or a solid state disk. The storage medium can also include a combination of the above-mentioned memories.
[0296] The one or more programs stored in the storage medium can be executed by the one or more processors to implement the data transmission method executed at the electronic device side.
[0297] The processor is configured to execute the request signature program stored in the memory to implement the following steps of the data transmission method executed at the terminal side:
[0298] The terminal information is sent to a server, so that the server determines a signature algorithm corresponding to the terminal information based on a preset correspondence relationship. The terminal information is used by the server to determine the corresponding signature algorithm, and the preset correspondence relationship represents the correspondence between the terminal information and the signature algorithm.
[0299] Algorithm information sent by the server is received, and the algorithm information represents the signature algorithm corresponding to the terminal information.
[0300] The original request of the terminal is determined, and the original request represents the request before signature according to the signature algorithm.
[0301] The original request is signed according to the signature algorithm to generate a target request, and the target request represents the request after signature according to the signature algorithm. The target request is used for data transmission between the terminal and the server.
[0302] Or,
[0303] The processor is configured to execute the verification program stored in the memory to implement the following steps of the verification method executed at the server side:
[0304] The target request sent by the terminal is obtained.
[0305] determining whether the target request is generated by a target method, to obtain discrimination information, wherein the target method is the data transmission method described in any of the above embodiments, and the discrimination information indicates that the initial request is for the target request;
[0306] based on the discrimination information, determining whether the terminal is verified.
[0307] Those skilled in the art should further appreciate that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be realized in electronic hardware, computer software or a combination of both. In order to clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been described in general terms in the above description. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0308] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented in hardware, software executed by a processor, or a combination of both. The software modules can be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROMs, or any other form of storage medium known in the art.
[0309] It should be understood that the terms used herein are for the purpose of describing specific example embodiments only and are not intended to be limiting. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. The terms "comprises", "comprising", "includes", "including" and "has" are inclusive and therefore specify the presence of stated features, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, steps, operations, elements, components, and / or groups thereof. The method steps, processes, and operations described herein are not to be interpreted as necessarily requiring their performance in the specific order indicated, unless explicitly specified otherwise. It should also be understood that additional or alternative steps can be employed.
[0310] The foregoing is considered as illustrative only of the principles of the application. Numerous modifications and changes will readily occur to those skilled in the art, and it is intended to embrace all such modifications and changes that fall within the scope of the application. Accordingly, the application is not to be restricted in scope to the specific embodiments disclosed herein but is to be accorded the full scope that the principles and novel features request appropriately granted.
Claims
1. A data transmission method, characterized by, The method is applied to a terminal, and the method comprises: sending terminal information to a server, so that the server determines a signature algorithm corresponding to the terminal information based on a preset correspondence relationship, wherein the terminal information is used by the server to determine the corresponding signature algorithm, and the preset correspondence relationship represents a correspondence relationship between terminal information and a signature algorithm; receiving algorithm information sent by the server, wherein the algorithm information represents a signature algorithm corresponding to the terminal information; determining an original request of the terminal, wherein the original request represents a request before signature according to the signature algorithm, and the original request is a link for accessing a network resource, and the link contains multiple request parameters; signing the original request according to the signature algorithm to generate a target request, wherein the target request represents a request after signature according to the signature algorithm, and the target request is used for data transmission between the terminal and the server; wherein the signing the original request according to the signature algorithm to generate a target request comprises: determining a signature field from the multiple request parameters; splicing a field value of the signature field according to a rule defined by the signature algorithm to generate a to-be-signed string; combining the to-be-signed string with a random array to obtain a target string; performing calculation on the target string to generate a signature value; adding the signature value to the original request to form the target request.
2. The method of claim 1, wherein, The terminal information further comprises an application version of a target application of the terminal, and the target application is an application installed in the terminal. And The adding the signature value to the original request to sign the original request comprises: adding the signature value and the application version to the original request to sign the original request.
3. The method of claim 2, wherein, The algorithm information is contained in configuration information sent by the server, wherein the configuration information is used to configure the target application.
4. The method of claim 1, wherein, The signature value comprises a random number, and the signature algorithm is used to indicate an algorithm for processing the random number. And processing the random number according to the signature algorithm to obtain a second processing result; generating a signature value of the original request based on the second processing result.
5. The method of claim 1, wherein, The signing the original request according to the signature algorithm comprises: splicing the original request, a signature value of the original request and an application version of a target application according to a splicing order indicated by the signature algorithm to sign the original request; wherein the target application is an application installed in the terminal, and the splicing order represents an order of splicing the original request, the signature value of the original request and the target application.
6. A data transmission apparatus characterized by comprising: The device is arranged in a terminal, and the device comprises: a sending unit configured to send terminal information to a server, so that the server determines a signature algorithm corresponding to the terminal information based on a preset correspondence relationship, wherein the terminal information is used by the server to determine the corresponding signature algorithm, and the preset correspondence relationship represents a correspondence relationship between terminal information and a signature algorithm; The first receiving unit is configured to receive algorithm information sent by the server, wherein the algorithm information indicates a signature algorithm corresponding to the terminal information; The first determining unit is configured to determine an original request of the terminal, wherein the original request indicates a request before signature according to the signature algorithm, and the original request is a link for accessing a network resource, and the link contains multiple request parameters; The generating unit is configured to sign the original request according to the signature algorithm to generate a target request, wherein the target request indicates a request after signature according to the signature algorithm, and the target request is used for data transmission between the terminal and the server; The generating unit is specifically configured to: determine a signature field from the multiple request parameters; splice a field value of the signature field according to a rule defined by the signature algorithm to generate a to-be-signed string; combine the to-be-signed string with a random array to obtain a target string; perform calculation on the target string to generate a signature value; and add the signature value to the original request to form the target request.
7. An electronic device, comprising: The computer program is executed by the processor to implement the method of any one of claims 1-5. The computer program is executed by the processor to implement the method of any one of claims 1-5. 8. A computer-readable storage medium having stored thereon a computer program, characterized in that,
Citation Information
Patent Citations
Tamper-proof service access method, client and server
CN109962888A
Data request method and system and computing device
CN111835523A