Interface calling method and device and vehicle

By obtaining application information from the operating system in interface calls and matching the request information, combining summary algorithm and token management, the non-secure application disguise problem is solved, and the security and efficiency of interface calls are improved.

CN119127348APending Publication Date: 2024-12-13GREAT WALL MOTOR CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411198568.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-29
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

During the interface call process, non-secure applications may be disguised as applications in the operating system, resulting in security risks. It is difficult for the prior art to effectively identify and prevent interface calls from non-secure applications.

Method used

When receiving the interface call request, the information of the second application is obtained from the operating system and matched with the information in the interface call request. If it matches, the interface will be opened and the application information is verified using the digest algorithm to reduce the recognition of non-secure applications as The probability of secure application and improve interface call security by issuing tokens and configuring permission scopes.

Benefits of technology

It improves security during interface call, reduces the probability that non-secure applications are mistakenly identified as secure applications, and enhances permission management and efficiency of interfaces.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119127348A_ABST
    Figure CN119127348A_ABST
Patent Text Reader

Abstract

The invention provides an interface calling method and device and a vehicle, the method is applied to the technical field of software, and the method comprises the following steps: when a first application receives an interface calling request of a second application, obtaining first application information of the second application from the interface calling request, and acquiring second application information of the second application from an operating system where the second application is located, and opening an interface of the first application to the second application under the condition that the first application information is matched with the second application information. As the second application information obtained from the operating system is not easy to tamper, the security is high, the probability that the first application identifies the non-secure application as the secure application can be reduced, and the security in the interface calling process can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of software technology, and more specifically, to an interface calling method, device and vehicle. Background Art

[0002] With the development of software technology, interface calls between applications are becoming more and more frequent. In the interface call process, the application of the called interface (hereinafter referred to as the first application) and the application calling the interface (hereinafter referred to as the second application) are generally two applications in the same operating system. Therefore, the usual practice is that the first application defaults to the second application as a secure application, and when receiving the interface call request from the second application, the interface is directly opened to the second application. The problem with this method is that the non-secure application may disguise itself as an application in the operating system to call the interface of the first application, which poses certain security risks. Summary of the invention

[0003] The present application provides an interface calling method, device and vehicle, which can provide security during the interface calling process.

[0004] In a first aspect, an interface calling method is provided, which is applied to a first application, and the method includes:

[0005] When receiving an interface call request of a second application, obtaining first application information of the second application from the interface call request;

[0006] Acquire second application information of the second application from the operating system where the second application is located;

[0007] If the first application information matches the second application information, the interface of the first application is opened to the second application.

[0008] In the embodiment of the present application, when the first application receives the interface call request of the second application, it first obtains the first application information of the second application from the interface call request, and obtains the second application information of the second application from the operating system where the second application is located, and then opens the interface of the first application to the second application when the first application information matches the second application information. Since the second application information obtained from the operating system is not easy to be tampered with and has high security, the probability of the first application identifying a non-secure application as a secure application can be reduced, thereby improving the security of the interface call process.

[0009] In combination with the first aspect, in some possible implementations, the first application information includes first summary information generated based on original application information of the second application; obtaining the second application information of the second application from the operating system where the second application is located includes: obtaining the original application information from the operating system; generating second summary information of the second application through a summary algorithm based on the obtained original application information; and using the second summary information as the second application information.

[0010] In an embodiment of the present application, during the interface calling process, the original application information of the second application is processed by a summary algorithm to obtain summary information, and then the summary information is used to verify whether the second application is a legitimate application. This can reduce the amount of data in the interface calling process, thereby improving the interface calling efficiency.

[0011] In combination with the first aspect, in some possible implementations, generating second summary information of the second application through a summary algorithm based on the acquired original application information includes: determining background conditions when the second application initiates the interface call request; determining a target summary algorithm corresponding to the background conditions from multiple summary algorithms; and generating the second summary information through the target summary algorithm based on the acquired original application information.

[0012] In an embodiment of the present application, by selecting a corresponding summary algorithm to generate summary information based on the background conditions when the interface call request is initiated, the probability of matching the first summary information with the second summary information can be reduced when the second application is a non-secure application, thereby reducing the probability of identifying the unsecure second application as a secure application, thereby improving the security of the interface call process.

[0013] In combination with the first aspect, in some possible implementations, the original application information includes an application package name and an application signature of the second application; and generating the second summary information by the target digest algorithm based on the acquired original application information includes: when the background condition is a preset first background condition, generating the second summary information by the target digest algorithm based on the application package name; when the background condition is a preset second background condition, generating the second summary information by the target digest algorithm based on the application signature.

[0014] In an embodiment of the present application, different application information is processed under different background conditions to obtain summary information, which can reduce the probability of matching the first summary information with the second summary information when the second application is a non-secure application, thereby reducing the probability of identifying the unsecure second application as a secure application, thereby improving the security of the interface calling process.

[0015] In combination with the first aspect, in some possible implementations, opening the interface of the first application to the second application includes: issuing a token to the second application and configuring an authority scope for the token; and based on the token, opening the interface of the first application within the authority scope to the second application.

[0016] In an embodiment of the present application, when an interface is opened to a second application, a token is issued to the second application, and a permission range is configured for the token, so that the second application can call the interface within the permission range based on the token. Multiple interfaces within the permission range can be opened to the second application at one time, thereby improving the efficiency of interface calling.

[0017] In combination with the first aspect, in some possible implementations, configuring the permission scope for the token includes: when the interface call request includes permission information, configuring the permission scope for the token according to the permission information; or, configuring the permission scope for the token according to a preset interface level; wherein the permission scope corresponds to at least one interface level below the preset interface level.

[0018] In an embodiment of the present application, the permission range of the token is configured according to the permission information in the interface call request or the preset interface level, so that the interface call range of the second application can be quickly configured, thereby improving the interface call efficiency.

[0019] In combination with the first aspect, in some possible implementations, opening the interface of the first application to the second application includes: issuing a token to the second application and configuring a validity period for the token; and based on the token, opening the interface of the first application to the second application within the validity period.

[0020] In an embodiment of the present application, in the process of issuing a token to the second application, a validity period is configured for the token, and the calling period of the interface can be controlled by the validity period. The interface is opened to the second application during the validity period, and the interface of the first application can be effectively managed.

[0021] In combination with the first aspect, in some possible implementations, configuring the validity period for the token includes: when the interface call request includes expiration date information, configuring the validity period for the token according to the expiration date information; or, configuring the validity period for the token according to preset expiration date information.

[0022] In an embodiment of the present application, in the process of issuing a token for the second application, the validity period of the token is set by using the time limit information or preset time limit information in the interface call request, so that the validity period of the token can be quickly set, thereby improving the interface call efficiency.

[0023] In a second aspect, an interface calling device is provided, which is arranged in a first application, and includes:

[0024] an acquisition module, configured to, upon receiving an interface call request of a second application, acquire the first application information of the second application from the interface call request;

[0025] The acquisition module is further used to acquire second application information of the second application from the operating system where the second application is located;

[0026] An opening module is used to open the interface of the first application to the second application if the first application information matches the second application information.

[0027] In a third aspect, a vehicle is provided, the vehicle comprising:

[0028] A memory for storing executable program codes;

[0029] A processor is used to call and run the executable program code from the memory, so that the vehicle executes the method in any possible implementation of the first aspect.

[0030] In a fourth aspect, a computer program product is provided, which includes: an executable program code, when the executable program code is run on a computer, the computer executes the method in any possible implementation manner of the first aspect above.

[0031] In a fifth aspect, a readable storage medium is provided, which stores an executable program code. When the executable program code runs on a computer, the computer executes the method in any possible implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 This is a schematic diagram of a scenario of an interface call provided in an embodiment of the present application;

[0033] Figure 2 It is a flowchart of the steps of an interface calling method provided by an embodiment of the present application;

[0034] Figure 3 It is an interactive schematic diagram of an interface calling method provided in an embodiment of the present application;

[0035] Figure 4 This is an interface diagram of an interface calling device provided in an embodiment of the present application;

[0036] Figure 5 It is a structural schematic diagram of a vehicle provided in an embodiment of the present application. DETAILED DESCRIPTION

[0037] The technical solution in the present application will be described clearly and in detail below in conjunction with the accompanying drawings. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B: "and / or" in the text is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.

[0038] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features.

[0039] See also Figure 1 , Figure 1 Schematic diagram of a scenario of an interface call provided by an embodiment of the present application. Figure 1 As shown, there are at least two applications in the scenario, the application is an application program (Application, APP), the first application of at least two applications has one or more interfaces, such as an application programming interface (Application Programming Interface, API), the second application and the first application of at least two applications are two independent processes, and the second application and the first application can interact with each other using an inter-process communication (Inter-Process Communication, IPC) mechanism, so that the second application can call the interface of the first application.

[0040] like Figure 1 As shown, the first application and the second application are generally in the same operating system (OS), and the operating system can be an operating system installed in a processor of a certain device, such as a computer, a mobile phone, a vehicle, etc. Therefore, in an interface calling method in the related art, the first application defaults to the second application as a secure application, and upon receiving the interface calling request of the second application, directly opens the interface to the second application. The problem with this method is that a non-secure application may disguise itself as an application in the operating system, causing the first application to mistakenly believe that the non-secure application is a secure application and open the interface to the non-secure application, which may cause data leakage, software or system failure, resource occupation and other problems, and there are certain security risks.

[0041] Another interface calling method in the related art is to pre-store the application information of the secure second application in the first application. When the first application receives the interface calling request of the second application, it compares the application information of the second application included in the interface calling request with the pre-stored application information. When the application information in the interface calling request is consistent with the pre-stored application information, it determines that the second application is a secure application, and then opens the interface to the second application. The problem with this method is that the non-secure application may tamper with the pre-stored application information, which may cause the first application to identify the non-secure application as a secure application, which may cause data leakage, software or system failure, resource occupation and other problems, and there are certain security risks.

[0042] In order to solve the above technical problems, the embodiment of the present application provides an interface calling method, when the first application receives the interface calling request of the second application, it obtains the application information of the second application (hereinafter referred to as the second application information) from the operating system where the second application is located, and then determines whether the application information of the second application included in the interface calling request (hereinafter referred to as the first application information) matches the second application information, and determines that the second application is a secure application when it matches, and then opens the interface of the first application to the second application. Since the application information of the second application obtained from the operating system is not easy to be tampered with and has high security, the probability of the first application identifying a non-secure application as a secure application can be reduced, thereby reducing the probability of problems such as data leakage, software or system failure, and resource occupation, and thus improving the security during the interface calling process.

[0043] See also Figure 2 , Figure 2 1 is a flowchart of the steps of an interface calling method provided by an embodiment of the present application. The method can be executed by a processor in a device, and specifically by a first application installed in an operating system of the processor, such as Figure 2 As shown, the method may include the following steps:

[0044] Step 201: When receiving an interface call request of a second application, obtain first application information of the second application from the interface call request.

[0045] For example, the first application is a weather application, which can obtain weather information such as temperature, humidity, air pressure, visibility, and ultraviolet intensity in the environment where the device is located, and display and provide weather information to the user. At the same time, the first application has an API interface for providing weather information to other applications, and the first application can provide the obtained weather information to other applications (i.e., the second application) through the API interface.

[0046] In one implementation, after the first application is started, it can create a named pipe and listen to requests on the named pipe. When the second application needs to obtain weather information, it can connect to the named pipe, and then create an interface call request based on the interface identifier of the interface of the first application to be called (hereinafter referred to as the target interface) and the application information of the second application (i.e., the first application information), and send the interface call request to the named pipe. When the first application listens to the interface call request in the named pipe, it obtains the first application information and the interface identifier from the interface call request.

[0047] Optionally, the first application information may include only the application package name of the second application, or only the application signature of the second application, or both the application package name and the application signature of the second application. It should be understood that the application information may include but is not limited to the application signature and / or application package name of the second application.

[0048] Step 202: Obtain second application information of the second application from the operating system where the second application is located.

[0049] Step 203: If the first application information matches the second application information, open the interface of the first application to the second application.

[0050] Opening the interface to the second application refers to allowing the second application to call the interface.

[0051] Exemplarily, the second application can add the process number of the second application in the interface call request. After receiving the interface call request, the first application can obtain the process number of the second application from the interface call request, and then the first application can obtain the application information of the second application (i.e., the second application information) from the operating system through the process number. For example, if the first application information is the application package name of the second application, the first application can obtain the application package name of the second application (i.e., the second application information) from the operating system through the process number. If the application package name (first application information) obtained from the interface call request is consistent with the application package name (i.e., the second application information) obtained from the operating system (i.e., a match), the second application is determined to be a secure application.

[0052] For another example, if the first application information is the application signature of the second application, the first application can obtain the application signature of the second application (i.e., the second application information) from the operating system through the process number. If the application signature obtained from the interface call request (i.e., the first application information) is consistent with the application signature obtained from the operating system (i.e., the second application information), the second application is determined to be a secure application.

[0053] For another example, if the first application information includes both the application signature and application package name of the second application, the first application can obtain the application signature and application package name (i.e., the second application information) of the second application from the operating system through the process number. If the application signature obtained from the interface call request (i.e., the first application information) is consistent with the application signature obtained from the operating system (i.e., the second application information), and the application package name obtained from the interface call request (i.e., the first application information) is consistent with the application package name (i.e., the second application information) obtained from the operating system, then the second application is determined to be a secure application.

[0054] After determining that the second application is a safe application, the first application can open the interface of the first application to the second application. As described above, if the second application calls the interface of the first application to obtain weather information, then after determining that the second application is a safe application, the first application can determine the corresponding target interface through the interface identifier included in the interface call request, and provide the obtained weather information to the second application through the corresponding target interface.

[0055] Alternatively, after determining that the second application is a secure application, the first application can issue a token to the second application, and the token corresponds to the interface identifier of the target interface included in the interface call request, and the first application can store the token issued to the second application. After receiving the token, the second application can generate an interface call request based on the token each time it needs to call the target interface, and send the interface call request to the second application. After receiving the interface call request, if the interface call request includes a token, and the token is a pre-stored token, the first application determines that the second application is a secure application, and then the target interface can be directly opened to the second application.

[0056] It should be noted that during the interface calling process, each interface calling request sent by the second application may include the first application information of the second application. The first application can execute steps 201-203 in sequence, and open the interface of the first application to the second application when the first application information matches the second application information.

[0057] Optionally, during the interface calling process, when the second application calls the interface of the first application for the first time, the interface calling request sent by the second application may include the first application information of the second application and the interface identifier of the target interface. When the first application receives the interface calling request, if the interface calling request includes the first application information, a token is issued to the second application when the first application information matches the second application information. After receiving the token, if the second application needs to call the interface of the first application again, it may send an interface calling request including the token. Correspondingly, when the first application receives the interface calling request, if the interface calling request includes the token, when the second application is determined to be a secure application based on the token, the interface is opened to the second application.

[0058] Optionally, the first application may issue a corresponding token for each interface. When the second application calls the interface of the first application for the first time, the interface call request sent may include the first application information of the second application and the interface identifier of the target interface. When the first application receives the interface call request, if the interface call request includes the first application information, a token is issued to the second application when the first application information matches the second application information, and the issued token corresponds to the interface identifier of the target interface. At the same time, the first application can store the token and store the interface identifier of the target interface corresponding to the token. After receiving the token, if the second application needs to call the interface of the first application again, it can send an interface call request including the token. Correspondingly, when the first application receives the interface call request, if the interface call request includes the token, when the second application is determined to be a secure application based on the token, the interface identifier corresponding to the token stored in advance is determined, and then the target interface is determined based on the interface identifier, and the target interface is opened to the second application.

[0059] It should be understood that the above are merely illustrative examples, and the specific method for the first application to open an interface to the second application may include but is not limited to the above examples.

[0060] In the embodiment of the present application, when the first application receives the interface call request of the second application, it first obtains the first application information of the second application from the interface call request, and obtains the second application information of the second application from the operating system where the second application is located, and then opens the interface of the first application to the second application when the first application information matches the second application information. Since the second application information obtained from the operating system is not easy to be tampered with and has high security, the probability of the first application identifying a non-secure application as a secure application can be reduced, thereby improving the security of the interface call process.

[0061] Optionally, the first application information may be encrypted application information, and the encrypted first application information may be referred to as authentication information. After receiving the interface call request, the first application first obtains the authentication information from the interface call request, and then decrypts the authentication information to obtain the first application information.

[0062] Exemplarily, before initiating an interface call request, the second application may send the first application information to the server (also known as the issuing platform). The first application information may be the application package name of the second application, or the application signature of the second application, or may include both the application package name and the application signature of the second application. After receiving the first application information, the server may encrypt the first application information using a pre-set private key to obtain authentication information of the second application, and return the authentication information to the second application. Alternatively, the second application may directly use the private key to encrypt the first application information to obtain authentication information.

[0063] When sending an interface call request, the second application may send an interface call request including authentication information to the first application. After receiving the interface call request, the first application first obtains the authentication information from the interface call request, and then decrypts the authentication information using the pre-acquired public key to obtain the application information of the second application (i.e., the first application information). Afterwards, the first application may open the interface to the second application if the first application information matches the second application information.

[0064] The public key used by the first application in decrypting the authentication information matches the private key used in encrypting the first application information. In this way, if the second application is a legitimate application, the first application information obtained by decryption can match the second application information.

[0065] In actual applications, when the first application information is encrypted application information, it can further prevent the first application information from being tampered with, and can further improve the security of the interface call process. In addition, the second application can obtain the authentication information in advance before the interface call, so that the second application can continue to use the encrypted application information to call the interface of the first application when the communication connection with the server is disconnected and the second application is in an offline state, so that the interface call can be made in an offline state.

[0066] Optionally, the first application information includes first summary information generated based on original application information of the second application; and obtaining second application information of the second application from an operating system where the second application is located includes:

[0067] Get raw application information from the operating system;

[0068] Based on the acquired original application information, generating second summary information of the second application by using a summary algorithm;

[0069] The second summary information is used as the second application information.

[0070] The original application information may include an application package name of the second application and / or an application signature of the second application.

[0071] For example, before sending an interface call to the first application, the second application may first obtain the application package name and application signature (i.e., original application information) of the second application, and then process the application package name and application signature of the second application through a preset digest algorithm to obtain the summary information of the second application (i.e., the first summary information). Afterwards, when the second application sends an interface call request to the first application, it may send an interface call request including the first summary information to the first application.

[0072] Correspondingly, after receiving the interface call request, the first application can parse the interface call request and obtain the first summary information from the interface call request. At the same time, the first application can obtain the application package name and application signature (i.e., original application information) of the second application from the operating system, and then process the application package name and application signature obtained from the operating system through a preset summary algorithm to obtain the second summary information of the second application. Afterwards, the first application can determine that the second application is a safe application when the first summary information matches the second summary information, and then open the interface to the second application.

[0073] The first application and the second application may use the same preset digest algorithm to generate the digest information during the process of generating the digest information. In this way, when the second application is a secure application, the first digest information included in the interface call request and the second digest information generated by the first application may match.

[0074] Exemplarily, when the first application information is authentication information, after receiving the application package name and application signature (i.e., original application information) sent by the second application, the server can process the application package name and application signature sent by the second application through a digest algorithm to obtain the first digest information. Afterwards, the server encrypts the first digest information using a private key to obtain authentication information. Correspondingly, after receiving the interface call request, the first application first obtains the authentication information from the interface call request, and then can use the public key to decrypt the authentication information to obtain the first digest information.

[0075] The digest algorithm may include but is not limited to RIPEMD, Whirlpool, SHA-1, MD2 and other digest algorithms.

[0076] In an embodiment of the present application, during the interface calling process, the original application information of the second application is processed by a summary algorithm to obtain summary information, and then the summary information is used to verify whether the second application is a legitimate application. This can reduce the amount of data in the interface calling process, thereby improving the interface calling efficiency.

[0077] Optionally, based on the acquired original application information, generating second summary information of the second application by using a summary algorithm includes:

[0078] Determine the background conditions when the second application initiates the interface call request;

[0079] determining a target summary algorithm corresponding to the background condition from a plurality of summary algorithms;

[0080] Based on the acquired original application information, second summary information is generated by using a target summary algorithm.

[0081] Among them, the background condition is the background when the second application initiates the interface call request, which can be the initiation time of the interface call request, or the number of initiations of the interface call request. Of course, it can also be other types of background conditions. Different background conditions can correspond to different summary algorithms.

[0082] Exemplarily, in the process of generating summary information, the first application and the second application may determine background conditions based on preset rules, and then determine a summary algorithm based on the background conditions, and use the determined summary algorithm to process the original summary information respectively to obtain first summary information and second summary information respectively.

[0083] For example, the background condition is the initiation time. When the second application initiates an interface call request, if the initiation time is determined to be from 0:00 to 12:00 every day, a first digest algorithm corresponding to the initiation time from 0:00 to 12:00 is determined from multiple digest algorithms, and the original application information of the second application is processed by the first digest algorithm to obtain the first digest information; if the initiation time is determined to be from 12:00 to 24:00 every day, a second digest algorithm corresponding to the initiation time from 12:00 to 24:00 is determined from multiple digest algorithms, and the original application information of the second application is processed by the second digest algorithm to obtain the first digest information, and then an interface call request is created based on the first digest information, and the interface call request is sent to the first application. The first digest algorithm and the second digest algorithm are different digest algorithms.

[0084] Correspondingly, after receiving the interface call request, the first application determines the time when the interface call request is received, and the time when the interface call request is received is the initiation time of the interface call request. Alternatively, the second application can add the initiation time in the interface call request, and the first application can obtain the initiation time from the interface call request. After determining the initiation time of the interface call request, the first application can determine the target digest algorithm corresponding to the initiation time from multiple digest algorithms. If the initiation time is from 0:00 to 12:00 every day, the target digest algorithm is determined to be the first digest algorithm. If the initiation time is from 12:00 to 24:00 every day, the target digest algorithm is determined to be the second digest algorithm.

[0085] At the same time, the first application can obtain the second application information from the operating system, and use the target digest algorithm to process the second application information to obtain the second digest information. Then, the first application can compare the first digest information with the second digest information. If the first digest information and the second digest information match, the second application is determined to be a safe application, and the interface is opened to the second application.

[0086] For another example, the background condition is the number of initiations, and the second application sets the initial number of initiations to 0. Each time the second application initiates an interface call request, the number of initiations increases by 1. Each time an interface call request is initiated, if the number of times the interface call request is initiated is an even number, a first digest algorithm corresponding to the even number of the background condition is determined from multiple digest algorithms, and the original application information of the second application is processed by the first digest algorithm to obtain the first digest information; if the number of times the interface call request is initiated is an odd number, a second digest algorithm corresponding to the odd number of the background condition is determined from multiple digest algorithms, and the original application information of the second application is processed by the second digest algorithm to obtain the first digest information, and then an interface call request is created based on the first digest information, and the interface call request is sent to the first application.

[0087] Correspondingly, after receiving the interface call request, the first application determines the number of times the interface call request is received (i.e., the number of initiations). If the number of initiations is an even number, the target digest algorithm is determined to be the first digest algorithm. If the number of initiations is an odd number, the target digest algorithm is determined to be the second digest algorithm. Afterwards, the first application can obtain the second application information from the operating system, and use the target digest algorithm to process the second application information to obtain the second digest information. Then, the first application can compare the first digest information and the second digest information. If the first digest information and the second digest information match, the second application is determined to be a secure application, and the interface is opened to the second application.

[0088] Similarly, when the first summary information is generated by the server, the second application may send the background condition to the server when initiating the interface call request. When the server generates the first summary information, it may generate the first summary information based on the received background condition.

[0089] It should be noted that the first application and the second application can pre-agree on the rules for determining the background conditions. For example, the first application and the second application can pre-determine the initiation time of the interface call request as the background condition or the number of initiations as the background condition. In this way, when the second application is a secure application, the background conditions determined by the first application and the second application are the same, the digest algorithm determined based on the background conditions is the same, and the first summary information and the second summary information generated based on the digest algorithm match. Conversely, when the second application is a non-secure application, the digest algorithms used by the first application and the second application to generate the first summary information and the second summary information are most likely different, and the generated first summary information and the second summary information are also most likely different, thereby reducing the probability of identifying the unsafe second application as a secure application and improving the security of the interface call process.

[0090] It should be understood that the background conditions may include but are not limited to the initiation time and the number of initiations in the above examples.

[0091] In an embodiment of the present application, by selecting a corresponding summary algorithm to generate summary information based on the background conditions when the interface call request is initiated, the probability of matching the first summary information with the second summary information can be reduced when the second application is a non-secure application, thereby reducing the probability of identifying the unsecure second application as a secure application, thereby improving the security of the interface call process.

[0092] Optionally, the original application information includes an application package name and an application signature of the second application; based on the acquired original application information, generating the second summary information by using a target summary algorithm includes:

[0093] When the background condition is a preset first background condition, generating second summary information by using a target summary algorithm based on the application package name;

[0094] When the background condition is a preset second background condition, second digest information is generated by a target digest algorithm based on the application signature.

[0095] In one embodiment, different original application information may be used to generate summary information for different background conditions. For example, the first background condition is that the number of initiations is an even number, and the second background condition is that the number of initiations is an odd number. In the process of generating the first summary information by the second application, when the number of initiations is an even number, the application package name of the second application may be processed by the summary algorithm corresponding to the number of initiations (i.e., the target summary algorithm) to obtain the first summary information. Correspondingly, when the first application receives an interface call request, when the number of initiations is an even number, the application package name of the second application obtained from the operating system may be processed by the target summary algorithm corresponding to the number of initiations to obtain the second summary information.

[0096] Similarly, when the number of initiations is an odd number, the second application may process the application signature of the second application by using the digest algorithm corresponding to the number of initiations (i.e., the target digest algorithm) to obtain the first digest information. Correspondingly, when the number of initiations is an odd number, the first application may process the application signature of the second application obtained from the operating system by using the target digest algorithm corresponding to the number of initiations to obtain the second digest information.

[0097] As described above, when the background condition is the first background condition and the second application is a legitimate application, the first application and the second application can use the same digest algorithm to process the application package name of the second application to obtain digest information, so that the first digest information and the second digest information can be consistent, so that the first application can identify the second application as a safe application. When the background condition is the second background condition and the second application is a non-safe application, the digest algorithms used by the first application and the second application are not necessarily the same, and the processed original application information may also be different, so that the first digest information and the second digest information are likely to be different, which can increase the probability of the first application accurately identifying the second application.

[0098] In an embodiment of the present application, different application information is processed under different background conditions to obtain summary information, which can reduce the probability of matching the first summary information with the second summary information when the second application is a non-secure application, thereby reducing the probability of identifying the unsecure second application as a secure application, thereby improving the security of the interface calling process.

[0099] Optionally, opening an interface of the first application to the second application includes:

[0100] Issue a token to the second application and configure the permission scope for the token;

[0101] Based on the token, an interface of the first application within the permission scope is opened to the second application.

[0102] The permission scope is used to limit the scope of interface calls, and different permission scopes can call different interfaces of the first application.

[0103] In one embodiment, when the first application opens the interface of the first application to the second application, a token may be issued to the second application, and a permission range may be configured for the token so that the second application can call one or more interfaces of the first application within the permission range. Exemplarily, the permission range can be represented by an interface identifier. After the first application determines that the second application is a secure application, it can first determine the interface identifier of each interface (hereinafter referred to as the first interface, the first interface includes the target interface) that can be opened to the second application from the multiple interfaces of the first application, and then generate a token, send the token to the second application, and send the interface identifier of each first interface to the second application. At the same time, the first application can store the token issued to the second application, and correspondingly store the interface identifier of each first interface.

[0104] After receiving the issued token and the interface identifier of the first interface, the second application can create an interface call request based on the interface identifier of the first interface and the token when determining that one of the first interfaces needs to be called. After receiving the interface call request, if the first application determines that the interface call request includes an interface identifier and a token, and the token is at least one pre-stored token, and the interface identifier is an interface identifier corresponding to the token, then the first interface corresponding to the interface identifier is directly opened to the second application. On the contrary, if the token is not a pre-stored token, or the token is a pre-stored token, but the interface identifier in the interface call request is not a pre-stored interface identifier of the first interface corresponding to the token, then the interface corresponding to the interface identifier is not opened to the second application.

[0105] In an embodiment of the present application, when an interface is opened to a second application, a token is issued to the second application, and a permission range is configured for the token, so that the second application can call the interface within the permission range based on the token. Multiple interfaces within the permission range can be opened to the second application at one time, thereby improving the efficiency of interface calling.

[0106] Optionally, configure permission scopes for the token, including:

[0107] When the interface call request includes permission information, configuring the permission range for the token according to the permission information;

[0108] Alternatively, a permission range is configured for the token according to a preset interface level; wherein the permission range corresponds to at least one interface level below the preset interface level.

[0109] In one embodiment, when calling an interface, the second application can add permission information in the interface call request. The permission information can be the interface identifier of one or more interfaces (i.e., the first interface) that the second application needs to call. After receiving the interface call request, the first application can first obtain the permission information from the interface call request. After determining that the second application is security information, the first application can issue a token to the second application and set a corresponding permission range for the token based on the permission information. For example, if the permission information included in the interface call request is an interface identifier, the first application can store the token issued to the second application, and correspondingly store each interface identifier included in the interface call request, and use the interface corresponding to the interface identifier as the interface within the permission range.

[0110] Alternatively, multiple interface levels may be set, and corresponding interface levels may be set for the multiple interfaces of the first application, respectively. The interface levels of different interfaces may be the same or different. The permission information in the interface call request may be a first interface level, which is one of the multiple interface levels. After receiving the interface call request and determining that the second application is a secure application, the first application may issue a token to the second application, and then store the token and store the first interface level accordingly.

[0111] Correspondingly, after receiving the token, the second application can call the interface in the first application according to the token. After the first application receives the interface call request sent by the second application, if the token in the interface call request is a pre-stored token and the called interface is below the first interface level corresponding to the token, the interface is opened to the second application. On the contrary, if the token is not a pre-stored token or the interface level of the called interface is above the first interface level corresponding to the token, the interface is not opened to the second application.

[0112] In another embodiment, in the process of issuing a token to the second application, the first application can directly set the permission range for the token according to the preset interface level. For example, the preset interface level is the second interface level among multiple interface levels. After receiving the interface call request and determining that the second application is a secure application, the first application can issue a token to the second application and use the preset interface level as the permission range corresponding to the token.

[0113] Correspondingly, after receiving the token, the second application can call the interface in the first application according to the token. After the first application receives the interface call request sent by the second application, if the token in the interface call request is a pre-stored token and the called interface is below the second interface level corresponding to the token, the interface is opened to the second application. On the contrary, if the token is not a pre-stored token or the interface level of the called interface is above the second interface level corresponding to the token, the interface is not opened to the second application.

[0114] In an embodiment of the present application, the permission range of the token is configured according to the permission information in the interface call request or the preset interface level, so that the interface call range of the second application can be quickly configured, thereby improving the interface call efficiency.

[0115] Optionally, opening an interface of the first application to the second application includes:

[0116] Issue a token to the second application and configure a validity period for the token;

[0117] Based on the token, the interface of the first application is opened to the second application within the validity period.

[0118] In one embodiment, in the process of issuing a token to the second application, the first application can configure a validity period for the token so that the second application can call the interface of the first application through the token within the validity period. Exemplarily, the validity period can be represented by a time limit. After receiving the interface call request and determining that the second application is a secure application, the first application can set the validity period of the token when issuing the token to the second application. The validity period is, for example, time X day Y hour Z minute. The first application can send the token and the validity period to the second application, and can also store the token issued to the second application and the validity period corresponding to the token.

[0119] After receiving the token, the second application can send an interface call request including the token to the first application when calling the interface of the first application. After receiving the interface call request, the first application opens the interface of the first application to the second application when it determines that the token in the interface call request is a pre-stored token and the current time is before the time limit corresponding to the token (for example, X day Y hour Z minute). On the contrary, if the token is not a pre-stored token, the second application is determined to be a non-secure application, and the interface is not opened to the second application. Also, when the token is a pre-stored token but the current time is after the time limit corresponding to the token (for example, X day Y hour Z minute), the interface is not opened to the second application.

[0120] Optionally, when the first application sends the token to the second application, it can also send the token and the validity period corresponding to the token to the second application. In this way, when the second application calls the interface, if the current time is before the validity period corresponding to the token, it sends an interface call request including the token to the first application; if the current time is after the validity period corresponding to the token, it sends an interface call request including the first application information to the second application, so that the first application reissues the token.

[0121] In an embodiment of the present application, in the process of issuing a token to the second application, a validity period is configured for the token, and the calling period of the interface can be controlled by the validity period. The interface is opened to the second application during the validity period, and the interface of the first application can be effectively managed.

[0122] Optionally, in the process of issuing a token to the second application, the first application may configure the permission scope and validity period for the token at the same time, and then open an interface within the permission scope to the second application within the validity period based on the token.

[0123] Exemplarily, in the process of issuing a token to the second application, the first application can simultaneously set and store the permission information and time limit corresponding to the token. Afterwards, when receiving an interface call request including a token from the second application, if the token is a pre-stored token and the current time is before the time limit, the interface within the permission range indicated by the permission information is opened to the second application. On the contrary, when receiving an interface call request including a token from the second application, if the token is a pre-stored token but the current time is not before the time limit, the interface is not opened to the second application.

[0124] Optionally, configure a validity period for the token, including:

[0125] In the case where the interface call request includes the expiration date information, the validity period is configured for the token according to the expiration date information; or, the validity period is configured for the token according to the preset expiration date information.

[0126] Exemplarily, when the second application sends an interface call request to the first application for the first time, the expiration information may be added to the interface call request. After receiving the interface call request, if the first application determines that the second application is a secure application and the validity period indicated by the expiration information is within the preset maximum period, the first application issues a token to the second application and sets the expiration period indicated by the expiration information in the interface call request as the validity period of the token. The expiration information may include but is not limited to a time period.

[0127] In another embodiment, after receiving the interface call request, if the first application determines that the second application is a secure application, it can issue a token to the second application and set the period indicated by the preset period information as the validity period of the token. The preset period information may include but is not limited to the time period.

[0128] It should be understood that the method of setting the validity period may include but is not limited to the above examples.

[0129] In an embodiment of the present application, in the process of issuing a token for the second application, the validity period of the token is set by using the time limit information or preset time limit information in the interface call request, so that the validity period of the token can be quickly set, thereby improving the interface call efficiency.

[0130] See also Figure 3 , Figure 3 Schematic diagram of an interaction of an interface calling method provided by an embodiment of the present application. Figure 3 As shown, the method may include the following steps:

[0131] Step 301: The second application sends application information of the second application to the server.

[0132] Step 302: The server processes the application information of the second application using a digest algorithm to obtain first digest information.

[0133] Step 303: The server encrypts the first summary information to obtain authentication information.

[0134] Step 304: The server sends authentication information to the second application.

[0135] In this embodiment, before calling the interface of the first application, the second application first sends the application information of the second application (i.e., the original application information of the second application) to the server. After receiving the original application information, the server processes the original application information using a digest algorithm to obtain first digest information. Afterwards, the server can encrypt the first digest information using a private key to obtain the encrypted first digest information (i.e., authentication information), and send the authentication information to the second application.

[0136] Step 305: The second application sends an interface call request to the first application.

[0137] Step 306: The first application determines whether the first summary information in the interface call request matches the second summary information.

[0138] Step 307: The first application issues a token to the second application.

[0139] Step 308: The first application returns a failure notification to the second application.

[0140] In this embodiment, after the second application obtains the authentication information from the server, when calling the interface of the first application for the first time, it can send an interface call request including the authentication information to the first application. Correspondingly, after receiving the interface call request, if the first application determines that the interface call request includes the authentication information, it is determined that the second application calls the interface for the first time, and steps 306 to 308 can be executed.

[0141] In step 306, the first application obtains authentication information from the interface call request, and decrypts the authentication information using the public key that matches the private key to obtain the first summary information. At the same time, the first application can obtain the original application information of the second application from the operating system, and process the original application information through the summary algorithm to obtain the second summary information, and then determine whether the first summary information matches the second summary information. If the first summary information matches the second summary information, step 307 is executed to issue a token to the second application. If the first summary information does not match the second summary information, step 308 is executed to return a failure notification to the second application, notifying the second application that the interface call failed.

[0142] When issuing the token, the first application may open the interface to the second application, so that the second application completes the first call to the interface. Alternatively, when issuing the token, the first application may not open the interface to the second application, and the second application may complete the first call to the interface based on the token after receiving the token.

[0143] Step 309: The first application determines whether the token in the interface call request is legal.

[0144] Step 310: The first application opens an interface to the second application.

[0145] Step 311: The first application returns a failure notification to the second application.

[0146] In this embodiment, after receiving the token issued by the first application, the second application can send an interface call request including the token to the first application when calling the interface of the first application. Correspondingly, after receiving the interface call request, if the first application determines that the interface call request includes the token, it determines that the second application is not calling the interface for the first time, and then executes steps 309-311.

[0147] In step 309, the first application obtains a token from the interface call request. If it is determined that the token is a token pre-issued to the second application, the token is determined to be a legal token, and step 310 is executed to open the interface to the second application so that the second application completes the call to the interface. If it is determined that the token is not a token pre-issued to the second application, the token is determined to be an illegal token, and step 311 is executed to return a failure notification to the second application, notifying the second application that the interface call failed.

[0148] See also Figure 4 , Figure 4 Schematic diagram of an interface calling device provided by an embodiment of the present application. Figure 4 As shown, the device 400 is set in the first application and may include:

[0149] The acquisition module 401 is used to acquire the first application information of the second application from the interface call request when receiving the interface call request of the second application;

[0150] The acquisition module 401 is further configured to acquire second application information of the second application from the operating system where the second application is located;

[0151] The opening module 402 is used to open the interface of the first application to the second application if the first application information matches the second application information.

[0152] Optionally, the first application information includes first summary information generated based on original application information of the second application; the acquisition module 401 is specifically used to obtain the original application information from the operating system; based on the obtained original application information, generate second summary information of the second application through a summary algorithm; and use the second summary information as the second application information.

[0153] Optionally, the acquisition module 401 is specifically used to determine the background conditions when the second application initiates the interface call request; determine a target digest algorithm corresponding to the background conditions from multiple digest algorithms; and generate the second digest information through the target digest algorithm based on the acquired original application information.

[0154] Optionally, the acquisition module 401 is specifically used to generate the second summary information by the target digest algorithm based on the application package name when the background condition is a preset first background condition; and to generate the second summary information by the target digest algorithm based on the application signature when the background condition is a preset second background condition.

[0155] Optionally, the opening module 402 is specifically used to issue a token to the second application and configure an authority scope for the token; based on the token, open the interface of the first application within the authority scope to the second application.

[0156] Optionally, the open module 402 is specifically used to configure the permission scope for the token according to the permission information when the interface call request includes permission information; or, to configure the permission scope for the token according to a preset interface level; wherein the permission scope corresponds to at least one interface level below the preset interface level.

[0157] Optionally, the opening module 402 is specifically used to issue a token to the second application and configure a validity period for the token; based on the token, open the interface of the first application to the second application within the validity period.

[0158] Optionally, the open module 402 is specifically used to configure the validity period for the token according to the deadline information when the interface call request includes deadline information; or configure the validity period for the token according to preset deadline information.

[0159] See also Figure 5 , Figure 5 is a schematic diagram of the structure of a vehicle provided in an embodiment of the present application. Figure 5 As shown, the vehicle 500 includes: a memory 501 and a processor 502, wherein the memory 501 stores an executable program code 5011, and the processor 502 is used to call and execute the executable program code 5011 to perform an interface calling method.

[0160] In addition, an embodiment of the present application also protects an interface calling device, which may include a memory and a processor, wherein the memory stores executable program code, and the processor is used to call and execute the executable program code to execute an interface calling method provided by an embodiment of the present application.

[0161] In this embodiment, the functional modules of the device can be divided according to the above method example. For example, each functional module can be corresponded, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware. It should be noted that the division of modules in this embodiment is schematic and is only a logical function division. There may be other division methods in actual implementation.

[0162] In the case of dividing each functional module according to each function, the device may also include an acquisition module and an open module, etc. It should be noted that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module, which will not be repeated here.

[0163] It should be understood that the device provided in this embodiment is used to execute the above-mentioned interface calling method, and thus can achieve the same effect as the above-mentioned implementation method.

[0164] In the case of an integrated unit, the device may include a processing module and a storage module. When the device is applied to a vehicle, the processing module may be used to control and manage the actions of the vehicle. The storage module may be used to support the vehicle in executing mutual program codes, etc.

[0165] The processing module may be a processor or a controller, which may implement or execute various exemplary logic blocks, modules and circuits disclosed in the present application. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc. The storage module may be a memory.

[0166] In addition, the device provided in the embodiments of the present application may specifically be a chip, component or module, and the chip may include a connected processor and memory; wherein the memory is used to store instructions, and when the processor calls and executes the instructions, the chip can execute an interface calling method provided in the above embodiments.

[0167] This embodiment also provides a readable storage medium, in which executable program code is stored. When the executable program code runs on a computer, the computer executes the above-mentioned related method steps to implement an interface calling method provided by the above-mentioned embodiment.

[0168] This embodiment also provides a computer program product. When the computer program product runs on a computer, it enables the computer to execute the above-mentioned related steps to implement an interface calling method provided by the above embodiment.

[0169] Among them, the device, readable storage medium, computer program product or chip provided in this embodiment is used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above, and will not be repeated here.

[0170] Through the description of the above implementation methods, technical personnel in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0171] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that 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.

[0172] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. An interface calling method, characterized in that: Applied to the first application, the method comprises: When receiving an interface call request of a second application, obtaining first application information of the second application from the interface call request; Acquire second application information of the second application from the operating system where the second application is located; If the first application information matches the second application information, the interface of the first application is opened to the second application.

2. The method according to claim 1, characterized in that The first application information includes first summary information generated based on original application information of the second application; and obtaining the second application information of the second application from the operating system where the second application is located includes: Acquiring the original application information from the operating system; Based on the acquired original application information, generating second summary information of the second application by using a summary algorithm; The second summary information is used as the second application information.

3. The method according to claim 2, characterized in that The step of generating second summary information of the second application by using a summary algorithm based on the acquired original application information includes: Determining the background conditions when the second application initiates the interface call request; Determining a target digest algorithm corresponding to the background condition from a plurality of digest algorithms; Based on the acquired original application information, the second digest information is generated by using the target digest algorithm.

4. The method according to claim 3, characterized in that The original application information includes an application package name and an application signature of the second application; and generating the second digest information by using the target digest algorithm based on the acquired original application information includes: When the background condition is a preset first background condition, generating the second summary information by using the target summary algorithm based on the application package name; When the background condition is a preset second background condition, the second digest information is generated by the target digest algorithm based on the application signature.

5. The method according to any one of claims 1 to 4, characterized in that The opening of the interface of the first application to the second application includes: issuing a token to the second application and configuring a permission scope for the token; Based on the token, an interface of the first application within the permission scope is opened to the second application.

6. The method according to claim 5, characterized in that The configuring the permission scope for the token includes: In a case where the interface call request includes permission information, configuring the permission range for the token according to the permission information; Alternatively, the authority range is configured for the token according to a preset interface level; wherein the authority range corresponds to at least one interface level below the preset interface level.

7. The method according to any one of claims 1 to 4, characterized in that The opening of the interface of the first application to the second application includes: issuing a token to the second application and configuring a validity period for the token; Based on the token, an interface of the first application is opened to the second application within the validity period.

8. The method according to claim 7, characterized in that The configuring a validity period for the token includes: In a case where the interface call request includes time limit information, configuring the validity period for the token according to the time limit information; Alternatively, the validity period is configured for the token according to preset period information.

9. An interface calling device, characterized in that: In a first application, the device comprises: an acquisition module, configured to, upon receiving an interface call request of a second application, acquire the first application information of the second application from the interface call request; The acquisition module is further used to acquire second application information of the second application from the operating system where the second application is located; An opening module is used to open the interface of the first application to the second application if the first application information matches the second application information.

10. A vehicle, characterized in that: The vehicle comprises: A memory for storing executable program codes; A processor, configured to call and run the executable program code from the memory, so that the vehicle executes the method according to any one of claims 1 to 8.