CN113761587A - Method and device for signature verification - Google Patents

Method and device for signature verification Download PDF

Info

Publication number
CN113761587A
CN113761587A CN202011006043.2A CN202011006043A CN113761587A CN 113761587 A CN113761587 A CN 113761587A CN 202011006043 A CN202011006043 A CN 202011006043A CN 113761587 A CN113761587 A CN 113761587A
Authority
CN
China
Prior art keywords
application
signature information
source
signature
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011006043.2A
Other languages
Chinese (zh)
Inventor
张亚庆
杜凡
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202011006043.2A priority Critical patent/CN113761587A/en
Publication of CN113761587A publication Critical patent/CN113761587A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Bioethics (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Databases & Information Systems (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the disclosure discloses a method and a device for signature verification. One embodiment of the method comprises: in response to detecting the launching of the application, performing the following checking steps: acquiring source signature information of an application, wherein the source signature information is encoded in the application in advance and is used for representing a source digital certificate of the application; acquiring and analyzing the applied signature file to obtain signature information to be verified; determining whether the signature information to be verified is consistent with the source signature information; in response to determining that the signature information to be verified is inconsistent with the source signature information, generating hint information for prompting the application to be re-signed. This embodiment enables signature verification for applications.

Description

Method and device for signature verification
Technical Field
The embodiment of the disclosure relates to the technical field of computers, in particular to a method and a device for signature verification.
Background
With the rapid development of mobile internet and the popularization of mobile terminal devices, rapid development of app (application) is brought. APP expands the functions and services of mobile terminal devices and is changing people's lifestyle. Therefore, APP development with mobile terminal devices as platforms is one of the hot entrepreneurs.
At present, with the development technology of the mobile internet also making great progress, the technical threshold of APP development is also getting lower. Not only professional developers can develop APP, but even any ordinary user can utilize development tools of some third parties to develop APP. This provides convenience to many creative users, as well as opportunities to some malicious attackers.
Malicious tampering of APP is one of the main security issues faced by current APP development. Some malicious attackers achieve various purposes by tampering with the APP. For example, stealing user privacy information, modifying system permissions to access various system resources, binding installation of certain plug-ins, and the like. For the situation, the mobile terminal system provides a signature mechanism to verify whether the installed application is authentic, and the method can avoid the situation that the application is tampered by a third party to a certain extent.
Disclosure of Invention
The embodiment of the disclosure provides a method and a device for signature verification.
In a first aspect, an embodiment of the present disclosure provides a method for signature verification, the method including: in response to detecting the launching of the application, performing the following checking steps: acquiring source signature information of an application, wherein the source signature information is encoded in the application in advance and is used for representing a source digital certificate of the application; acquiring and analyzing the applied signature file to obtain signature information to be verified; determining whether the signature information to be verified is consistent with the source signature information; in response to determining that the signature information to be verified is inconsistent with the source signature information, generating hint information for prompting the application to be re-signed.
In some embodiments, the obtaining source signature information of the application includes: acquiring the coding position of the source signature information by using a reflection technology; source signature information is obtained from the encoding locations.
In some embodiments, the obtaining and parsing the signature file of the application includes: and acquiring the signature file of the application by using a reflection technology.
In some embodiments, the verification step is performed at the Native layer of the application.
In some embodiments, the source signature information is pre-encoded in the application by hard-coding.
In some embodiments, the source signature information is pre-encoded in the application by means of encrypted storage.
In some embodiments, the above method further comprises: in response to determining that the source signature information fails to be obtained from the encoded location, generating a hint for prompting the application for an exception.
In a second aspect, an embodiment of the present disclosure provides an apparatus for signature verification, the apparatus including: a verification unit configured to perform, in response to detecting the start of the application, a verification step of: acquiring source signature information of an application, wherein the source signature information is encoded in the application in advance and is used for representing a source digital certificate of the application; acquiring and analyzing the applied signature file to obtain signature information to be verified; determining whether the signature information to be verified is consistent with the source signature information; in response to determining that the signature information to be verified is inconsistent with the source signature information, generating hint information for prompting the application to be re-signed.
In some embodiments, the verifying step further comprises: acquiring the coding position of the source signature information by using a reflection technology; source signature information is obtained from the encoding locations.
In some embodiments, the verifying step further comprises: and acquiring the signature file of the application by using a reflection technology.
In some embodiments, the verification step is performed at the Native layer of the application.
In some embodiments, the source signature information is pre-encoded in the application by hard-coding.
In some embodiments, the source signature information is pre-encoded in the application by means of encrypted storage.
In some embodiments, the verifying step further comprises: in response to determining that the source signature information fails to be obtained from the encoded location, generating a hint for prompting the application for an exception.
In a third aspect, an embodiment of the present disclosure provides a terminal, including: one or more processors; storage means for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the method as described in any implementation of the first aspect.
In a fourth aspect, embodiments of the present disclosure provide a computer-readable medium on which a computer program is stored, which computer program, when executed by a processor, implements the method as described in any of the implementations of the first aspect.
According to the method for signature verification, when the application is started, the source signature information which is coded in advance and used for representing the source digital certificate of the application is directly obtained from the application, the signature information to be verified in the signature file is analyzed, whether the signature information to be verified is consistent with the source signature information of the application or not is compared, if the signature information to be verified is not consistent with the source signature information of the application, the fact that the application is possibly re-signed is prompted to a user, and therefore signature verification of the application is achieved.
Drawings
Other features, objects and advantages of the disclosure will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is an exemplary system architecture diagram in which one embodiment of the present disclosure may be applied;
FIG. 2 is a flow diagram for one embodiment of a method for signature verification according to the present disclosure;
FIG. 3 is a schematic diagram of one application scenario of a method for signature verification according to an embodiment of the present disclosure;
FIG. 4 is a flowchart of one embodiment of a verification step for signature verification for Android applications;
FIG. 5 is a schematic diagram illustrating one embodiment of an apparatus for signature verification according to the present disclosure;
FIG. 6 is a schematic structural diagram of an electronic device suitable for use in implementing embodiments of the present disclosure.
Detailed Description
The present disclosure is described in further detail below with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that, in the present disclosure, the embodiments and features of the embodiments may be combined with each other without conflict. The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 illustrates an exemplary architecture 100 to which embodiments of the disclosed method for signature verification or apparatus for signature verification may be applied.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The terminal devices 101, 102, 103 interact with a server 105 via a network 104 to receive or send messages or the like. Various client applications may be installed on the terminal devices 101, 102, 103. Such as browser-like applications, application management-like applications, shopping-like applications, instant messaging tools, social platform software, system security-like applications, and so forth.
The terminal apparatuses 101, 102, and 103 may be hardware or software. When the terminal devices 101, 102, 103 are hardware, they may be various electronic devices including, but not limited to, smart phones, tablet computers, e-book readers, laptop portable computers, desktop computers, and the like. When the terminal apparatuses 101, 102, 103 are software, they can be installed in the electronic apparatuses listed above. It may be implemented as multiple pieces of software or software modules (e.g., multiple pieces of software or software modules to provide distributed services) or as a single piece of software or software module. And is not particularly limited herein.
The server 105 may be a server providing various services, such as a server providing back-end support for client applications installed on the terminal devices 101, 102, 103. The server 105 may send the installation package of the application to the terminal devices 101, 102, and 103 according to the requests of the terminal devices 101, 102, and 103, and then the terminal device may perform processing such as verification on the installation package, and if the verification is successful, the corresponding application may be further installed. The terminal device 101, 102, 103 may then start and run the application.
It should be noted that the above application may be started and run locally in the terminal devices 101, 102, and 103 offline, and in this case, the server 105 and the network 104 may not exist.
It should be noted that the method for signature verification provided by the embodiments of the present disclosure is generally performed by the terminal devices 101, 102, 103, and accordingly, the apparatus for signature verification is generally disposed in the terminal devices 101, 102, 103.
It should also be noted that the application may also be installed locally in the server 105 using the installation package of the application, and then the application is started and run. At this time, the method for signature verification may be executed by the server 105, and accordingly, the apparatus for signature verification may be provided in the server 105. At this point, exemplary system architecture 100 may be absent of terminal devices 101, 102, 103 and network 104.
The server 105 may be hardware or software. When the server 105 is hardware, it may be implemented as a distributed server cluster composed of a plurality of servers, or may be implemented as a single server. When the server 105 is software, it may be implemented as multiple pieces of software or software modules (e.g., multiple pieces of software or software modules used to provide distributed services), or as a single piece of software or software module. And is not particularly limited herein.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continued reference to FIG. 2, a flow 200 of one embodiment of a method for signature verification in accordance with the present disclosure is shown. The method for signature verification comprises the following steps:
step 201, in response to detecting the start of the application, the following verification steps 2011-:
in the present embodiment, an Application (Application), that is, an Application program, refers to a computer program developed to run on an operating system (e.g., an Android operating system) in order to complete a specified task.
Generally, a user may download an installation package (Install Pack) of an application first, and then complete installation of the application by running the installation package, and after successfully installing the application, may use a function or service provided by the application by starting and running the application. The installation package of the application is usually a collection of files that can be decompressed by itself, and may include all the files required for installing the application.
It should be understood that the format of the installation packages for different operating systems, different applications, and the like may vary. For example, an installation package of an Android application generally uses a file format of "APK" (Android application package). An installation package of an Android application typically includes compiled code files (. dex files), file resources (resources), native resource files (assets), certificates (certifies), manifest files (manifest files), and the like.
Generally, the installation of the application can be realized by running an installation package of the application in a decompression manner and the like. After the installation of the application is completed, a terminal system in which the application is located generates many files of the application. For example, for the Android system, after an application is installed, one or more folders corresponding to the application are generated to store various files (such as cache files) or data of the application.
In the present embodiment, the execution subject of the method for signature verification (e.g., terminal apparatuses 101, 102, 103 shown in fig. 1) may determine whether the start of the application is detected by detecting whether a start command of the application is received to start and run the application. Generally, if it is detected that a start command of an application is received, it can be considered that the start of the application is detected.
In step 2011, source signature information for the application is obtained.
In this embodiment, the source signature information of the application may indicate a source digital certificate that is employed by the authentic, trusted signature of the application. The digital certificate, also called digital identifier, usually refers to a digital certificate that identifies identity information of each party in internet communication, so that the digital certificate can be used to identify the identity of the other party. The digital certificate can ensure the integrity and safety of information and data in the computer network traffic of network users in an encrypted or decrypted form.
Generally, after the application development is completed, a related technician (such as an application developer) may sign an installation package of the application by using a preset digital certificate, so as to ensure security of information carried by the installation package and a transmission process of the installation package, and avoid a situation that the application is modified by a malicious attacker or the like. As used herein, a digital certificate is a source digital certificate for the application that may be used to characterize the identity of the source signer, i.e., the trusted signer, of the application.
Specifically, the installation package of the application may be signed using various existing methods. For example, the application may be signed directly using a signature method provided by the development tool of the application. For another example, the application may be signed using a signature tool developed by a third party.
The source signature information of the application may be written in advance in a specified file of the application, so that the execution subject may obtain the source signature information of the application written in advance from the specified file of the application.
Step 2012, the signature file of the application is obtained and analyzed to obtain the signature information to be verified.
In this embodiment, the executing entity may first obtain a signature file of the application, and then parse the signature file to obtain signature information to be verified, which is stored in the signature file. The signature file may refer to a file generated after the application is signed and used for verifying the signature of the application.
For example, taking an Android application as an example, after an installation package (such as an apk file) of the Android application is signed, a folder named META-INF is generated, and a plurality of signature files (including cert.rsa, cert.sf, maincast.mf, etc.) are stored in the folder.
Generally, the content format in the applied signature file is generated according to a fixed or preset format, so that the signature file can be parsed according to the content format corresponding to the signature file to obtain the signature information to be verified.
Step 2013, determining whether the signature information to be verified is consistent with the source signature information.
In this embodiment, whether the signature information to be verified is consistent with the source signature information may be compared, and if the signature information to be verified is consistent with the source signature information, it may be considered that the application is not tampered and belongs to a trusted application, so that the execution principal may continue to run the installation package of the application to complete installation of the application.
Step 2014, in response to determining that the signature information to be verified is inconsistent with the source signature information, generating prompt information for prompting the application to be re-signed.
In this embodiment, if the signature information to be verified is not identical to the source signature information, it may be considered that the digital certificate used for applying the current signature is different from the source digital certificate, that is, the application is re-signed and belongs to a suspicious application, so that the running of the application may be suspended, and prompt information may be generated to prompt the user that the application is re-signed.
In some optional implementations of this embodiment, the source signature information of the application may be pre-encoded in the application by a hard-coding method. The source signature information of the application can be hard-coded in the code or the file of the application in advance, so that the verification of the application signature is facilitated, and meanwhile, the performance of the application can be improved.
Alternatively, the source signature information of the application may be pre-encoded in the target profile. Wherein the target configuration file may be a file that is specified or set in advance by a technician in order to quickly acquire the source signature information of the application.
Alternatively, the source signature information of the application may be pre-encoded in the application by means of encrypted storage. For example, the source signature information of the application is stored in the target configuration file by encryption. Therefore, the safety of the source signature information of the application can be improved, and a malicious attacker is prevented from cracking the source signature information of the application through means of decompilation, brute force cracking and the like.
At this time, the encryption key of the source signature information may be directly encoded in the code or file of the application without adopting a hard coding manner, and is transferred to the decryption method through conversion storage (for example, as a form of byte array, etc.), so as to further improve the security of the source signature information of the application.
In some optional implementations of this embodiment, when the signature of the application is verified, the source signature information of the application may be obtained by using a reflection technique. Specifically, the encoding position of the source signature information of the application may be obtained by using the reflection technique, and then the source signature information of the application may be obtained from the encoding position.
Wherein, the encoding position may indicate the storage position of the source signature information of the application. For example, when the source signature information of the application is hard-coded in the specified configuration file, the coding position may indicate the position of the specified configuration file in each file corresponding to the application (e.g., the storage path of the specified configuration file). After the encoding position of the source signature information of the application is obtained, the source signature information of the application can be directly obtained from the position indicated by the encoding position.
Reflection technology is the ability of a program to access, detect, and modify its own state or behavior. For example, a program in a running state may know all properties and methods of any class by using a reflection technology, and call any method and property of any object by using a reflection technology.
In some optional implementation manners of this embodiment, a reflection technology may be used to obtain a signature file of an application, and then the signature file is parsed to obtain signature information to be verified therein.
The reflection technology is utilized to obtain the contents of the source signature information of the application, the signature information to be verified and the like, so that the flexibility of the application in development can be improved, and the situation that the application is tampered by a third party can be further avoided.
In some optional implementations of this embodiment, the verification step may run at a Native layer of the application.
Signature verification algorithms for many existing applications typically run at the JAVA layer, so that these algorithms are easily analyzed in reverse, so that a tamperer removes code for signature verification or modifies processing logic of signature verification, etc. to bypass the signature verification process. And the signature verification step of the application is realized in a Native layer, so that the difficulty of reverse analysis can be increased, the difficulty of tampering the application is improved, and the risk of tampering the application by decompilation is reduced.
In some optional implementation manners of this embodiment, in the process of executing the verification step 2011-2014, if any one of the steps fails to be executed, prompt information may be generated to prompt the user that the application may have an abnormality.
For example, when the encoding position of the source signature information of the application is acquired by using a transmission technology, if the encoding position of the source signature information of the application cannot be acquired, it can be considered that the content in the installation package of the application may have been tampered and belongs to an untrusted application at present, so that the prompt information is presented to the user to prompt that the application is abnormal, and then the operation of the application can be temporarily stopped first, thereby avoiding the situations that the system is damaged or the user information is leaked due to the abnormal operation of the application.
For another example, after the code position of the source signature information of the application is obtained, when the source signature information of the application is obtained through decryption, if the source signature information of the application cannot be decrypted, it may also be considered that the content in the installation package of the application may have been tampered and currently belongs to an untrusted application, so that a prompt message is presented to a user to prompt that the application is abnormal, and then the operation of the application may be temporarily stopped first, thereby avoiding the situations that the system is damaged or the user information is leaked due to the abnormal operation of the application.
When the application signature is verified by the verification step, the execution condition of each process in the verification step is detected in time, and if the execution fails, abnormity can be timely reminded to a user, so that the verification on the application security is further improved.
As can be understood from the above description in this embodiment, for an application to be verified, it is necessary to encode source signature information of the application in advance, write signature verification logic for performing the verification step at a Native layer, and the like. The signature verification logic for executing the verification steps can be implemented as a script file, so that the verification is automatically executed when the installation package of the application runs.
In the actual application process, according to different application requirements and application scenarios, an application developer can also increase the cost and difficulty of reverse analysis of the application by adding a counter-debugging detection means in the code, adopting methods such as obfuscation processing on key functions in the code and the like when developing the application, thereby further reducing the risk of tampering the application.
With continued reference to fig. 3, fig. 3 is an exemplary application scenario 300 of the method for signature verification according to the present embodiment. In the application scenario of fig. 3, a user may start a target application 302 in a terminal 301 used by the user to use the target application, and then may verify the target application 302.
Specifically, the source signature information 3021 of the target application, which is encoded in advance in the target application 302, may be obtained first, then the signature information 3022 to be verified is parsed from the signature of the target application 302, and then whether the source signature information 3021 and the signature information 3022 to be verified are consistent or not may be compared, so as to obtain the matching result 303. If the match result 303 indicates that the source signature information 3021 and the signature information 3022 to be verified do not match, a prompt may be generated such that the prompt "the installed application has been re-signed, there is a security risk, please confirm whether to continue running the application! And performing corresponding processing according to the selection of 'continuously running' or 'quitting the application' by the user. And if the user selects 'continue running', the target application is continuously and normally run. And if the user selects 'quit the application', quitting the running of the target application.
In the prior art, a part of operating systems use a relatively open ecosystem, and any person can develop and release applications for use by other persons. With this, after the attacker modifies the files in the installation package of the application, the attacker can use the digital certificate set by the attacker to re-sign the modified installation package and then issue the re-signed installation package. At this time, when the system installs the re-signed application, it is usually only able to check the integrity of the file in the installation package, but it is not able to check whether the source of the digital certificate is authentic, so for the re-signed application of the attacker, it is able to pass the integrity check, so that the user can still install and use the re-signed application of the attacker.
For the security problem, most of the existing signature verification algorithms need to call a system API (Application Programming Interface) to implement signature verification of an Application, so as to determine whether a source of a digital certificate used by a current signature of the Application is trusted, that is, whether the digital certificate is a source digital certificate, and whether the Application is re-signed. As an example, some signature verification algorithms obtain a package manager by calling context.
However, an attacker can perform a Hook attack on the system API through a Hook tool (such as Xposed, Frida, etc.) to return the signature information in a Hook function, thereby bypassing the signature verification process.
The method provided by the embodiment of the disclosure aims at the problem that the existing signature verification algorithm is easy to bypass the signature verification process by an attacker through a Hook tool and the like, and directly acquires the source signature information which is pre-coded in the application when the application is started, and directly acquires the signature information to be verified from the signature file without calling a system API (application programming interface) to realize signature verification, so that the situation that the attacker bypasses the signature verification through the Hook attack and other means is avoided, and the application safety is further improved.
With further reference to fig. 4, a flow 400 of one embodiment of a verification step for signature verification for Android applications is shown, comprising the steps of:
step 401, a file path of a target file pre-encoded with source signature information of an application is obtained by using a reflection technology.
In this embodiment, a pre-programmed reflection class (e.g., a LoadedApk class) may be used to obtain a file path of a target file. Wherein, the source signature information of the application can be hard-coded in advance in the target file.
As an example, the file path of the target file may be "/xx/y.apk/zz". Wherein, "/xx" can refer to a path named "xx" folder in the Android storage system. Apk may refer to the name of the installation package of the application. "zz" may refer to the name of the target file.
Step 402, obtaining source signature information of the application from a file path of the target file.
After the file path of the target file is acquired, the source signature information stored in the target file can be directly read from the target file.
And step 403, acquiring a file path of the signature file of the application by using a reflection technology.
In this embodiment, a pre-written reflection class (e.g., LoadedApk class) may also be used to obtain a file path of a signature file of an application. At present, signature files of Android applications are all stored under a folder named META-INF. Specifically, three signature files of cert.rsa, cert.sf and maincast.mf are included under the folder of META-INF.
As an example, the file path of the signature file may be "/xx/y.apk/cert.rsa".
Step 404, the signature file is analyzed by using the file path of the signature file to obtain the signature information to be verified.
After the file path of the applied signature file is obtained, the signature file can be directly analyzed to read the signature information to be verified stored in the signature file. For example, the cert.rsa signature file generally adopts a standard PKCS #7 format, and thus the cert.rsa signature file can be parsed according to the standard PKCS #7 format to extract signature information to be verified therefrom.
It should be noted that, according to different practical application requirements, the signature file may be one or more of the three signature files cert.rsa, cert.sf, and maincast.mf. Of course, with the development of the Android system, more signature files may exist, and the three signature files may be updated. It should be understood that no matter how the name, number or format of the signature files are changed, the execution of the signature verification method provided by the present disclosure is not affected.
Step 405, determining whether the signature information to be verified is consistent with the source signature information.
At step 406, in response to determining that the signature information to be verified is inconsistent with the source signature information, prompt information for prompting the application to be re-signed is generated.
The execution process not described in detail in this embodiment may refer to the related description in the corresponding embodiment of fig. 2, and is not described herein again.
The method for signature verification provided by the embodiment of the disclosure is directed at the application of an Android system, and is implemented by obtaining source signature information hard-coded in a target file and signature information to be verified in a signature file by using a reflection class which is written in advance, and then judging whether the application is re-signed or not by comparing whether the obtained source signature information is consistent with the signature information to be verified or not, so that signature verification of the Android application is implemented on the basis of avoiding calling a system API.
With further reference to fig. 5, as an implementation of the methods shown in the above-mentioned figures, the present disclosure provides an embodiment of an apparatus for signature verification, which corresponds to the method embodiment shown in fig. 2, and which may be applied in various electronic devices in particular.
As shown in fig. 5, the apparatus 500 for signature verification provided in the present embodiment includes a verification unit 501. Wherein the verification unit 501 is configured to: in response to detecting the launching of the application, performing the following checking steps: acquiring source signature information of an application, wherein the source signature information is encoded in the application in advance and is used for representing a source digital certificate of the application; acquiring and analyzing the applied signature file to obtain signature information to be verified; determining whether the signature information to be verified is consistent with the source signature information; in response to determining that the signature information to be verified is inconsistent with the source signature information, generating hint information for prompting the application to be re-signed.
In the present embodiment, in the apparatus 500 for signature verification: the detailed processing of the verification unit 501 and the technical effects thereof can refer to the related description of step 201 in the corresponding embodiment of fig. 2, and are not repeated herein.
In some optional implementation manners of this embodiment, the verifying step further includes: acquiring the coding position of the source signature information by using a reflection technology; source signature information is obtained from the encoding locations.
In some optional implementation manners of this embodiment, the verifying step further includes: and acquiring the signature file of the application by using a reflection technology.
In some optional implementations of the present embodiment, the verifying step is performed at a Native layer of the application.
In some optional implementations of this embodiment, the source signature information is pre-encoded in the application by hard coding.
In some optional implementations of this embodiment, the source signature information is pre-encoded in the application by means of encrypted storage.
In some optional implementation manners of this embodiment, the verifying step further includes: in response to determining that the source signature information fails to be obtained from the encoded location, generating a hint for prompting the application for an exception.
The apparatus provided by the foregoing embodiment of the present disclosure, in response to detecting the running of the installation package of the application, executes the following verification steps by using the verification unit: acquiring source signature information of an application from an installation package, wherein the source signature information is encoded in the application in advance; acquiring and analyzing the applied signature file to obtain signature information to be verified; determining whether the signature information to be verified is consistent with the source signature information; in response to determining that the signature information to be verified is inconsistent with the source signature information, generating hint information for prompting the application to be re-signed. Therefore, signature verification can be realized without calling a system API, and the condition that an attacker bypasses the signature verification through means such as Hook attack and the like is avoided.
Referring now to fig. 6, shown is a schematic diagram of an electronic device (e.g., terminal device in fig. 1) 600 suitable for use in implementing embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a fixed terminal such as a digital TV, a desktop computer, and the like. The terminal device shown in fig. 6 is only an example, and should not bring any limitation to the functions and the use range of the embodiments of the present disclosure.
As shown in fig. 6, electronic device 600 may include a processing means (e.g., central processing unit, graphics processor, etc.) 601 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage means 608 into a Random Access Memory (RAM) 603. In the RAM603, various programs and data necessary for the operation of the electronic apparatus 600 are also stored. The processing device 601, the ROM 602, and the RAM603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
Generally, the following devices may be connected to the I/O interface 605: input devices 606 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 607 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 608 including, for example, tape, hard disk, etc.; and a communication device 609. The communication means 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. While fig. 6 illustrates an electronic device 600 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided. Each block shown in fig. 6 may represent one device or may represent multiple devices as desired.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication means 609, or may be installed from the storage means 608, or may be installed from the ROM 602. The computer program, when executed by the processing device 601, performs the above-described functions defined in the methods of embodiments of the present disclosure.
It should be noted that the computer readable medium described in the embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In embodiments of the disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In embodiments of the present disclosure, however, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the terminal; or may exist separately and not be assembled into the terminal. The computer readable medium carries one or more programs which, when executed by the terminal device, cause the terminal to: in response to detecting the launching of the application, performing the following checking steps: acquiring source signature information of an application, wherein the source signature information is encoded in the application in advance and is used for representing a source digital certificate of the application; acquiring and analyzing the applied signature file to obtain signature information to be verified; determining whether the signature information to be verified is consistent with the source signature information; in response to determining that the signature information to be verified is inconsistent with the source signature information, generating hint information for prompting the application to be re-signed.
Computer program code for carrying out operations for embodiments of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes a verification unit. Where the names of the units do not in some cases constitute a limitation of the unit itself, for example, a verification unit may also be described as a "unit that performs the following verification steps in response to detecting the start of an application: acquiring source signature information of an application, wherein the source signature information is encoded in the application in advance and is used for representing a source digital certificate of the application; acquiring and analyzing the applied signature file to obtain signature information to be verified; determining whether the signature information to be verified is consistent with the source signature information; in response to determining that the signature information to be verified is inconsistent with the source signature information, generating hint information for prompting the application to be re-signed.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention in the embodiments of the present disclosure is not limited to the specific combination of the above-mentioned features, but also encompasses other embodiments in which any combination of the above-mentioned features or their equivalents is made without departing from the inventive concept as defined above. For example, the above features and (but not limited to) technical features with similar functions disclosed in the embodiments of the present disclosure are mutually replaced to form the technical solution.

Claims (10)

1. A method for signature verification, comprising:
in response to detecting the launching of the application, performing the following checking steps:
acquiring source signature information of the application, wherein the source signature information is encoded in the application in advance and is used for representing a source digital certificate of the application;
acquiring and analyzing the signature file of the application to obtain signature information to be verified;
determining whether the signature information to be verified is consistent with the source signature information;
and generating prompt information for prompting the application to be re-signed in response to determining that the signature information to be verified is inconsistent with the source signature information.
2. The method of claim 1, wherein the obtaining source signature information for the application comprises:
acquiring the coding position of the source signature information by using a reflection technology;
and acquiring the source signature information from the coding position.
3. The method of claim 1, wherein the obtaining and parsing the signature file of the application comprises:
and acquiring the signature file of the application by using a reflection technology.
4. The method of claim 1, wherein the verifying step is performed at a Native layer Native of the application.
5. The method of claim 1, wherein the source signature information is pre-encoded in the application by hard-coding.
6. The method of claim 5, wherein the source signature information is pre-encoded in the application by way of encrypted storage.
7. The method of claim 2, wherein the method further comprises:
in response to determining that the source signature information fails to be obtained from the encoded location, generating a prompt for prompting the application for an exception.
8. An apparatus for signature verification, wherein the apparatus comprises:
a verification unit configured to perform, in response to detecting the start of the application, a verification step of:
acquiring source signature information of the application, wherein the source signature information is encoded in the application in advance and is used for representing a source digital certificate of the application;
acquiring and analyzing the signature file of the application to obtain signature information to be verified;
determining whether the signature information to be verified is consistent with the source signature information;
and generating prompt information for prompting the application to be re-signed in response to determining that the signature information to be verified is inconsistent with the source signature information.
9. A terminal, comprising:
one or more processors;
a storage device having one or more programs stored thereon;
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.
10. A computer-readable medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-7.
CN202011006043.2A 2020-09-23 2020-09-23 Method and device for signature verification Pending CN113761587A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011006043.2A CN113761587A (en) 2020-09-23 2020-09-23 Method and device for signature verification

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011006043.2A CN113761587A (en) 2020-09-23 2020-09-23 Method and device for signature verification

Publications (1)

Publication Number Publication Date
CN113761587A true CN113761587A (en) 2021-12-07

Family

ID=78785856

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011006043.2A Pending CN113761587A (en) 2020-09-23 2020-09-23 Method and device for signature verification

Country Status (1)

Country Link
CN (1) CN113761587A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116248291A (en) * 2023-01-30 2023-06-09 深圳市盛思达通讯技术有限公司 Signature verification method and system of consumer

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103577206A (en) * 2012-07-27 2014-02-12 北京三星通信技术研究有限公司 Method and device for installing application software
CN104298915A (en) * 2014-10-16 2015-01-21 厦门美图之家科技有限公司 Installation package tampering preventing method
CN106022098A (en) * 2016-05-10 2016-10-12 青岛海信传媒网络技术有限公司 Signature verification method and device for application
CN107403089A (en) * 2017-07-10 2017-11-28 东软集团股份有限公司 Resource tamper Detection method and apparatus based on application program
CN108683502A (en) * 2018-03-30 2018-10-19 上海连尚网络科技有限公司 A kind of digital signature authentication method, medium and equipment
EP3416082A1 (en) * 2017-06-14 2018-12-19 Beijing Xiaomi Mobile Software Co., Ltd. Method and apparatus for signing and verifying application installation package, and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103577206A (en) * 2012-07-27 2014-02-12 北京三星通信技术研究有限公司 Method and device for installing application software
CN104298915A (en) * 2014-10-16 2015-01-21 厦门美图之家科技有限公司 Installation package tampering preventing method
CN106022098A (en) * 2016-05-10 2016-10-12 青岛海信传媒网络技术有限公司 Signature verification method and device for application
EP3416082A1 (en) * 2017-06-14 2018-12-19 Beijing Xiaomi Mobile Software Co., Ltd. Method and apparatus for signing and verifying application installation package, and storage medium
CN107403089A (en) * 2017-07-10 2017-11-28 东软集团股份有限公司 Resource tamper Detection method and apparatus based on application program
CN108683502A (en) * 2018-03-30 2018-10-19 上海连尚网络科技有限公司 A kind of digital signature authentication method, medium and equipment

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
于成丽;郭燕慧;钮心忻;: "基于信任链传递的APK重签名算法设计", 电视技术, no. 21, 2 November 2014 (2014-11-02) *
李子臣;梁斓;孙亚飞;: "一种基于格签名算法的数字证书方案", 密码学报, no. 01, 15 February 2018 (2018-02-15) *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116248291A (en) * 2023-01-30 2023-06-09 深圳市盛思达通讯技术有限公司 Signature verification method and system of consumer
CN116248291B (en) * 2023-01-30 2023-11-17 深圳市盛思达通讯技术有限公司 Signature verification method and system of consumer

Similar Documents

Publication Publication Date Title
CN110879903B (en) Evidence storage method, evidence verification method, evidence storage device, evidence verification equipment and evidence verification medium
US20080276301A1 (en) Method and System for Software Installation
US20140259004A1 (en) System for trusted application deployment
KR101277517B1 (en) Apparatus and method for detecting falsified application
CN110362990A (en) Using the security processing of installation, apparatus and system
CN108259479B (en) Business data processing method, client and computer readable storage medium
CN111199037B (en) Login method, system and device
CN110688428B (en) Method and device for issuing intelligent contracts
US20140259003A1 (en) Method for trusted application deployment
CN115102744B (en) Data access method and device
CN109522683B (en) Software tracing method, system, computer equipment and storage medium
CN113282951B (en) Application program security verification method, device and equipment
KR101566141B1 (en) User Terminal to Detect the Tampering of the Applications Using Signature Information and Method for Tamper Detection Using the Same
CN116738503B (en) Collaborative encryption method for hardware system and operating system and electronic equipment
CN113761587A (en) Method and device for signature verification
CN112363771B (en) Application processing method and related product
CN109635558B (en) Access control method, device and system
CN109995534B (en) Method and device for carrying out security authentication on application program
CN114499893B (en) Bidding file encryption and evidence storage method and system based on block chain
CN113515747B (en) Equipment upgrading method, device, equipment and storage medium
CN111984963B (en) Method and apparatus for bypassing self-signed certificate verification
CN112769565B (en) Method, device, computing equipment and medium for upgrading cryptographic algorithm
CN112767142B (en) Processing method, device, computing equipment and medium for transaction file
CN111935138B (en) Protection method and device for secure login and electronic equipment
CN110046493B (en) Data processing method, device, equipment and machine-readable medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination