A network request processing method, apparatus, device, and storage medium

By generating hidden keys and combining encryption algorithms with system layer and application layer keys, the problem of illegal network requests being called is solved, the security and difficulty of the encryption algorithm are enhanced, and illegal requests are prevented.

CN114238870BActive Publication Date: 2025-10-10杭州米络星科技(集团)有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111595034.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-24
Publication Date
2025-10-10
Estimated Expiration
2041-12-24

AI Technical Summary

Technical Problem

In the existing technology, network requests are easily called illegally, resulting in the encryption algorithm being cracked and the request being illegally initiated.

Method used

By generating hidden keys, combining the keys of the system layer and the application layer, writing the encryption algorithm in C++, and adding anti-debugging threads and code obfuscation technology to the encryption algorithm, the difficulty of cracking is increased.

Benefits of technology

It increases the difficulty of cracking encryption algorithms, prevents illegal calls, and enhances the security of network requests.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114238870B_ABST
    Figure CN114238870B_ABST
Patent Text Reader

Abstract

The application provides a network request processing method and device, equipment and a storage medium, and relates to the technical field of Internet. The method comprises the following steps: generating a hidden key according to a first key of a code system layer and a second key of an application layer which is called; generating an encryption parameter according to the hidden key; sending a service request carrying the encryption parameter to a server; and receiving a response message fed back by the server after the encryption parameter is verified according to a parameter list. The method sets a hidden key, generates an encryption parameter according to the hidden key, improves the difficulty of cracking the encryption algorithm compared with a plaintext key in an existing scheme, and further improves the difficulty of illegally calling the request.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet technology, and more specifically, to a network request processing method, apparatus, device, and storage medium. Background Art

[0002] The client initiates a network request carrying the corresponding encryption parameters. After the server verifies the parameters are legitimate, the server responds with the corresponding result. The algorithm for generating the encryption parameters is typically stored in the client's code for easy access. The Android client's APK package is publicly available, making it easily downloadable. This makes the encryption algorithm (and encryption algorithm) easily crackable.

[0003] In traditional approaches, developers add plaintext keys to encryption algorithms. Based on this approach, developers can extract the encryption algorithm for static analysis to observe the distribution of the plaintext key. Dynamic debugging can also be used to debug the algorithm's operations and reverse engineer the algorithm. Furthermore, developers can illegally call the encryption algorithm by importing it into a test project, calling it, and then reconstructing it. The encryption parameters obtained by the encryption algorithm and the restored algorithm are compared to ensure they match. If the parameters match, the encryption algorithm has been cracked. While existing approaches increase the difficulty of cracking the encryption algorithm by adding plaintext keys, cracking the encryption algorithm is still possible through static analysis, dynamic debugging, and illegal calls. If the encryption algorithm is cracked, any third party can initiate network requests, resulting in illegal calls. Summary of the Invention

[0004] The purpose of the present invention is to provide a network request processing method, device, equipment and storage medium to address the above-mentioned deficiencies in the prior art, so as to solve the problem in the prior art that network requests are easily illegally called.

[0005] To achieve the above objectives, the technical solutions adopted in the embodiments of the present application are as follows:

[0006] In a first aspect, an embodiment of the present application provides a method for processing a network request, the method comprising:

[0007] Generate a hidden key based on a first key of the system layer and a second key of the called application layer;

[0008] generating encryption parameters based on the hidden key;

[0009] Sending a service request carrying the encryption parameters to the server;

[0010] Receive a response message fed back by the server after verifying the encryption parameters according to the parameter list.

[0011] Optionally, generating the hidden key according to the first key of the system layer and the called second key of the application layer includes:

[0012] The first key and the second key are concatenated according to an encryption algorithm to generate the hidden key.

[0013] Optionally, an anti-debugging thread is added to the encryption algorithm, and the anti-debugging thread is used to prevent other processes from debugging the encryption algorithm when the encryption algorithm is additionally debugged by the anti-debugging thread.

[0014] Optionally, before generating the hidden key by concatenating the first key and the second key according to the encryption algorithm, the method further includes:

[0015] After starting the application, obtain the signature information of the current environment;

[0016] Verification is performed using the signature information and the preset signature information in the local code. If the verification passes, the encryption algorithm is called.

[0017] Optionally, the source code in the client is obfuscated in a preset manner.

[0018] Optionally, the encryption algorithm is written in C++ programming language.

[0019] Optionally, the encryption algorithm is stored in the source code of the client.

[0020] In a second aspect, an embodiment of the present application provides a network request processing device, including:

[0021] A key module, configured to generate a hidden key based on a first key of the system layer and a second key of the called application layer;

[0022] A generating module, configured to generate encryption parameters according to the hidden key;

[0023] A request module, configured to send a service request carrying the encryption parameters to the server;

[0024] The receiving module is used to receive a response message fed back by the server after the server verifies the encryption parameters according to the parameter list.

[0025] In a third aspect, an embodiment of the present application provides a computer device comprising: a memory and a processor, wherein the memory stores a computer program executable by the processor, and when the processor executes the computer program, the network request processing method of the first aspect is implemented.

[0026] In a fourth aspect, the embodiments of the present application provide a computer readable storage medium, and the storage medium stores a computer program. When the computer program is run by a processor, the network request processing method in the first aspect is implemented.

[0027] Compared with the prior art, the present application has the following beneficial effects:

[0028] The network request processing method, device, equipment and storage medium provided by the embodiments of the present application can generate a hidden key according to the first key of the code layer and the second key of the application layer called, send a service request carrying an encrypted parameter to a server, and receive a response message fed back by the server after the encrypted parameter is verified by the server according to a parameter list. The method generates an encrypted parameter according to the hidden key by setting the hidden key, and compared with the plaintext key in the prior art, the difficulty of cracking the encryption algorithm is improved, and the difficulty of requesting illegal calling is further improved. BRIEF DESCRIPTION OF DRAWINGS

[0029] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments. It should be understood that the following drawings only show some embodiments of the present application, and therefore should not be regarded as a limitation to the scope. For those skilled in the art, other related drawings can also be obtained without creative labor.

[0030] Figure 1 A schematic diagram of a network request processing system provided by the embodiments of the present application;

[0031] Figure 2 A flowchart of a network request processing method provided by the embodiments of the present application;

[0032] Figure 3 A flowchart of another network request processing method provided by the embodiments of the present application;

[0033] Figure 4 A schematic diagram of a network request processing device provided by the embodiments of the present application;

[0034] Figure 5 A schematic diagram of a computer device provided by the embodiments of the present application. DETAILED DESCRIPTION

[0035] In order to make the purpose, technical solutions and advantages of the embodiments of the present application more clear, the following will combine the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are some of the embodiments of the present application, but not all the embodiments. The components of the embodiments of the present application described and shown in the drawings can be arranged and designed in various different configurations.

[0036] Therefore, the following detailed description of the embodiments of the application provided in the drawings is not intended to limit the scope of the application claimed, but merely represents selected embodiments of the application. Based on the embodiments in the application, all other embodiments obtained by those of ordinary skill in the art without creative labor are within the scope of protection of the application.

[0037] 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 defined and explained in subsequent drawings.

[0038] In addition, if the terms "first", "second" and the like are used, they are only used to distinguish description, and cannot be understood as indicating or implying relative importance.

[0039] It should be noted that the features in the embodiments of the application can be combined with each other without conflict.

[0040] In order to solve the problem that the existing encryption algorithm is easy to be cracked, and to increase the difficulty of illegal calling of network request, in the scheme of the application, a network request processing method, device, equipment and storage medium are provided.

[0041] Figure 1 A schematic diagram of a network request processing system provided in the embodiments of the application is shown in FIG. 1, which includes a client and a server. Figure 1

[0042] The client (which can also be an application program) initiates a business request to the server, for example, a business request can be sent through an Http protocol, which can be recorded as an Https request. The business request can carry relevant business request parameters, the server receives the request parameters, and can perform corresponding business operations, and then returns the response result to the client.

[0043] The network request processing system proposed in the application will be specifically explained and described below taking an Android client as an example. Of course, the client can also be IOS and the like, which is not specifically limited in the embodiments of the application.

[0044] In order to ensure that the business request is initiated by a legal user of the client, the Android application package (APK) of the Android client contains an encryption algorithm, that is, the encryption algorithm can be stored in the source code of the client, and the encryption algorithm contains a hidden key. The encryption algorithm can generate an encryption parameter carrying a legal identity by calling the encryption algorithm.

[0045] ​When an Android client initiates a service request to a server, the request parameters include encryption parameters generated by an encryption algorithm and other request parameters. These other request parameters are service parameters, and the request parameters along with the encryption parameters are sent to the server. The server verifies the encryption parameters. If the encryption parameters match those generated by the same encryption algorithm on the server, verification succeeds. The server then executes the service and returns a response to the client. Otherwise, verification fails, and the server refuses to respond.

[0046] In the request mode without encryption parameters, unauthorized users may initiate service requests to the server, resulting in illegal calls. In the request mode with encryption parameters, when unauthorized users initiate requests to the server, because the request parameters sent by unauthorized users do not contain encryption parameters or the encryption parameters are incorrect, the server will fail verification and block the unauthorized user's illegal calls.

[0047] The network request processing system can be applied to multiple actual scenarios, such as grabbing red envelopes, flash sales, etc., and the business requests can also be actual business requests under different application scenarios. The embodiments of this application do not impose specific restrictions.

[0048] The following is a detailed explanation of the implementation process of the network request processing method provided by the embodiment of the present application through multiple examples. Figure 1 It is understood that the multiple examples of this application are specifically explained using Android clients as an example, and of course, the type of client is not specifically limited in the application. Figure 2 A flowchart of a network request processing method provided in an embodiment of the present application is shown as follows: Figure 2 As shown, the method includes:

[0049] S201: Generate a hidden key according to a first key of the system layer and a second key of the called application layer.

[0050] It should be noted that the Android client can include a two-layer architecture: a C++ layer and a Java layer. The C++ layer is the bottom layer, also known as the system layer, and the Java layer is the top layer, also known as the application layer. In the embodiment of the present application, the system layer parameters are selected as the first key, and the application layer parameters are selected as the second key. The first key and the second key are combined to generate a hidden key.

[0051] The algorithm for concealing the key is stored at the system level and written in the C++ programming language. Compared to algorithms written in Java, decompiled Java algorithms still return Java code, making them somewhat reproducible. However, decompiled C++ code returns assembly code, making it much more difficult to crack.

[0052] When selecting a system-layer parameter as the first key, a local parameter, such as a constant, can be defined, and a specific explanation can be given using a string as an example, such as define cKey1 = "cKeyParam1". At this time, the string cKeyParam1 corresponding to the local parameter cKey1 is the first key. It can be understood that a function that calls the system-layer parameter can also be defined, such as String getcKey2(), where the getcKey2() function is a function of the system layer. If the parameter value returned by the getcKey2() function is cKeyParam2, the string cKeyParam2 corresponding to the getcKey2() function is the first key.

[0053] When selecting application-layer parameters as the second key, since the algorithm for concealing the key is stored at the system level, the application-layer data cannot be obtained by defining local parameters. Instead, the application-layer parameters can be obtained as the second key by calling an application-layer function. In specific implementations, an application-layer function, such as string getjKey(), is called within the encryption algorithm. If the parameter value returned by getjKey() is jKeyParam, the string jKeyParam corresponding to the getjKey() function is the second key.

[0054] In the embodiments of the present application, character strings are used as an example for explanation. Numerical data types and other data types can also be used as the first key and the second key. The data type of the key is not specifically limited in the embodiments of the present application.

[0055] When defining a function to call the system layer or application layer within the algorithm of the hidden key, multiple system layer or application layer functions can also be called simultaneously to obtain parameter values ​​returned by multiple system layer or application layer functions, and the multiple parameter values ​​of the system layer or application layer are combined. The methods of combining multiple parameters include but are not limited to splicing, addition, subtraction, etc. to obtain the first key of the system layer or the second key of the application layer, and then combine the first key and the second key to generate the hidden key.

[0056] S202: Generate encryption parameters according to the hidden key.

[0057] The algorithm of the hidden key is stored in the encryption algorithm. At the same time, the encryption algorithm can also encrypt the hidden key and the input parameters of the service request through the hidden key, the input parameters of the service request, and the relationship between the hidden key and the input parameters of the service request to generate encryption parameters.

[0058] In order to improve the security of the network request, the encryption algorithm is stored in the system layer and is written by using a C++ program language. In addition, the encryption algorithm can be compiled into an so library for calling by the client in the embodiment of the application.

[0059] The relationship between the concealed key and the input parameter of the service request can be a splicing relationship. For example, the to-be-encrypted parameter = concealed key + input parameter + concealed key, that is, the to-be-encrypted parameter is obtained by splicing the concealed key, the input parameter of the service request and the concealed key. The splicing manner is only an example, and other splicing manners can also be adopted, for example, the to-be-encrypted parameter = concealed key + input parameter. The splicing manner is not specifically limited, but the to-be-encrypted parameter needs to contain at least one concealed key and at least one input parameter.

[0060] The input parameter of the service request is generated according to the service parameter to be transmitted by the service request. For example, in the embodiment of the application, the service parameter in the service request can be stored by using a Map container. The elements in the Map are stored in the form of key-value pairs. In a common shopping and killing activity in the Internet, the service request can contain eight parameters to be transmitted, such as "p"->"2"; "c"->"1"; "t"->"1638861350960"; "v"->"2.3.2"; "deviceId"->"ee295c64ff9ce26968"; "loginToken"->"740295aa66214be490ebd0a9fd67262b"; "loginUserId"->"159722"; and "productId"->"9f640eda90e743d78bd534750f51705d".

[0061] Among them, "p"->"2" indicates that the platform type where the client is located can be Android, p indicates the platform type where the client is located, and 2 can indicate the Android platform; "c"->"1" indicates that the download source of the client can be Huawei App Market, Xiaomi App Market and the like, c indicates the download source of the client, and 1 can indicate Huawei App Market; "t"->"1638861350960" indicates the timestamp when the client sends a request, "v"->"2.3.2" indicates that the version number of the client is 2.3.2, and v indicates the version number of the client; "deviceId"->"ee295c64ff9ce26968" indicates the device Id of installing the client; "loginToken"->"740295aa66214be490ebd0a9fd67262b" indicates the token of user login, which can verify whether the login state is valid; "loginUserId"->"159722" indicates the user Id of logging into the client, which can be used to identify the uniqueness of the user, and "productId"->"9f640eda90e743d78bd534750f51705d" indicates the product Id of the flash sale, which can be used to identify the uniqueness of the product.

[0062] According to the business parameters to be transmitted, the input parameters of the business request are obtained, wherein the specific form of the input parameters can be: taking out all key values and corresponding value values in the Map, and splicing each key and the corresponding value into a string, wherein the key and the corresponding value are separated by a colon, and an example is that "p"->"2" can obtain a spliced string p:2, and multiple strings are sorted in ascending order according to the first letter, that is, the first letter of the key value is sorted in ascending order. According to the specific form of the input parameters, the input parameters of the business request can be obtained according to the above eight business parameters to be transmitted.

[0063] c:1deviceId:deviceIdloginToken:740295aa66214be490ebd0a9fd67262bloginUserId:159722p:2productId:9f640eda90e743d78bd534750f51705dt:1638861350960v:2.3.2.

[0064] The above explains the input parameters in the embodiment of the present application by storing the relevant parameters in the business request in a Map container, the business request contains eight parameters to be passed, and the specific expression of the input parameters is spliced ​​into a string. Of course, the relevant parameters in the business request can also be stored in other ways, the parameters to be passed can also include other parameters, and the specific expression of the input parameters can also be other ways, which are not specifically limited in the embodiment of the present application.

[0065] Taking the above splicing relationship (parameter to be encrypted = hidden key + input parameter + hidden key) and the above input parameter as an example, the generation of encryption parameters based on the hidden key in the embodiment of the present application is specifically explained. If the hidden key obtained by combining the first key and the second key is cKeyParamjKeyParam, then according to the above splicing relationship and the above input parameter, the parameter to be encrypted can be:

[0066] cKeyParamjKeyParamc:1deviceId:deviceIdloginToken:740295aa66214be490ebd0a9fd67262bloginUserId :159722p:2productId:9f640eda90e743d78bd534750f51705dt:1638861350960v:2.3.2cKeyParamjKeyParam.

[0067] When the Android client sends a service request to the server, the encryption algorithm can encrypt the encryption parameters. The process of encrypting the encryption parameters and generating the encryption parameters can use a symmetric encryption algorithm, such as the DES (Data Encryption Standard) algorithm, AES (Advanced Encryption Standard), etc., and can also use a message digest algorithm, such as the MD5 algorithm (Message-Digest Algorithm 5), the SHA algorithm (Secure Hash Algorithm), the MAC algorithm (Message Authentication Code), etc.

[0068] The message digest algorithm can convert a string of arbitrary length into a fixed-length string and is irreversible. Therefore, in the embodiment of the present application, the process of generating encryption parameters is specifically explained using the MD5 algorithm as an example.

[0069] The parameters to be encrypted are encrypted using the MD5 algorithm. That is, the parameters to be encrypted are used as input to the MD5 algorithm, and the corresponding output data a5d0253c256d055b is the generated encryption parameter.

[0070] S203: Send a service request carrying encryption parameters to the server.

[0071] The client sends a service request to the server, wherein the service request includes encryption parameters and other request parameters, and the encryption parameters and other request parameters constitute a complete request parameter list.

[0072] For example, in the example of generating encryption parameters as described in S202, the encryption parameters included in the service request may be a5d0253c256d055b, and the other request parameters may be the above eight service parameters that need to be transmitted.

[0073] S204: Receive a response message fed back by the server after the encryption parameters are successfully verified according to the parameter list.

[0074] The server receives the parameter list in the service request sent by the client and extracts all parameters from the parameter list. For example, the server extracts the encryption parameters and eight service parameters in S203. At the same time, the server internally stores the same encryption algorithm as the client, that is, the server can call the internally stored encryption algorithm and generate the encryption parameters of the server internally through the above MD5 algorithm based on the hidden key and the service parameters in the service request. The server verifies the encryption parameters in the service request sent by the client with the encryption parameters generated internally by the server. If the encryption parameters in the service request sent by the client are consistent with the encryption parameters generated internally by the server, the server responds to the service request and feeds back the response result to the client. The client receives the response information fed back by the server. Otherwise, the server refuses to respond.

[0075] In summary, the embodiment of the present application provides a network request processing method, in which the encryption algorithm is written in C++ programming language, which increases the difficulty of cracking the encryption algorithm. At the same time, a hidden key is generated based on the first key of the system layer and the second key of the called application layer, and encryption parameters are generated based on the hidden key. A business request carrying the encryption parameters is sent to the server, and the client receives a response message from the server after verifying the encryption parameters based on the parameter list. This method sets a hidden key and generates encryption parameters based on the hidden key. Compared with the plaintext key in the existing scheme, this method increases the difficulty of cracking the encryption algorithm, thereby increasing the difficulty of the request being illegally called.

[0076] In the above Figure 2 Based on the network request processing method shown, an embodiment of the present application also provides an implementation method for generating a hidden key. In the above S201, a hidden key is generated based on the first key of the system layer and the second key of the called application layer, including: according to the encryption algorithm, the first key and the second key are spliced ​​to generate a hidden key.

[0077] During the specific implementation of the embodiment of the present application, as described in S201 above, if the first key corresponding to the system layer is set to define cKey1 = "cKeyParam1", the second key corresponding to the application layer is set to string getjKey() and the parameter value returned by the getjKey() function is jKeyParam, that is, the first key is cKeyParam1, and the second key is jKeyParam. According to the encryption algorithm, the first key and the second key are spliced, that is, the hidden key can be: cKeyParam1jKeyParam, or jKeyParamcKeyParam1, and the splicing order is not specifically limited here.

[0078] In the embodiment of the present application, the method of generating the hidden key based on the first key and the second key includes but is not limited to splicing, and can also be interspersed, that is, the hidden key can also be: cjKeeyyPPaarraamm1, and can also be other generation methods, which are not specifically limited in the embodiment of the present application.

[0079] In the embodiment of the present application, the first key and the second key are combined in a manner such as splicing to generate a hidden key. Figure 2 On the basis of the network request processing method shown, the complexity of the hidden key is increased, the difficulty of cracking the encryption algorithm is increased, and the difficulty of the request being illegally called is increased.

[0080] Based on the above embodiment, the embodiment of the present application also provides another network request processing method. In the encryption algorithm in the above embodiment, an anti-debugging thread is added so that other processes cannot debug the encryption algorithm.

[0081] During the specific implementation of the embodiment of the present application, a ptrace function corresponding to an anti-debugging thread is added to the encryption algorithm so that only this process can debug the encryption algorithm.

[0082] Taking the Android client as an example, after an illegal user downloads the APK of the Android client, he imports the encryption algorithm into the local debugging environment and performs illegal dynamic debugging of the encryption algorithm through the local debugging process. However, since the encryption algorithm has an integrated self-debugging function, the illegal user's local debugging process will not be able to perform illegal dynamic debugging of the encryption algorithm.

[0083] The embodiment of the present application adds an anti-debugging thread to the encryption algorithm, so that illegal users cannot crack the encryption algorithm through dynamic debugging, thereby increasing the difficulty of illegal calls of requests.

[0084] In the above Figure 2Based on the network request processing method shown, the embodiment of the present application also provides another implementation method of the network request processing method. The embodiment is explained in detail below with reference to the accompanying drawings. Figure 3 This is a flow chart of another network request processing method provided in an embodiment of the present application. Figure 3 As shown, before S201, the method further includes:

[0085] S301, after starting the application, obtain the signature information of the current environment.

[0086] Taking the Android client as an example, after a user downloads an APK from the application platform and installs it, the application's preset signature information is automatically configured in the Android client's file system during the installation process, ensuring that the client installing the application is a legitimate user. The preset signature information is preset in the APK before the application is installed. During application installation, the preset signature information can be configured in a configuration file in the client's file system, such as AndroidManifest.xml, build.prop, and other configuration files. The signature information in the configuration file can be referred to as reference signature information. In the embodiments of this application, the location of the reference signature information in the file system is not specifically limited.

[0087] In this embodiment of the present application, a method or function for obtaining signature information for the current environment is also preset within the APK, i.e., a method or function for obtaining reference signature information is preset. After the user launches the application on the client, the client automatically calls this preset method or function to obtain the signature information within the configuration file in the client's file system, i.e., obtains the reference signature information for the current environment.

[0088] After downloading the APK, an illegal user may not install and run it on the Android client, but instead create a local project with the same package name as the APK, import the APK into the local project, and then locally call the encryption algorithm in the APK. In the embodiment of the present application, before locally calling the encryption algorithm in the APK, the APK automatically calls a preset function to obtain the reference signature information of the local project, that is, obtain the reference signature information of the current environment of the APK.

[0089] S302: Verify the signature information and the preset signature information in the local code. If the verification passes, call the encryption algorithm.

[0090] Taking the Android client as an example, a signature verification method or function is preset in the APK to verify whether the referenced signature information is consistent with the preset signature information.

[0091] After obtaining the reference signature information of the current environment, call the signature verification method or function to verify whether the reference signature information is consistent with the preset signature information. If they are consistent, the verification passes and the user can call the encryption algorithm. If they are inconsistent, the verification fails and the user cannot call the encryption algorithm.

[0092] After legitimate users download the application's APK through the application platform and install and run it, if the referenced signature information is consistent with the preset signature information, they can use the application normally.

[0093] If an illegal user downloads an APK and imports it into a local project, and the illegal user calls the encryption algorithm in the APK, the APK automatically verifies through a signature verification method or function whether the reference signature information of the APK's current environment is consistent with the preset signature information. At this time, the APK's current environment is the environment of the local project, where the local project environment can be the illegal user's programming environment. The signature information of the illegal user's programming environment is inconsistent with the preset signature information in the APK. Therefore, the reference signature information is inconsistent with the preset signature information, and the illegal user cannot call the encryption algorithm.

[0094] The embodiment of the present application improves the security of the encryption algorithm by verifying the consistency of the reference signature information and the preset signature information, preventing the encryption algorithm from being illegally called, and thereby increasing the difficulty of the request being illegally called.

[0095] Based on the above embodiments, the embodiments of the present application also provide another network request processing method, wherein the source code in the client is obfuscated code using a preset method, wherein the application is obfuscated, including but not limited to control flow flattening, junk instructions, identifier obfuscation, string obfuscation and other code obfuscation technologies.

[0096] Taking the Android client as an example, the obfuscated code is released to the public, and the APK with code obfuscation makes the source code in the application downloaded by users from public channels the obfuscated code. The obfuscated code is difficult to understand, which increases the difficulty for illegal users to decompile, thereby improving the security of the encryption algorithm and increasing the difficulty of illegal calls.

[0097] The following describes a network request processing device provided by the present application for execution. Its specific implementation process and technical effects are described above and will not be repeated below.

[0098] Figure 4 A schematic diagram of a network request processing device provided in an embodiment of the present application is shown as follows: Figure 4 As shown, the network request processing device includes:

[0099] The key module 401 is used to generate a hidden key according to the first key of the system layer and the second key of the called application layer.

[0100] The generating module 402 is configured to generate the encryption parameter according to the hidden key.

[0101] The requesting module 403 is configured to send a service request carrying the encryption parameter to a server.

[0102] The receiving module 404 is configured to receive a response message fed back by the server after the encryption parameter is verified according to the parameter list.

[0103] Optionally, the key module 401 is specifically configured to splice the first key and the second key to generate the hidden key according to the encryption algorithm.

[0104] Optionally, the key module 401 is specifically configured to add an anti-debug thread in the encryption algorithm, and the anti-debug thread is used to prevent other processes from debugging the encryption algorithm when the encryption algorithm is attached with debugging by the anti-debug thread.

[0105] Optionally, the key module 401 is specifically configured to obtain signature information of a current environment after starting an application program.

[0106] The signature information and preset signature information in the local code are used for verification, and if the verification is passed, the encryption algorithm is called.

[0107] The above modules can be one or more integrated circuits configured to implement the above method, for example, one or more application specific integrated circuits (ASICs), or one or more digital signal processors (DSPs), or one or more field programmable gate arrays (FPGAs), etc. For another example, when the above module is implemented in the form of a processing element scheduling code, the processing element can be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call code. For another example, the modules can be integrated together in the form of a system on a chip (SOC).

[0108] Figure 5 A schematic diagram of a computer device provided by an embodiment of the present application is shown in FIG. 1. The computer device can be a computing device or a server with computing processing function.

[0109] The computer device includes a processor 501, a storage medium 502, and a bus 503. The processor 501 and the storage medium 502 are connected through the bus 503.

[0110] The storage medium 502 is used to store programs, and the processor 501 calls the programs stored in the storage medium 502 to execute the above method embodiment. The specific implementation methods and technical effects are similar and will not be repeated here.

[0111] Optionally, the present invention further provides a program product, such as a computer-readable storage medium, comprising a program, which is used to perform the above method embodiment when executed by a processor.

[0112] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0113] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0114] In addition, the functional units in various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or hardware plus software functional units.

[0115] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) or a processor (English: processor) to perform some steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: a USB flash drive, a mobile hard disk, a read-only memory (English: Read-Only Memory, abbreviated: ROM), a random access memory (English: Random Access Memory, abbreviated: RAM), a magnetic disk or an optical disk, and other media that can store program code.

[0116] The above are only specific embodiments of the present application, but the scope of protection of this application is not limited to them. Any changes or substitutions that can be easily conceived by any person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. A network request processing method, characterized in that: Applied to the client, including: After starting the application, obtain the signature information of the current environment; Verification is performed using the signature information and preset signature information in the local code. If the verification passes, an encryption algorithm is called; the preset signature information is preset in the program installation package of the application before the application is installed, and is configured in a configuration file in the file system of the client when the application is installed; According to the encryption algorithm, a first key of the system layer is concatenated with a second key of the called application layer to generate a hidden key; an anti-debugging thread is added to the encryption algorithm, and the anti-debugging thread is used to prevent other processes from debugging the encryption algorithm when the encryption algorithm is debugged by the anti-debugging thread; the encryption algorithm is written in the C++ programming language; the encryption algorithm is stored in the source code of the client; and the source code in the client is obfuscated using a preset method; According to the hidden key, the input parameters of the service request, and the relationship between the hidden key and the input parameters of the service request, the encryption algorithm is used to encrypt the hidden key and the input parameters of the service request to generate encryption parameters; the relationship between the hidden key and the input parameters of the service request is a splicing relationship; wherein the input parameters are generated according to the service parameters to be transmitted by the service request; Sending a service request carrying the encryption parameters to the server; Receive a response message fed back by the server after verifying the encryption parameters according to the parameter list.

2. A network request processing device, characterized in that: include: A key module is used to concatenate a first key of the system layer and a second key of the called application layer according to an encryption algorithm to generate a hidden key; The encryption algorithm includes an anti-debugging thread, which is used to prevent other processes from debugging the encryption algorithm when the encryption algorithm is debugged by the anti-debugging thread. The encryption algorithm is written in the C++ programming language and stored in the source code of the client. The source code in the client is obfuscated using a preset method. a generation module, configured to encrypt the hidden key and the input parameters of the service request using the encryption algorithm according to the hidden key, the input parameters of the service request, and the relationship between the hidden key and the input parameters of the service request to generate encryption parameters; the relationship between the hidden key and the input parameters of the service request is a splicing relationship; wherein the input parameters are generated according to the service parameters to be transmitted by the service request; A request module, configured to send a service request carrying the encryption parameters to the server; A receiving module, configured to receive a response message fed back by the server after verifying the encryption parameters according to the parameter list; Among them, the key module is also used to: obtain the signature information of the current environment after starting the application; use the signature information and the preset signature information in the local code for verification, and if the verification passes, call the encryption algorithm; the preset signature information is preset in the program installation package of the application before installing the application, and is configured in the configuration file in the file system of the client when the application is installed.

3. A computer device, characterized in that: include: A memory and a processor, wherein the memory stores a computer program executable by the processor, and the processor implements the network request processing method according to claim 1 when executing the computer program.

4. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is read and executed, the network request processing method according to claim 1 is implemented.

Citation Information

Patent Citations

  • Network request processing method, network request processing device, computer equipment and storage medium

    CN109413105A

  • Method and device for generating application layer key

    CN113038444A