Application installation method and device, equipment and storage medium
The package management module performs signature checksum time verification on the target application, which solves the problem of digital signature re-signing in the existing technology, and realizes the secure installation of the application and convenient use of the user.
Patent Information
- Application Number
- CN202411439059.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-15
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2044-10-15
AI Technical Summary
The prior art requires digital signatures when installing applications for new debugging devices, resulting in inconvenience to users.
The target application is signed and verified through the package management module, and the current system time, signature time and authorization validity period are obtained for verification. If it is passed, the application will be installed and the installation information will be stored in the database for verification in subsequent opening operations.
It realizes application installation without re-signing when adding new debugging devices, improves user experience, and ensures the security of the application through verification mechanism.
Smart Images

Figure CN119645433A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of application security technology, and in particular to an application installation method, device, equipment and storage medium. Background Art
[0002] Before an application is officially released, it will be debugged. In other words, there will be a debug version and a release version of the application. The debug version is in the internal testing phase, so the scope of use of the application needs to be limited to avoid application leakage. To this end, it is currently common to bind the device ID with a digital signature, and then verify the digital signature when installing the application on the debug device. Although this can prevent application leakage, each time a new debug device needs to be added, the application needs to be digitally signed again, which brings inconvenience to users.
[0003] Therefore the prior art still needs to be improved and enhanced. Summary of the invention
[0004] The technical problem to be solved by the present application is to provide an application installation method, device, equipment and storage medium in view of the deficiencies in the prior art.
[0005] In order to solve the above technical problems, the first aspect of the present application provides a method for installing an application, wherein the method for installing an application specifically includes:
[0006] When the application type of the target application is a debugging type, the target application is verified by the package management module, and when the target application passes the verification, the target application is installed, wherein the process of verifying the target application by the package management module specifically includes:
[0007] Performing signature verification on the target application;
[0008] If the signature verification passes, the current system time of the electronic device on which the target application is installed, the signature time of the target application, and the authorization validity period of the profile authorization file of the application are obtained;
[0009] Verifying the signature time and the authorization validity period based on the current system time;
[0010] If the signature time and the authorization validity period are verified, it is determined that the target application is verified.
[0011] The method for installing an application, wherein when the target application passes the verification, after installing the target application, the method further comprises:
[0012] Read the system time when the target application is successfully installed to obtain the installation time of the target application;
[0013] The installation time, the application package name of the target application and the authorization validity period are stored in a database as the installation information of the application, so as to verify the opening operation of the target application.
[0014] The method for installing the application, wherein the verification of the signature time and the authorization validity period based on the current system time specifically includes:
[0015] Calculating a first time difference between the current system time and the signature time;
[0016] Compare the first time difference with the first time threshold to verify the signature time, wherein if the first time difference is less than the first time threshold, the signature time verification passes, otherwise, the signature time verification fails;
[0017] The first time difference is compared with the authorization validity period to verify the authorization validity period, wherein if the second time difference is less than the authorization validity period, the authorization validity period verification passes, otherwise, the authorization validity period verification fails.
[0018] The application installation method described herein, wherein a signature verification module is provided in the package management module, and the signature verification module includes a hapVerify interface, a RunVerify interface, and a RemoveDebugData interface; the hapVerify interface is used to verify the target application when installing the target application, the RunVerify interface is used to verify the target application when opening the target application, and the RemoveDebugData interface is used to delete the installation information of the target application when uninstalling the target application.
[0019] The method for installing an application, wherein when the target application passes the verification, after installing the target application, the method further comprises:
[0020] When an opening operation for the target application is received, the target application is checked for opening application by the package management module, and the target application is opened when the opening application check passes, wherein the opening application check specifically includes:
[0021] Obtaining the opening system time when the opening operation is received, the installation time of the target application, the authorization validity period of the target application, and the signing time of the target application;
[0022] If the second time difference between the system opening time and the installation time is less than the second time threshold, calculating the third time difference between the system opening time and the signing time;
[0023] When the third time difference is less than the authorization validity period, it is determined that the application opening verification passes.
[0024] The method for installing the application, wherein the method further comprises:
[0025] When installing a target application of a release type, the target application is verified by a package management module, and when the target application passes the verification, the target application is installed, wherein the process of verifying the target application by the package management module specifically includes:
[0026] The target application is subjected to a signature verification, and if the signature verification passes, it is determined that the target application has passed the verification.
[0027] The method for installing an application, wherein the target application is verified by a package management module, and when the target application passes the verification, after installing the target application, the method further comprises:
[0028] When an opening operation for a target application of the publication type is received, the target application of the publication type is opened in response to the opening operation.
[0029] A second aspect of the present application provides an application installation system, wherein the application installation system specifically includes:
[0030] The package management module is used to verify the target application when the application type of the target application is a debugging type, and install the target application when the target application passes the verification, wherein the process of verifying the target application by the package management module specifically includes:
[0031] Performing signature verification on the target application;
[0032] If the signature verification passes, the current system time of the electronic device on which the target application is installed, the signature time of the target application, and the authorization validity period of the profile authorization file of the application are obtained;
[0033] Verifying the signature time and the authorization validity period based on the current system time;
[0034] If the signature time and the authorization validity period are verified, it is determined that the target application is verified.
[0035] The application installation system, wherein the package management module is further used for:
[0036] Read the system time when the target application is successfully installed to obtain the installation time of the target application;
[0037] The installation time, the application package name of the target application and the authorization validity period are stored in a database as the installation information of the application, so as to verify the opening operation of the target application.
[0038] The application installation system, wherein the verifying the signature time and the authorization validity period based on the current system time specifically includes:
[0039] Calculating a first time difference between the current system time and the signature time;
[0040] Compare the first time difference with the first time threshold to verify the signature time, wherein if the first time difference is less than the first time threshold, the signature time verification passes, otherwise, the signature time verification fails;
[0041] The first time difference is compared with the authorization validity period to verify the authorization validity period, wherein if the second time difference is less than the authorization validity period, the authorization validity period verification passes, otherwise, the authorization validity period verification fails.
[0042] The application installation system, wherein a signature verification module is provided in the package management module, and the signature verification module includes a hapVerify interface, a RunVerify interface and a RemoveDebugData interface; the hapVerify interface is used to verify the target application when installing the target application, the RunVerify interface is used to verify the target application when opening the target application, and the RemoveDebugData interface is used to delete the installation information of the target application when uninstalling the target application.
[0043] The application installation system, wherein the package management module is further used to perform an application opening check on the target application through the package management module when receiving an opening operation for the target application, and open the target application when the application opening check passes, wherein the application opening check specifically includes:
[0044] Obtaining the opening system time when the opening operation is received, the installation time of the target application, the authorization validity period of the target application, and the signing time of the target application;
[0045] If the second time difference between the system opening time and the installation time is less than the second time threshold, calculating the third time difference between the system opening time and the signing time;
[0046] When the third time difference is less than the authorization validity period, it is determined that the application opening verification passes.
[0047] The application installation system, wherein the package management module is further used for:
[0048] When installing a target application of a release type, the target application is verified by a package management module, and when the target application passes the verification, the target application is installed, wherein the process of verifying the target application by the package management module specifically includes:
[0049] The target application is subjected to a signature verification, and if the signature verification passes, it is determined that the target application has passed the verification.
[0050] The application installation system, wherein the application installation system further comprises:
[0051] The response module is used for, when receiving an opening operation for a target application of the publication type, responding to the opening operation and opening the target application of the publication type.
[0052] A third aspect of the present application provides a computer-readable storage medium, which stores one or more programs. The one or more programs can be executed by one or more processors to implement the steps in the installation method of any of the above-mentioned applications.
[0053] A fourth aspect of the present application provides a terminal device, comprising: a processor and a memory;
[0054] The memory stores a computer-readable program executable by the processor;
[0055] When the processor executes the computer-readable program, the processor implements the steps in any of the above-mentioned application installation methods.
[0056] Beneficial effect: Compared with the prior art, the present application provides an application installation method, device, equipment and storage medium, wherein the application installation method specifically includes: when the application type of the target application is a debugging type, the target application is verified by a package management module, and when the target application passes the verification, the target application is installed, wherein the process of verifying the target application by the package management module specifically includes: performing signature verification on the target application; if the signature verification passes, obtaining the current system time of the electronic device on which the target application is installed, the signature time of the target application and the authorization validity period of the profile authorization file of the application; verifying the signature time and the authorization validity period based on the current system time; if the signature time and the authorization validity period pass the verification, it is determined that the target application has passed the verification. The embodiment of the present application uses the current system time to perform signature time verification and authorization validity period verification, and installs the application after both the signature time and the authorization validity period are verified, which not only ensures the security of the application, but also does not require re-digital signing when adding a new debugging device, which brings convenience to users. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0058] Figure 1 A flowchart of a method for installing an application provided in an embodiment of the present application.
[0059] Figure 2 A flowchart of a specific example of a method for installing an application provided in an embodiment of the present application.
[0060] Figure 3 A flowchart of the verification process performed by the package management module.
[0061] Figure 4 A functional block diagram of the application installation system provided in an embodiment of the present application.
[0062] Figure 5 A functional block diagram of a terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0063] The embodiments of the present application provide an application installation method, device, equipment and storage medium. To make the purpose, technical solution and effect of the present application clearer and more specific, the present application is further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0064] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present application refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.
[0065] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as those generally understood by those skilled in the art to which this application belongs. It should also be understood that terms such as those defined in general dictionaries should be understood to have meanings consistent with those in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless specifically defined as here.
[0066] It should be understood that the sequence numbers and sizes of the steps in this embodiment do not mean the order of execution. The execution order of each process is determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.
[0067] After research, it was found that applications are debugged before they are officially released, that is, there are debug versions and release versions of applications. The debug version is in the internal testing phase, so it is necessary to limit the scope of application use to avoid application leakage. To this end, it is currently common to bind the device identity with a digital signature, and then verify the digital signature when installing the application on the debug device. Although this can prevent application leakage, each time a new debug device needs to be added, the application needs to be digitally signed again, which brings inconvenience to users.
[0068] In order to solve the above problems, in an embodiment of the present application, when the application type of the target application is a debugging type, the target application is verified by the package management module, and when the target application passes the verification, the target application is installed, wherein the process of verifying the target application by the package management module specifically includes: performing signature verification on the target application; if the signature verification passes, obtaining the current system time of the electronic device where the target application is installed, the signature time of the target application, and the authorization validity period of the profile authorization file of the application; verifying the signature time and the authorization validity period based on the current system time; if the signature time and the authorization validity period pass the verification, it is determined that the target application has passed the verification. The embodiment of the present application uses the current system time to perform signature time verification and authorization validity period verification, and installs the application after both the signature time and the authorization validity period are verified. This not only ensures the security of the application, but also does not require re-digital signing when adding a new debugging device, which brings convenience to users.
[0069] The application content is further explained below through the description of embodiments in conjunction with the accompanying drawings.
[0070] This embodiment provides a method for installing an application program. Figure 1 As shown, the method includes:
[0071] S10. When the application type of the target application is a debugging type, verify the target application through a package management module.
[0072] S20: When the target application passes verification, install the target application.
[0073] Specifically, in step S10, the application type of the target application is a debug type, which means that the target application is used by the developer for self-testing and debugging, and the developer has debug-signed the target application at the development end. To this end, the target application generation process can be: compile the code into a hap package, and then debug-sign the hap through the jar command to obtain a debug-type application. Among them, when the hap is debug-signed through the jar command, the application type will be configured for the target application, so that the application type of the target application can be obtained when the target application is installed. That is to say, when the application type of the target application is a debug type, before the target application is verified by the package management module, the method also includes responding to the application installation instruction, reading the application type of the target application, to determine whether the target application is a debug-type application.
[0074] Before verifying the target application through the package management module, the first verification file trusted_root_ca.json and the second verification file trusted_apps_sources.json for verification will be obtained first. The first verification file contains the root certificate information, which is used to verify the legitimacy of the application certificate; the second verification file contains the profile certificate information, which is used to verify the legitimacy of the source of the target application. The first verification file and the second verification file can be pre-set in the system code and then written into the device by compiling and burning, or the first verification file and the second verification file can be directly transferred to the electronic device where the target application is installed using HDC.
[0075] Furthermore, in order to verify the target application through the package management module, such as Figure 2 As shown, a RunVerify interface and a RemoveDebugData interface are newly added in the signature verification module in the package management module, and a debug range verification function is configured in the hapVerify interface in the signature verification module, that is, the signature verification module in the package management module is configured with a hapVerify interface, a RunVerify interface and a RemoveDebugData interface; the hapVerify interface is used to verify the target application when installing the target application, and the verification of the target application when installing the target application includes signature verification and debug range verification, and the debug range verification is used to perform signature time verification and authorization time limit verification; the RunVerify interface is used to verify the target application when opening the target application; the RemoveDebugData interface is used to delete the installation information of the target application when uninstalling the target application.
[0076] The implementation process of the hapVerify interface remains unchanged, only the interface logic of the hapVerify interface is changed. The modified interface logic can determine the application type according to the incoming application package name. If the application type is a release type, the verification passes and returns HAP_VERIFY_RELEASE_OK; if the application type is a debug type, a signature verification and a debug range verification are performed. If the verification fails, HAP_VERIFY_TIME_ERROR is returned and the application is not allowed to be opened; if the verification passes, HAP_VERIFY_OK is returned and the application is allowed to be opened. If an error occurs in searching the database, HAP_VERIFY_FIND_ERROR is returned and the application is not allowed to be opened.
[0077] The RunVerify interface is represented by int RunVerify(const std::string bundleName);
[0078] Function parameters: application package name bundleName.
[0079] Function return value:
[0080] enum DBRunCode{
[0081] RUN_VERIFY_OK=0,
[0082] RUN_VERIFY_FIND_ERROR=-1,
[0083] RUN_VERIFY_TIME_ERROR=-2,
[0084] RUN_VERIFY_RELEASE_OK=-3,
[0085] };
[0086] RUN_VERIFY_OK indicates that the application type is debug type, the usage time is limited and the verification has passed, and the application is allowed to be opened;
[0087] RUN_VERIFY_FIND_ERROR means that the database search based on the package name fails and the application cannot be opened;
[0088] RUN_VERIFY_TIME_ERROR indicates that the application type is debugging type, the validity period verification fails, and the application is not allowed to be opened;
[0089] RUN_VERIFY_RELEASE_OK indicates that the application type is a release type, there is no validity period, and the application is allowed to be opened.
[0090] The interface logic of the RunVerify interface is:
[0091] The application type is determined based on the incoming application package name. If the application type is a release type, the verification passes and RUN_VERIFY_RELEASE_OK is returned. If the application type is a debug type, the validity period verification is performed. If the verification fails, RUN_VERIFY_TIME_ERROR is returned and the application is not allowed to be opened. If the verification passes, RUN_VERIFY_OK is returned and the application is allowed to be opened. If an error occurs in searching the database, RUN_VERIFY_FIND_ERROR is returned and the application is not allowed to be opened.
[0092] How to use the RunVerify interface:
[0093] The package management module calls the RunVerify interface every time the application is opened, and adds relevant judgment logic based on the return value to control whether the opening is allowed, and if not allowed, a pop-up interface prompts that the application has exceeded the validity period.
[0094] The RemoveDebugData interface is represented by intRemoveDebugData(const std::stringbundleName)
[0095] Function parameter: application package name
[0096] Function return value:
[0097] enumDBRemoveCode{
[0098] REMOVE_OK=0,
[0099] REMOVE_FIND_ERROR=-1,
[0100] REMOVE_DELETE_ERROR=-2,
[0101] REMOVE_RELEASE_OK=-3,
[0102] };
[0103] REMOVE_OK means the application type is debugging type and the database is deleted successfully;
[0104] REMOVE_FIND_ERROR means that the database search failed and you need to check whether the database is wrong;
[0105] REMOVE_DELETE_ERROR indicates that the application type is debugging type, and database deletion fails. You need to check whether the database is correct.
[0106] REMOVE_RELEASE_OK indicates that the application type is release type and the database does not need to be deleted;
[0107] The interface logic of the RemoveDebugData interface:
[0108] The application type is determined by searching the database based on the passed application package name. If REMOVE_FIND_ERROR is returned, it means that the database search failed. If it is a release type, REMOVE_RELEASE_OK is returned, and there is no need to delete the database. If it is a debug type, the database needs to be deleted. Returning REMOVE_OK means the deletion is successful, and returning REMOVE_DELETE_ERROR means the deletion failed.
[0109] How to use the RemoveDebugData interface:
[0110] The package management module calls this interface to delete the corresponding record in the database every time the application is uninstalled.
[0111] For example, Figure 3 As shown, the process of verifying the target application through the package management module specifically includes:
[0112] S11, performing signature verification on the target application;
[0113] S12. If the signature verification passes, a debug range verification is performed, and when the debug range verification passes, it is determined that the target application verification passes.
[0114] Specifically, in step S11, the signature verification is used to verify the security of the target application, wherein the security verification includes the legitimacy of the application certificate and the legitimacy of the source. That is, when the signature verification is performed on the target application, the application certificate and the profile certificate of the target application are verified respectively, the legitimacy of the application certificate is verified by the application certificate verification, and the legitimacy of the source of the target application is verified by the profile certificate verification.
[0115] Further, in step S12, when the signature verification passes, it indicates that the target application is safe, and a debugging range verification is performed. On the contrary, when the signature verification fails, it indicates that there is a problem with the security of the target application. In this case, the target application is directly refused to be installed, and a risk warning message is formed. Among them, when performing the debugging range verification, the verification can be performed from two aspects: the signature time and the authorization validity period, or only from the signature time. In an embodiment of the present application, when performing the debugging range verification, the verification is performed from two aspects: the signature time and the authorization validity period. For this reason, if the signature verification passes, a debugging range verification is performed, and when the debugging range verification passes, it is determined that the target application verification has passed. Specifically, it can include:
[0116] S121. If the signature verification is passed, the current system time of the electronic device on which the target application is installed, the signature time of the target application, and the authorization validity period of the profile authorization file of the application are obtained;
[0117] S122: Verify the signature time and the authorization validity period based on the current system time. When the signature time and the authorization validity period pass the verification, it is determined that the target application has passed the verification.
[0118] Specifically, in step S121, the current system time is the time when the electronic device installs the target application, that is, the response time of the installation operation, that is, when the electronic device receives the installation operation, it will respond to the installation operation and obtain the current system time. The signature time of the application is the time when the developer digitally signs the application data package of the target application, and the signature time can be obtained by parsing the profile authorization file of the target application. The authorization validity period refers to the authorized use time of the application certificate, which can also be obtained by parsing the profile authorization file of the target application.
[0119] Further, in step S122, after obtaining the current system time, signature time and authorization validity period, the signature time and authorization validity period are respectively verified by the current system time to determine whether the electronic device can install the target application of the debugging type. The verification of the signature time and the authorization validity period based on the current system time specifically includes:
[0120] Calculating a first time difference between the current system time and the signature time, and comparing the calculated first time difference with a first time threshold;
[0121] When the first time difference is less than the first time threshold, checking whether the profile authorization file is expired based on the authorization validity period;
[0122] If the profile authorization document has not expired, it is determined that the signature time and the authorization validity period are passed.
[0123] Specifically, the first time threshold is used to verify the current system time. When the first time difference is less than the first time threshold, it means that the system time is correct and the target application can continue to be installed. When the first time difference is greater than or equal to the first time threshold, it means that the system time is wrong, and the target application is refused to be installed, that is, the target application fails to be installed. The authorization validity period is used to verify whether the profile authorization file has expired. When the profile authorization file has expired, it means that the profile authorization file is in an unavailable state and the profile authorization file needs to be reissued for the target application. The target application is refused to be installed, that is, the target application fails to be installed; when the profile authorization file has not expired, the target application can continue to be installed.
[0124] The embodiment of the present application performs two checks when installing the target application, namely, a signature check and a debug range check; the security of the target application is verified by the signature check, and the electronic device on which the target application is installed is checked by the debug range check. This can ensure both the security of the target application and the compliance of the electronic device on which the target application is installed.
[0125] In one implementation of the embodiment of the present application, after the target application is installed, the installation information of the target application is also stored in a database so as to verify the use of the target application using the installation information. Based on this, when the target application passes the verification, after the target application is installed, the method further includes:
[0126] Read the system time when the target application is successfully installed to obtain the installation time of the target application;
[0127] The installation time, the application package name of the target application and the authorization validity period are stored in a database as the installation information of the application, so as to verify the opening operation of the target application.
[0128] Specifically, the system time when the target application is successfully installed refers to the time when the target application is completed installed, that is, the embodiment of the present application uses the time when the target application is completed installed as the installation time of the target application. Of course, in actual applications, the system time when the target application starts to be installed can also be used as the installation time, that is, the system time when the installation operation is responded to is used as the follow time, etc.
[0129] After obtaining the installation time, the application package name of the target application and the authorization validity period of the profile authorization file of the application are read, and then the installation time, application package name and authorization validity period are stored in the database as installation information. In addition, in actual applications, in order to further restrict the use of the target application, after obtaining the installation time, application package name and authorization validity period, the restricted use time of the target application is also obtained, and the installation time, application package name, authorization validity period and restricted use time are stored in the database as installation information.
[0130] In one implementation of the embodiment of the present application, after the installation information is stored in the database, when the target application is opened, the opening operation of the target application can be verified to determine whether the electronic device can continue to use the target application, thereby ensuring that the target application will not be abused. To this end, when the target application passes the verification, after the target application is installed, the method further includes:
[0131] When an opening operation for the target application is received, an opening application check is performed on the target application through the package management module, and the target application is opened when the opening application check passes.
[0132] Specifically, when an open operation for a target application is received, the open operation will not be responded to directly, but the target application will be verified through the package management module. The open application verification for the target application through the package management module can be performed through the newly added RunVerify interface in the signature verification module in the package management module. When the verification passes, the open operation will be responded to, and when the verification fails, the open operation will be rejected.
[0133] Furthermore, the specific process of opening the application verification may be:
[0134] Obtaining the opening system time when the opening operation is received, the installation time of the target application, the authorization validity period of the target application, and the signing time of the target application;
[0135] If the second time difference between the system opening time and the installation time is less than the second time threshold, calculating the third time difference between the system opening time and the signing time;
[0136] When the third time difference is less than the authorization validity period, it is determined that the application opening verification passes.
[0137] Specifically, the opening system time refers to the current system time when the opening operation is received, and the installation time, the authorization validity period of the target application, and the signature time of the target application can be obtained by reading the installation information of the target application. That is, when the opening operation for the target application is received, the current system time is read to obtain the opening system time, and the corresponding installation information of the target application is searched in the database according to the application package name of the target application to obtain the installation time of the target application, the authorization validity period of the target application, and the signature time of the target application.
[0138] The second time difference is the installation time of the target application on the electronic device, which is used to reflect the usage time of the target application by the electronic device; the second time threshold is the limited usage time. To this end, the second time difference is compared with the second time threshold, so as to limit the usage time of the target application by the electronic device through the second time threshold, so as to avoid the debug version of the application being used by the electronic device indefinitely, thereby playing a role in limiting the electronic device.
[0139] Furthermore, after the electronic device uses the target application for a length of time that meets the requirements, the signature time will be verified again, that is, by verifying the third time difference between the system opening time and the signature time with the authorization validity period, thereby ensuring the validity of the digital signature and the validity of the profile authorization file, thereby further ensuring the security of the target application.
[0140] In addition, in actual applications, the target application installed by the electronic device may also be a published application, and for a published application, there is no need to verify the electronic device on which the target application is installed. To this end, the application installation method further includes:
[0141] When installing a target application of a release type, the target application is verified by a package management module, and when the target application passes the verification, the target application is installed, wherein the process of verifying the target application by the package management module specifically includes:
[0142] The target application is subjected to a signature verification, and if the signature verification passes, it is determined that the target application has passed the verification.
[0143] Specifically, when the target application is of a release type, the target application is verified through the package management module, and no debugging range verification is required for the release version of the application, so only a signature verification is required, wherein the signature verification process is the same as the verification process of the adjustment type mentioned above, and will not be repeated here. In addition, in order to improve the legitimacy of the source of the application, when the signature verification is performed on the release type application, the application market certificate can be used to verify the source of the application, wherein the application market certificate is pre-issued for the application market where the application is located, and is used to verify the source of the application. That is to say, when signing a release type application, in addition to signing with an application certificate, it will also be signed with an application market certificate to verify the source of the application through the application market certificate. Of course, when verifying the source of the application through the application market certificate, the second verification file will include the application market certificate.
[0144] Furthermore, when opening a release type application, the application can be opened directly without checking the signature time and the authorization validity period. To this end, the target application is checked by the package management module, and when the target application passes the check, after installing the target application, the method further includes: when receiving an opening operation for the release type target application, responding to the opening operation, opening the release type target application.
[0145] In summary, the present embodiment provides a method for installing an application, the method for installing the application specifically includes: when the application type of the target application is a debugging type, verifying the target application through a package management module, and installing the target application when the target application passes the verification, wherein the process of verifying the target application through the package management module specifically includes: performing signature verification on the target application; if the signature verification passes, obtaining the current system time of the electronic device on which the target application is installed, the signature time of the target application, and the authorization validity period of the profile authorization file of the application; verifying the signature time and the authorization validity period based on the current system time; if the signature time and the authorization validity period pass the verification, it is determined that the target application has passed the verification. The embodiment of the present application uses the current system time to perform signature time verification and authorization validity period verification, and installs the application after both the signature time and the authorization validity period are verified. This not only ensures the security of the application, but also does not require re-digital signing when adding a new debugging device, which brings convenience to users.
[0146] Based on the above-mentioned application installation method, the present application embodiment provides an application installation system, such as Figure 4 As shown, the application installation system specifically includes:
[0147] The package management module 100 is used to verify the target application when the application type of the target application is a debugging type, and to install the target application when the target application passes the verification. The process of verifying the target application by the package management module specifically includes:
[0148] Performing signature verification on the target application;
[0149] If the signature verification passes, the current system time of the electronic device on which the target application is installed, the signature time of the target application, and the authorization validity period of the profile authorization file of the application are obtained;
[0150] Verifying the signature time and the authorization validity period based on the current system time;
[0151] If the signature time and the authorization validity period are verified, it is determined that the target application is verified.
[0152] The application installation system, wherein the package management module is further used for:
[0153] Read the system time when the target application is successfully installed to obtain the installation time of the target application;
[0154] The installation time, the application package name of the target application and the authorization validity period are stored in a database as the installation information of the application, so as to verify the opening operation of the target application.
[0155] The application installation system, wherein the verifying the signature time and the authorization validity period based on the current system time specifically includes:
[0156] Calculating a first time difference between the current system time and the signature time;
[0157] Compare the first time difference with the first time threshold to verify the signature time, wherein if the first time difference is less than the first time threshold, the signature time verification passes, otherwise, the signature time verification fails;
[0158] The first time difference is compared with the authorization validity period to verify the authorization validity period, wherein if the second time difference is less than the authorization validity period, the authorization validity period verification passes, otherwise, the authorization validity period verification fails.
[0159] The application installation system, wherein a signature verification module is provided in the package management module, and the signature verification module includes a hapVerify interface, a RunVerify interface and a RemoveDebugData interface; the hapVerify interface is used to verify the target application when installing the target application, the RunVerify interface is used to verify the target application when opening the target application, and the RemoveDebugData interface is used to delete the installation information of the target application when uninstalling the target application.
[0160] The application installation system, wherein the package management module is further used to perform an application opening check on the target application through the package management module when receiving an opening operation for the target application, and open the target application when the application opening check passes, wherein the application opening check specifically includes:
[0161] Obtaining the opening system time when the opening operation is received, the installation time of the target application, the authorization validity period of the target application, and the signing time of the target application;
[0162] If the second time difference between the system opening time and the installation time is less than the second time threshold, calculating the third time difference between the system opening time and the signing time;
[0163] When the third time difference is less than the authorization validity period, it is determined that the application opening verification passes.
[0164] The application installation system, wherein the package management module is further used for:
[0165] When installing a target application of a release type, the target application is verified by a package management module, and when the target application passes the verification, the target application is installed, wherein the process of verifying the target application by the package management module specifically includes:
[0166] The target application is subjected to a signature verification, and if the signature verification passes, it is determined that the target application has passed the verification.
[0167] The application installation system, wherein the application installation system further comprises:
[0168] The response module is used for, when receiving an opening operation for a target application of the publication type, responding to the opening operation and opening the target application of the publication type.
[0169] Based on the above-mentioned application installation method, this embodiment provides a computer-readable storage medium, which stores one or more programs. The one or more programs can be executed by one or more processors to implement the steps in the application installation method as described in the above-mentioned embodiment.
[0170] Based on the above application installation method, the present application also provides a terminal device, such as Figure 5 As shown, it includes at least one processor (processor) 20; display screen 21; and memory (memory) 22, and may also include a communications interface (Communications Interface) 23 and a bus 24. Among them, the processor 20, the display screen 21, the memory 22 and the communication interface 23 can communicate with each other through the bus 24. The display screen 21 is configured to display a preset user guide interface in the initial setting mode. The communication interface 23 can transmit information. The processor 20 can call the logic instructions in the memory 22 to execute the method in the above embodiment.
[0171] In addition, the logic instructions in the memory 22 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product.
[0172] The memory 22 is a computer-readable storage medium that can be configured to store software programs, computer executable programs, such as program instructions or modules corresponding to the methods in the embodiments of the present disclosure. The processor 20 executes functional applications and data processing by running the software programs, instructions or modules stored in the memory 22, that is, implementing the methods in the above embodiments.
[0173] The memory 22 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 22 may include a high-speed random access memory and may also include a non-volatile memory. For example, a variety of media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, may also be a transient storage medium.
[0174] In addition, the specific process of loading and executing the multiple instruction processors in the above storage medium and the terminal device has been described in detail in the above method and will not be described here one by one.
[0175] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for installing an application, characterized in that: The application installation method specifically includes: When the application type of the target application is a debugging type, the target application is verified by the package management module, and when the target application passes the verification, the target application is installed, wherein the process of verifying the target application by the package management module specifically includes: Performing signature verification on the target application; If the signature verification passes, the current system time of the electronic device where the target application is installed, the signing time of the target application, and the authorization validity period of the profile authorization file of the application are obtained; Verifying the signature time and the authorization validity period based on the current system time; If the signature time and the authorization validity period are verified, it is determined that the target application is verified.
2. The method for installing an application according to claim 1, characterized in that: When the target application passes the verification, after installing the target application, the method further includes: Read the system time when the target application is successfully installed to obtain the installation time of the target application; The installation time, the application package name of the target application and the authorization validity period are stored in a database as the installation information of the application, so as to verify the opening operation of the target application.
3. The method for installing an application according to claim 1, characterized in that: The verifying the signature time and the authorization validity period based on the current system time specifically includes: Calculating a first time difference between the current system time and the signature time, and comparing the calculated first time difference with a first time threshold; When the first time difference is less than the first time threshold, checking whether the profile authorization file is expired based on the authorization validity period; If the profile authorization file has not expired, it is determined that the signature time and the authorization validity period are passed.
4. The method for installing an application according to claim 1, characterized in that: A signature verification module is provided in the package management module, and the signature verification module includes a hapVerify interface, a RunVerify interface and a RemoveDebugData interface; the hapVerify interface is used to verify the target application when installing the target application, the RunVerify interface is used to verify the target application when opening the target application, and the RemoveDebugData interface is used to delete the installation information of the target application when uninstalling the target application.
5. The method for installing an application according to claim 1 or 4, characterized in that: When the target application passes the verification, after installing the target application, the method further includes: When an opening operation for the target application is received, the target application is checked for opening application by the package management module, and the target application is opened when the opening application check passes, wherein the opening application check specifically includes: Obtaining the opening system time when the opening operation is received, the installation time of the target application, the authorization validity period of the target application, and the signing time of the target application; If the second time difference between the system opening time and the installation time is less than the second time threshold, calculating the third time difference between the system opening time and the signature time; When the third time difference is less than the authorization validity period, it is determined that the application opening verification passes.
6. The method for installing an application according to claim 1, characterized in that: The method further comprises: When installing a target application of a release type, the target application is verified by a package management module, and when the target application passes the verification, the target application is installed, wherein the process of verifying the target application by the package management module specifically includes: A signature verification is performed on the target application, and if the signature verification passes, it is determined that the target application has passed the verification.
7. The method for installing an application according to claim 6, characterized in that: The target application is verified by the package management module, and when the target application passes the verification, after installing the target application, the method further includes: When an opening operation for a target application of the publication type is received, the target application of the publication type is opened in response to the opening operation.
8. An application installation system, characterized in that: The application installation system specifically includes: The package management module is used to verify the target application when the application type of the target application is a debugging type, and install the target application when the target application passes the verification, wherein the process of verifying the target application by the package management module specifically includes: Performing signature verification on the target application; If the signature verification passes, the current system time of the electronic device where the target application is installed, the signing time of the target application, and the authorization validity period of the profile authorization file of the application are obtained; Verifying the signature time and the authorization validity period based on the current system time; If the signature time and the authorization validity period are verified, it is determined that the target application is verified.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps in the method for installing the application according to any one of claims 1 to 7.
10. A terminal device, characterized in that: include: Processor and memory; The memory stores a computer-readable program executable by the processor; When the processor executes the computer-readable program, the processor implements the steps in the method for installing the application program according to any one of claims 1 to 7.
Citation Information
Patent Citations
Software package certificateprotection method and device
CN103544411A
Method and system for verifying user authorization certificate through verifying authorization time
CN105553668A
Software product legitimacy verification method, apparatus and system
CN106657137A
Installation method, device, computer device and storage medium for application program
CN109408074A
Application program monitoring method and device
CN112861191A