Interface signature encryption method and device, readable storage medium and electronic equipment
By identifying the target file in the interface signature, extracting and encrypting the signature information, generating an encrypted signature macro, and compiling the file, the problem of interface signatures being easily cracked is solved, thus improving security.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-15
- Publication Date
- 2026-03-17
AI Technical Summary
In existing technologies, interface signatures are stored in local files in plaintext or encrypted form, which makes them easy to reverse engineer and thus results in insufficient security.
The system identifies target files that meet preset conditions from the set of development version files of the target application, extracts the original signature information, encrypts it, generates encrypted signature information, replaces it with encrypted signature macros, and finally compiles to generate user version files.
The security of the interface signature is improved, making it difficult to obtain the encrypted signature information through reverse engineering, thus enhancing the protection of the interface signature.
Smart Images

Figure CN115221478B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to an interface signature encryption method, apparatus, computer-readable storage medium, computer program product, and electronic device. Background Technology
[0002] API signatures are a crucial security measure for online applications, especially for verifying the security of API request data. During application development, API signatures are typically stored locally in two ways: either as plaintext or as an encrypted string. After the application is compiled, the API signature is packaged along with other files to generate a user-accessible file.
[0003] Both of the above methods of saving interface signatures, whether in plaintext or ciphertext, pose a risk of being reverse-engineered. Therefore, the security requirements for interface signatures have been strengthened. Summary of the Invention
[0004] Embodiments of this disclosure provide an interface signature encryption method, apparatus, computer-readable storage medium, electronic device, and computer program product.
[0005] The embodiments of this disclosure provide an interface signature encryption method, which includes: determining a target file containing an original signature macro and meeting preset conditions from a file set corresponding to a development version of a target application; extracting original signature information from the original signature macro contained in the target file; encrypting the original signature information to obtain encrypted signature information, and replacing the original signature information with the encrypted signature information in the original signature macro; generating an encrypted signature macro based on the encrypted signature information; and compiling the file set corresponding to the current development version of the target application to obtain a user version file of the target application.
[0006] In some embodiments, encrypting the original signature information to obtain encrypted signature information includes: encrypting the original signature information to obtain encrypted signature information whose data type is not string.
[0007] In some embodiments, the preset conditions include at least one of the following: the file is not an encryption tool file; the file is a file with modification permissions.
[0008] In some embodiments, determining a target file containing the original signature macro and meeting preset conditions from the file set corresponding to the development version of the target application includes: determining an application specification file from the file set corresponding to the target application; determining the path of the component of the target application from the application specification file; and determining the target file containing the original signature macro and meeting preset conditions from the files under the path.
[0009] In some embodiments, generating an encrypted signature macro based on encrypted signature information includes: modifying the identifier of the original signature macro from the original identifier to the encrypted identifier to obtain the encrypted signature macro.
[0010] In some embodiments, after modifying the identifier of the original signature macro from the original identifier to the encrypted identifier to obtain the encrypted signature macro, the method further includes: during the execution of a development version of the target application, in response to calling the encrypted identifier of the encrypted signature macro, decrypting the encrypted signature information to obtain the original signature information; replacing the encrypted signature information with the original signature information in the encrypted signature macro; and modifying the identifier of the encrypted signature macro from the encrypted identifier to the original identifier to obtain the original signature macro.
[0011] According to another aspect of the present disclosure, an interface signature encryption device is provided. The device includes: a determining module, configured to determine a target file containing an original signature macro and meeting preset conditions from a file set corresponding to a development version of a target application; an extraction module, configured to extract original signature information from the original signature macro contained in the target file; an encryption module, configured to encrypt the original signature information to obtain encrypted signature information, and replace the original signature information with the encrypted signature information in the original signature macro; a generating module, configured to generate an encrypted signature macro based on the encrypted signature information; and a compiling module, configured to compile the file set corresponding to the current development version of the target application to obtain a user version file of the target application.
[0012] In some embodiments, the encryption module is further configured to: encrypt the original signature information to obtain encrypted signature information of a non-string data type.
[0013] In some embodiments, the preset conditions include at least one of the following: the file is not an encryption tool file; the file is a file with modification permissions.
[0014] In some embodiments, the determining module includes: a first determining unit, configured to determine an application specification file from a set of files corresponding to the target application; a second determining unit, configured to determine the path of a component of the target application from the application specification file; and a third determining unit, configured to determine a target file containing the original signature macro and meeting preset conditions from the files under the path.
[0015] In some embodiments, the generation module includes: a first modification unit, configured to modify the identifier of the original signature macro from the original identifier to the encrypted identifier, thereby obtaining an encrypted signature macro.
[0016] In some embodiments, the generation module further includes: a decryption unit, configured to decrypt the encrypted signature information in response to the encrypted identifier of the encrypted signature macro during the running of a development version of the target application, to obtain the original signature information; a replacement unit, configured to replace the encrypted signature information with the original signature information in the encrypted signature macro; and a second modification unit, configured to modify the identifier of the encrypted signature macro from the encrypted identifier to the original identifier, to obtain the original signature macro.
[0017] According to another aspect of the present disclosure, a computer-readable storage medium is provided that stores computer program instructions thereon, which, when executed by a processor, implement the steps of the above-described interface signature encryption method.
[0018] According to another aspect of the present disclosure, an electronic device is provided, comprising: a processor; a memory for storing processor-executable instructions; and a processor for reading executable instructions from the memory and executing the instructions to implement the interface signature encryption method described above.
[0019] According to another aspect of the present disclosure, a computer program product is provided, including computer program instructions that, when executed by a processor, implement the steps of the interface signature encryption method described above.
[0020] Based on the interface signature encryption method, apparatus, computer-readable storage medium, electronic device, and computer program product provided in the above embodiments of this disclosure, a target file containing an original signature macro and meeting preset conditions is determined from the file set corresponding to the development version of the target application. Then, the original signature information is extracted from the original signature macro contained in the target file and encrypted to obtain encrypted signature information. Next, the original signature information is replaced with the encrypted signature information in the original signature macro, and an encrypted signature macro is generated based on the encrypted signature information. Finally, the current file set is compiled to obtain the user version file of the target application. Because the encrypted signature macro is regenerated, when others reverse engineer the user version file of the target application, they cannot obtain the encrypted signature information, and therefore cannot crack the encrypted signature information, thereby improving the security of the interface signature.
[0021] The technical solutions of this disclosure will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0022] The above and other objects, features, and advantages of this disclosure will become more apparent from the more detailed description of the embodiments thereof in conjunction with the accompanying drawings. The drawings are provided to further illustrate the embodiments of this disclosure and form part of the specification. They are used together with the embodiments of this disclosure to explain the disclosure and do not constitute a limitation thereof. In the drawings, the same reference numerals generally represent the same components or steps.
[0023] Figure 1 This is the system diagram to which this disclosure applies.
[0024] Figure 2 This is a flowchart illustrating an exemplary embodiment of the interface signature encryption method provided in this disclosure.
[0025] Figure 3 This is a flowchart illustrating an interface signature encryption method provided in another exemplary embodiment of this disclosure.
[0026] Figure 4 This is a flowchart illustrating an interface signature encryption method provided in another exemplary embodiment of this disclosure.
[0027] Figure 5 This is a schematic diagram of the structure of an interface signature encryption device provided in an exemplary embodiment of this disclosure.
[0028] Figure 6 This is a schematic diagram of the structure of an interface signature encryption device provided in another exemplary embodiment of this disclosure.
[0029] Figure 7 This is a structural diagram of an electronic device provided in an exemplary embodiment of this disclosure. Detailed Implementation
[0030] Hereinafter, exemplary embodiments according to the present disclosure will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of the present disclosure, and not all embodiments of the present disclosure, and it should be understood that the present disclosure is not limited to the exemplary embodiments described herein.
[0031] It should be noted that, unless otherwise specifically stated, the relative arrangement, numerical expressions, and values of the components and steps set forth in these embodiments do not limit the scope of this disclosure.
[0032] Those skilled in the art will understand that the terms "first," "second," etc., in the embodiments of this disclosure are only used to distinguish different steps, devices, or modules, and do not represent any specific technical meaning, nor do they indicate a necessary logical order between them.
[0033] It should also be understood that in the embodiments disclosed herein, "a plurality of" may refer to two or more, and "at least one" may refer to one, two or more.
[0034] It should also be understood that any component, data or structure mentioned in the embodiments of this disclosure can generally be understood as one or more unless expressly defined or given to the contrary in the context.
[0035] Furthermore, the term "and / or" in this disclosure is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this disclosure generally indicates that the preceding and following related objects have an "or" relationship.
[0036] It should also be understood that the description of the various embodiments in this disclosure emphasizes the differences between the various embodiments, and the similarities or similarities can be referred to each other. For the sake of brevity, they will not be described in detail.
[0037] At the same time, it should be understood that, for ease of description, the dimensions of the various parts shown in the accompanying drawings are not drawn according to actual scale.
[0038] The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit this disclosure or its application or use.
[0039] Techniques, methods, and equipment known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and equipment should be considered part of the specification.
[0040] It should be noted that similar labels and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be discussed further in subsequent figures.
[0041] The embodiments disclosed herein can be applied to electronic devices such as terminal devices, computer systems, and servers, and can operate together with a wide range of other general-purpose or special-purpose computing system environments or configurations. Examples of well-known terminal devices, computing systems, environments, and / or configurations suitable for use with electronic devices such as terminal devices, computer systems, and servers include, but are not limited to: personal computer systems, server computer systems, thin clients, thick clients, handheld or laptop devices, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputer systems, mainframe computer systems, and distributed cloud computing environments including any of the above systems, etc.
[0042] Electronic devices such as terminal devices, computer systems, and servers can be described in the general context of computer system executable instructions (such as program modules) executed by a computer system. Typically, program modules can include routines, programs, object programs, components, logic, data structures, etc., which perform specific tasks or implement specific abstract data types. Computer systems / servers can be implemented in distributed cloud computing environments, where tasks are executed by remote processing devices linked through communication networks. In distributed cloud computing environments, program modules can reside on local or remote computing system storage media, including storage devices.
[0043] Application Overview
[0044] The current handling of interface signatures has significant security vulnerabilities.
[0045] First, the scheme of storing the interface signature in plaintext in a local file allows others to obtain the plaintext string of the interface signature through methods such as reverse engineering (for example, in the iOS system, after the application's files are packaged into an IPA (iPhone Application) file and released, others can use the IPA to reverse engineer it). This allows them to crack the application's data interface requests and even simulate application interface requests, posing a risk of massively stealing application data.
[0046] Secondly, the scheme of saving the interface signature as an encrypted ciphertext string to a local file can be exploited by others who can reverse engineer the file to find the ciphertext and then brute-force it back to plaintext. Therefore, its security is also questionable.
[0047] Exemplary System
[0048] Figure 1 An exemplary system architecture 100 is shown that can be applied to the interface signature encryption method or interface signature encryption device of the embodiments of this disclosure.
[0049] like Figure 1 As shown, system architecture 100 may include terminal device 101, network 102, and server 103. Network 102 is used as a medium to provide a communication link between terminal device 101 and server 103. Network 102 may include various connection types, such as wired or wireless communication links or fiber optic cables, etc.
[0050] Users can use terminal device 101 to interact with server 103 via network 102 to receive or send messages, etc. Various communication client applications can be installed on terminal device 101, such as search applications, web browser applications, shopping applications, instant messaging tools, etc.
[0051] Terminal device 101 can be various electronic devices, including but not limited to mobile terminals such as mobile phones, laptops, digital radio receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (such as in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers.
[0052] Server 103 can be a server that provides various services, such as a backend server that supports applications running on terminal device 101. The backend server can send the application, after the interface signature has been encrypted, to the terminal device.
[0053] It should be noted that the interface signature encryption method provided in the embodiments of this disclosure can be executed by server 103 or by terminal device 101. Correspondingly, the interface signature encryption device can be located in server 103 or terminal device 101. For example, on terminal device 101, the method can be executed on a development version of the target application, and the generated user version file can be sent to server 103 for user download. As another example, on server 103, the method can be executed on a development version of the target application to generate a user version file for user download.
[0054] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0055] Exemplary methods
[0056] Figure 2 This is a flowchart illustrating an exemplary embodiment of the interface signature encryption method provided in this disclosure. This embodiment can be applied to electronic devices (such as...). Figure 1 On the terminal device 101 or server 103 shown, such as Figure 2 As shown, the method includes the following steps:
[0057] Step 201: Determine the target file containing the original signature macro and meeting the preset conditions from the file set corresponding to the development version of the target application.
[0058] In this embodiment, the electronic device can determine the target file containing the original signature macro and meeting preset conditions from the file set corresponding to the development version of the target application. The aforementioned original signature macro defines the interface signature. The interface signature is information generated for verification based on interface parameters using a specific algorithm (e.g., MD5 (Message Digest Algorithm version 5)) to enhance the security of interface parameters. Typically, to prevent malicious tampering during interface calls, a signature is required for every interface call. The electronic device verifies the signature based on the interface request parameters; requests with invalid signatures will be rejected.
[0059] The development version of a target application refers to the version of the target application before it is released to users. The file set corresponding to the development version refers to the collection of files generated for developing the target application. For example, these files may include source files, header files, library files, etc. Typically, the target file set is managed in the form of a project within an Integrated Development Environment (IDE).
[0060] The target file is the file used to verify interface parameters using the original signature information. As an example, in the Xcode integrated development environment (IDE for developing applications for iOS and macOS), the header file `#import` can be included beforehand in the target file.<xxDataSecurityKit / xxSecEncryptString.h> Place the original signature information "signature key" that needs to be encrypted into the original signature macro, such as XXSecConstString(@"signature key").
[0061] Since there are multiple files containing the original signature macros, and these files serve different purposes, it is necessary to select the target file from these files for use in verifying interface parameters.
[0062] Optionally, the above preset conditions may include at least one of the following: the file is not an encryption tool file; the file has modification permissions.
[0063] As an example, the electronic device can iterate through each file in the above file set. If the current file contains the original signature macro and is an encryption tool file, it skips the file and continues to the next file. If the current file contains the original signature macro but is not an encryption tool file, it can continue to determine whether the file path includes a specific string (such as the string " / Pods / "). If it does, it means that the file is a third-party file and cannot be modified. The device then skips the file and continues to the next file.
[0064] The encryption tool file mentioned above is a tool file for developers to use. Therefore, this file cannot be modified, otherwise it will not be usable. Therefore, this file needs to be skipped.
[0065] By setting preset conditions, the target file used for interface signature verification can be extracted more accurately from a large number of files, thereby improving the accuracy of encrypting interface signatures.
[0066] Step 202: Extract the original signature information from the original signature macros contained in the target file.
[0067] In this embodiment, the electronic device can extract the original signature information from the original signature macro contained in the target file. The original signature information is the information generated by signing the interface parameters. Continuing the example in step 201 above, the original signature information is the "signature key".
[0068] Step 203: Encrypt the original signature information to obtain encrypted signature information, and replace the original signature information with the encrypted signature information in the original signature macro.
[0069] In this embodiment, the electronic device can encrypt the original signature information to obtain encrypted signature information, and replace the original signature information with the encrypted signature information in the original signature macro.
[0070] The method for encrypting the original signature information can be set arbitrarily. For example, an existing encryption algorithm or a custom encryption algorithm can be used.
[0071] Step 204: Generate an encrypted signature macro based on the encrypted signature information.
[0072] In this embodiment, the electronic device can generate an encrypted signature macro based on the encrypted signature information. Specifically, the identifier of the original signature macro can be modified to a new identifier to obtain the encrypted signature macro; or, the identifier of the original signature macro can be kept unchanged to obtain the encrypted signature macro.
[0073] Step 205: Compile the set of files corresponding to the current development version of the target application to obtain the user version of the target application.
[0074] In this embodiment, the electronic device can compile the file set corresponding to the current development version of the target application to obtain a user version file of the target application. The generated user version file is a file after encrypting the original signature information, and this file can be installed by the user on the terminal device.
[0075] As an example, the target application can be an application running on the iOS system. After encrypting the original signature information in the development version of the target application in the Xcode development tool, it can be compiled to generate an IPA file. The user's iOS terminal can install the IPA file to execute the functions of the target application.
[0076] The method provided in the above embodiments of this disclosure determines target files containing original signature macros and meeting preset conditions from a file set corresponding to the development version of the target application. Then, it extracts the original signature information from the original signature macro contained in the target file and encrypts it to obtain encrypted signature information. Next, it replaces the original signature information with the encrypted signature information in the original signature macro and generates an encrypted signature macro based on the encrypted signature information. Finally, it compiles the current file set to obtain the user version file of the target application. Because the encrypted signature macro is regenerated, when others reverse engineer the user version file of the target application, they cannot obtain the encrypted signature information and therefore cannot crack it, thereby improving the security of the interface signature.
[0077] In some alternative implementations, step 203 above can be performed by encrypting the original signature information to obtain encrypted signature information:
[0078] The original signature information is encrypted to obtain encrypted signature information with a non-string data type.
[0079] The algorithm used to generate encrypted signature information with a non-string data type can be arbitrarily set. For example, an existing encryption algorithm (such as a hash algorithm) can be used to encrypt the original signature information to generate an initial encrypted signature information with a string data type, and then the initial encrypted signature information can be converted into encrypted signature information with a non-string data type. Alternatively, a custom encryption rule can be defined to directly convert the original signature information into encrypted signature information with a non-string data type.
[0080] The non-string data types can include, but are not limited to, at least one of the following: integer (int), floating-point (float), etc. Since strings are typically composed of multiple characters, i.e., long, this embodiment can optionally convert the initial encrypted signature information of string type into a structure (struct) containing multiple non-string data types. For example, this structure can include multiple hexadecimal integer data types 0x01, 0x15, 0x77, etc. It should be noted that the data type conversion method is a common technique in this field and will not be elaborated upon here.
[0081] Conventional encryption algorithms generate string-type information. Within the generated user-version file (e.g., an IPA file), the ciphertext string can be viewed, making it vulnerable to brute-force attacks. However, the encrypted signature information generated in this embodiment is not a string and cannot be viewed within the generated user-version file. Therefore, reverse engineering of the user-version file cannot reveal the original signature information, resulting in a more secure interface signing method.
[0082] In some alternative implementations, such as Figure 3 As shown, step 201 has the following sub-steps:
[0083] Step 2011: Determine the application description file from the file set corresponding to the target application.
[0084] Application documentation is used to manage the relationships between multiple components within an application development tool. For example, in the Xcode development tool, application documentation can be a Podfile.
[0085] Step 2012: Determine the path of the target application's components from the application documentation.
[0086] Since there can be at least one component, the path set consisting of the paths of at least one component can be determined from the application specification file. For example, when the application specification file is a Podfile, it can be first converted into a Podfile.json file. Then, iterate through this file to find the relative paths of custom development components (e.g., pod 'XXModule', :path => '.. / XXModule / '). At this point, '.. / XXModule / ' can be extracted and concatenated with the current project root directory to form a new absolute path pathA. Following this method, the paths pathB, pathC, etc., of other components can be extracted to obtain the path set.
[0087] Step 2013: Identify the target file containing the original signature macro and meeting the preset conditions from the files in the path.
[0088] When at least one path is obtained, the electronic device can traverse the files under each path, determine whether each file contains the original signature macro and meets the preset conditions, and then obtain the target file.
[0089] This embodiment extracts the target file by determining the component path from the application specification file, which can more effectively and quickly find the target file from the file set corresponding to the target application, thus improving the efficiency of encrypting the interface signature.
[0090] In some alternative implementations, such as Figure 4 As shown, step 204 may include the following sub-steps:
[0091] Step 2041: Modify the identifier of the original signature macro from the original identifier to the encrypted identifier to obtain the encrypted signature macro.
[0092] For example, if the original identifier of the original signature macro is XXSecConstString, you can change XXSecConstString to XXSecedCString after replacing the original signature information with the encrypted signature information to obtain the encrypted signature macro.
[0093] This embodiment modifies the identifier of the original signature macro, which makes it easier to automatically determine whether the interface signature is encrypted when the target application is running. This helps the target application to decrypt the signature during the development phase and makes it easier for developers to view.
[0094] In some alternative implementations, such as Figure 4 As shown, after step 2041, the method further includes:
[0095] Step 2042: During the running of the development version of the target application, in response to the call to the cryptographic signature macro, the cryptographic signature information is decrypted to obtain the original signature information.
[0096] The decryption method corresponds to the encryption method. By decrypting the encrypted signature information, the original signature information can be restored. Typically, during the execution of the target application, if a running instruction contains the identifier of an encrypted signature macro (such as XXSecedCString mentioned above), it indicates that the encrypted signature macro needs to be called. At this time, the encrypted signature information contained in the encrypted signature macro can be decrypted to obtain the original signature information.
[0097] Step 2043: Replace the encrypted signature information with the original signature information in the encrypted signature macro.
[0098] Step 2044: Modify the identifier of the encrypted signature macro from the encrypted identifier to the original identifier to obtain the original signature macro.
[0099] In this embodiment, the decryption method is defined by the developer and is not disclosed. During the development phase of the target application, when running the development version of the application, based on the method provided in this embodiment, it can automatically identify whether the current target application is an encrypted version of the interface signature based on the identifier of the signature macro. If it is an encrypted version, the decryption method is automatically run to obtain the signature information in plaintext form; if it is not an encrypted version, the original signature macro is directly called.
[0100] This embodiment enables automatic decryption of encrypted signature information during the development phase of the target application. Therefore, the encrypted signature information can be considered as plaintext for developers. Compared with existing technologies, this embodiment does not require special means to view the encrypted signature information, making it easier to circulate among developers and improving the development efficiency of the target application.
[0101] Exemplary device
[0102] Figure 5 This is a schematic diagram of the structure of an interface signature encryption device provided in an exemplary embodiment of this disclosure. This embodiment can be applied to electronic devices, such as... Figure 5 As shown, the interface signature encryption device includes: a determining module 501, used to determine a target file containing the original signature macro and meeting preset conditions from the file set corresponding to the development version of the target application; an extraction module 502, used to extract the original signature information from the original signature macro contained in the target file; an encryption module 503, used to encrypt the original signature information to obtain encrypted signature information, and replace the original signature information with the encrypted signature information in the original signature macro; a generating module 504, used to generate an encrypted signature macro based on the encrypted signature information; and a compilation module 505, used to compile the file set corresponding to the current development version of the target application to obtain the user version file of the target application.
[0103] In this embodiment, the determining module 501 can determine the target file containing the original signature macro and meeting preset conditions from the file set corresponding to the development version of the target application. The original signature macro is a macro that defines the interface signature. The interface signature is used to enhance the security of interface parameters by generating verification information for the interface parameters according to a certain algorithm (e.g., MD5 (Message Digest Algorithm version 5)). Typically, to prevent malicious tampering during interface calls, any call to an interface needs to carry a signature. The determining module 501 verifies the signature based on the interface request parameters; requests with invalid signatures will be rejected.
[0104] The development version of a target application refers to the version of the target application before it is released to users. The file set corresponding to the development version refers to the collection of files generated for developing the target application. For example, these files may include source files, header files, library files, etc. Typically, the target file set is managed in the form of a project within an Integrated Development Environment (IDE).
[0105] The target file is the file used to verify interface parameters using the original signature information. As an example, in the Xcode integrated development environment (IDE for developing applications for iOS and macOS), the header file `#import` can be included beforehand in the target file.<xxDataSecurityKit / xxSecEncryptString.h> Place the original signature information "signature key" that needs to be encrypted into the original signature macro, such as XXSecConstString(@"signature key").
[0106] Since there are multiple files containing the original signature macros, and these files serve different purposes, it is necessary to select the target file from these files for use in verifying interface parameters.
[0107] In this embodiment, the extraction module 502 can extract the original signature information from the original signature macro contained in the target file. The original signature information is the information generated by signing the interface parameters. Continuing the example in step 201 above, the original signature information is the "signature key".
[0108] In this embodiment, the encryption module 503 can encrypt the original signature information to obtain encrypted signature information, and replace the original signature information with the encrypted signature information in the original signature macro.
[0109] The method for encrypting the original signature information can be set arbitrarily. For example, an existing encryption algorithm or a custom encryption algorithm can be used.
[0110] In this embodiment, the generation module 504 can generate an encrypted signature macro based on the encrypted signature information. Specifically, the identifier of the original signature macro can be modified to a new identifier to obtain the encrypted signature macro; or, the identifier of the original signature macro can be kept unchanged to obtain the encrypted signature macro.
[0111] In this embodiment, the compilation module 505 can compile the file set corresponding to the current development version of the target application to obtain the user version file of the target application. The generated user version file is a file after encrypting the original signature information, and this file can be installed by the user on the terminal device.
[0112] As an example, the target application can be an application running on the iOS system. After encrypting the original signature information in the development version of the target application in the Xcode development tool, it can be compiled to generate an IPA file. The user's iOS terminal can install the IPA file to execute the functions of the target application.
[0113] Reference Figure 6 , Figure 6This is a schematic diagram of the structure of an interface signature encryption device provided in another exemplary embodiment of this disclosure.
[0114] In some optional implementations, the encryption module 503 is further used to: encrypt the original signature information to obtain encrypted signature information of a non-string data type.
[0115] In some optional implementations, the preset conditions include at least one of the following: the file is not an encryption tool file; the file has modification permissions.
[0116] In some optional implementations, the determining module 501 includes: a first determining unit 5011, used to determine an application specification file from the file set corresponding to the target application; a second determining unit 5012, used to determine the path of the component of the target application from the application specification file; and a third determining unit 5013, used to determine the target file containing the original signature macro and meeting the preset conditions from the files under the path.
[0117] In some optional implementations, the generation module 504 includes: a first modification unit 5041, used to modify the identifier of the original signature macro from the original identifier to the encrypted identifier, thereby obtaining an encrypted signature macro.
[0118] In some optional implementations, the generation module further includes: a decryption unit 5042, used to decrypt the encrypted signature information in response to the encrypted identifier of the encrypted signature macro during the running of the development version of the target application, to obtain the original signature information; a replacement unit 5043, used to replace the encrypted signature information with the original signature information in the encrypted signature macro; and a second modification unit 5044, used to modify the identifier of the encrypted signature macro from the encrypted identifier to the original identifier, to obtain the original signature macro.
[0119] The interface signature encryption device provided in the above embodiments of this disclosure determines target files containing original signature macros and meeting preset conditions from a file set corresponding to the development version of the target application. Then, it extracts the original signature information from the original signature macro contained in the target file and encrypts it to obtain encrypted signature information. Next, it replaces the original signature information with the encrypted signature information in the original signature macro and generates an encrypted signature macro based on the encrypted signature information. Finally, it compiles the current file set to obtain the user version file of the target application. Because the encrypted signature macro is regenerated, when others reverse engineer the user version file of the target application, they cannot obtain the encrypted signature information and therefore cannot crack it, thereby improving the security of the interface signature.
[0120] Exemplary electronic devices
[0121] Below, for reference Figure 7To describe an electronic device according to embodiments of the present disclosure. The electronic device may be as follows: Figure 1 The terminal device 101 and server 103 shown, or either one or both, or a standalone device independent of them, can communicate with the terminal device 101 and server 103 to receive the collected input signals from them.
[0122] Figure 7 A block diagram of an electronic device according to an embodiment of the present disclosure is shown.
[0123] like Figure 7 As shown, the electronic device 700 includes one or more processors 701 and memory 702.
[0124] The processor 701 may be a central processing unit (CPU) or other form of processing unit with data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 700 to perform desired functions.
[0125] The memory 702 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 701 may execute the program instructions to implement the interface signature encryption methods of the various embodiments of this disclosure described above and / or other desired functions. Various contents, such as development version files, user version files, etc., may also be stored in the computer-readable storage medium.
[0126] In one example, the electronic device 700 may also include an input device 703 and an output device 704, which are interconnected via a bus system and / or other forms of connection mechanism (not shown).
[0127] For example, when the electronic device is a terminal device 101 or a server 103, the input device 703 can be a mouse, keyboard, or other similar device used to input various commands and other content. When the electronic device is a standalone device, the input device 703 can be a communication network connector used to receive various commands and other content input from the terminal device 101 and the server 103.
[0128] The output device 704 can output various information to the outside, including user-version files. The output device 704 may include, for example, a display, a speaker, a printer, and a communication network and its connected remote output devices, etc.
[0129] Of course, for the sake of simplicity, Figure 7 Only some of the components of the electronic device 700 relevant to this disclosure are shown, omitting components such as buses, input / output interfaces, etc. In addition, the electronic device 700 may include any other suitable components depending on the specific application.
[0130] Exemplary computer program products and computer-readable storage media
[0131] In addition to the methods and apparatus described above, embodiments of this disclosure may also be computer program products comprising computer program instructions that, when executed by a processor, cause the processor to perform the steps in the interface signature encryption methods according to various embodiments of this disclosure as described in the foregoing portions of this specification.
[0132] The computer program product can be written in any combination of one or more programming languages to perform the operations of the embodiments of this disclosure. The programming languages include object-oriented programming languages such as Java and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on a user's computing device, partially on a user's computing device, as a standalone software package, partially on a user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0133] Furthermore, embodiments of this disclosure may also be computer-readable storage media storing computer program instructions that, when executed by a processor, cause the processor to perform the steps in the interface signature encryption methods according to various embodiments of this disclosure as described in the "Exemplary Methods" section above.
[0134] The computer-readable storage medium may be any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may, for example, include, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0135] The basic principles of this disclosure have been described above with reference to specific embodiments. However, it should be noted that the advantages, benefits, and effects mentioned in this disclosure are merely examples and not limitations, and should not be considered as essential features of each embodiment of this disclosure. Furthermore, the specific details disclosed above are for illustrative and facilitative purposes only, and are not limitations. These details do not limit the scope of this disclosure to the necessity of employing the aforementioned specific details for implementation.
[0136] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For system embodiments, since they largely correspond to method embodiments, the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
[0137] The block diagrams of devices, apparatuses, devices, and systems disclosed herein are merely illustrative examples and are not intended to require or imply that they must be connected, arranged, or configured in the manner shown in the block diagrams. As those skilled in the art will recognize, these devices, apparatuses, devices, and systems can be connected, arranged, and configured in any manner. Words such as “comprising,” “including,” “having,” etc., are open-ended terms meaning “including but not limited to,” and are used interchangeably with them. The terms “or” and “and” as used herein refer to the terms “and / or,” and are used interchangeably with them unless the context clearly indicates otherwise. The term “such as” as used herein refers to the phrase “such as but not limited to,” and is used interchangeably with it.
[0138] The methods and apparatus of this disclosure may be implemented in many ways. For example, they may be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above-described order of steps for the methods is for illustrative purposes only, and the steps of the methods of this disclosure are not limited to the order specifically described above unless otherwise specifically stated. Furthermore, in some embodiments, this disclosure may also be implemented as a program recorded on a recording medium, the program including machine-readable instructions for implementing the methods according to this disclosure. Thus, this disclosure also covers recording media storing programs for performing the methods according to this disclosure.
[0139] It should also be noted that in the apparatus, devices, and methods of this disclosure, the components or steps can be disassembled and / or recombined. These disassemblies and / or recombinations should be considered as equivalent solutions to this disclosure.
[0140] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use this disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of this disclosure. Therefore, this disclosure is not intended to be limited to the aspects shown herein, but rather to be carried out within the widest scope consistent with the principles and novel features disclosed herein.
[0141] The above description has been given for purposes of illustration and description. Furthermore, this description is not intended to limit the embodiments of this disclosure to the forms disclosed herein. Although numerous exemplary aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, alterations, additions, and sub-combinations therein.
Claims
1. An interface signature encryption method, comprising: determining a target file containing an original signature macro and meeting a preset condition from a file set corresponding to a development version of a target application; extracting original signature information from the original signature macro contained in the target file; encrypting the original signature information to obtain encrypted signature information, and replacing the original signature information with the encrypted signature information in the original signature macro; generating an encrypted signature macro based on the encrypted signature information; compiling a file set currently corresponding to the development version of the target application to obtain a file of a user version of the target application.
2. The method of claim 1, wherein, The encryption of the original signature information to obtain encrypted signature information comprises: encrypting the original signature information to obtain encrypted signature information of a data type other than a string.
3. The method of claim 1, wherein, The preset condition comprises at least one of the following: the file is not an encryption tool file; the file is a file with modification permission.
4. The method of claim 1, wherein, The determination of the target file containing the original signature macro and meeting the preset condition from the file set corresponding to the development version of the target application comprises: determining an application description file from the file set corresponding to the target application; determining a path of a component of the target application from the application description file; determining the target file containing the original signature macro and meeting the preset condition from a file under the path.
5. The method according to any one of claims 1 to 4, wherein, The generation of the encrypted signature macro based on the encrypted signature information comprises: modifying an identifier of the original signature macro from an original identifier to an encrypted identifier to obtain the encrypted signature macro.
6. The method of claim 5, wherein, After the modification of the identifier of the original signature macro from the original identifier to the encrypted identifier to obtain the encrypted signature macro, the method further comprises: during the running of the development version of the target application, in response to the calling of the encrypted signature macro, decrypting the encrypted signature information to obtain original signature information; replacing the encrypted signature information with the original signature information in the encrypted signature macro; modifying the identifier of the encrypted signature macro from the encrypted identifier to the original identifier to obtain the original signature macro.
7. An interface signature encryption device, comprising: a determination module configured to determine a target file containing an original signature macro and meeting a preset condition from a file set corresponding to a development version of a target application; an extraction module configured to extract original signature information from the original signature macro contained in the target file; an encryption module configured to encrypt the original signature information to obtain encrypted signature information, and replace the original signature information with the encrypted signature information in the original signature macro; a generation module configured to generate an encrypted signature macro based on the encrypted signature information; a compilation module configured to compile a file set currently corresponding to the development version of the target application to obtain a file of a user version of the target application.
8. An electronic device, comprising: comprising: a memory configured to store a computer program product; a processor configured to execute the computer program product stored in the memory, and when the computer program product is executed, implement the method of any one of claims 1-6.
9. A computer-readable storage medium having stored thereon computer program instructions, wherein, The computer program instructions are executed by the processor to implement the method of any one of claims 1-6.
10. A computer program product comprising computer program instructions, characterised in that, The computer program instructions implement the method of any of claims 1-6 when executed by the processor.
Citation Information
Patent Citations
Licence management system based on compiling technology
CN112417380A
Interface calling method, device and equipment and storage medium
CN113094660A