Hello, welcome toPeanut Shell B2B Foreign Trade Network_Professional B2B E-commerce Platform_Free B2B Information Publishing Network!
18951535724

In-depth analysis of the android signature mechanism: core principles and detailed practice

   2026-11-04 NetworkingName2560
Key Point:BackgroundA recent study of the use of a testing tool found that apk files that were processed by the tested tool collapsed when they were installed, and the reason for analysing the crash log was that the signature was inconsistent。Turning to the signature in android, it may be well known that the purpose of the signature was to protect the security of the apk document, and if the apk were tampered with and verified by the installation, t

Background

A recent study of the use of a testing tool found that apk files that were processed by the tested tool collapsed when they were installed, and the reason for analysing the crash log was that the signature was inconsistent。

Turning to the signature in android, it may be well known that the purpose of the signature was to protect the security of the apk document, and if the apk were tampered with and verified by the installation, there would be a failure of verification, leading to the installation of the package. But if you ask moreAndroid signing mechanismIt's the principle of peace, isn't it? And then let's look at android signature mechanisms and principles。

Android signature mechanism and rationale

When the android system installs apk, the signature of apk is first checked, and if it is found that the signature file does not exist or the signature has failed, the installation is refused, so the application must sign before it is released. An apk signature would have the following benefits:

Purpose of signature:

1. To sendersIdentification:

As developers may use the same package name to confuse replacements of installed programs to ensure that different signatures are not replaced。

Ensuring the completion of the transmission of information:

The signature processes each file in the package to ensure that the contents of the package are not replaced。

3. Prevention of credit in transactions, market requirements for software。

Principle of signature:

In short, there are the following steps:

1. One algorithm for each file in apk (data summary + b)Please, save to mainfest. Mf

A single algorithm (data summary + barthur 64) for the entire mainfest. Mf file, stored in the head properties of the cert. Sf file, and for each property block in the mainfest. Mf file (data summary + b)Assemble in a property block。

Signing of cert. Sf files and archiving of them in cert. Rsa

After signing an apk file, m is added to the aak root directoryThe eta-inf directory, under which three documents are added: manifest. Mf, cert. Sf and cert. Rsa, with the following specific processes:

Manifest. Mf

Here's the summary file, which saves the b of the sha1 verification of all the documents in apkAse64 code, as follows (one document corresponds to a record). If the documents in the apk package are changed, the changed file summary information is different from the manifest. Mf verification information when installed at apk. If the attackers had modified the substance of the procedure and regenerated a new summary, it could have been validated。

Name: androidmainfest. Xml
sha1-digest: inccj47jcu56r8pkv8dlaczbkd8=
name: mEta-inf/android. Arch. Core runtime. Version
sha1-digest: bef7zgqbckdcbhvlpj0xwl01dw=

Certt. Sf is the signature document for the summary, and for the previous generation of manifest. Mf, the signature is made using the developer's private key using the sha1-rsa algorithm. Only public keys can be used for decryption at installation. After decryption, compares with the unencrypted manifest. Mf and, if compatible, indicates that the content has not been altered abnormally. If at this stage the developer changes the content of the program and produces a new summary document, the assailant does not have the developer's private key, so the correct signature document cannot be generated. When the system validates the program, the incorrect signature document is decrypted using the developer's public key, and the results and summary file are not matched, resulting in the failure to pass the test and the successful installation of the document. The format of the document is as follows:

Name: androidmainfest. Xml
sha1-digest: syfsd2vupcg4nq8jsob7dbwumyi=
name: mEta-inf/android. Arch. Core runtime. Version
sha1-digest: opqckzmxjvpqry hemowvnzmfrmw

Cert. Rsa

From the above, it appears that the android system was the signature test of the apk files based on the contents of the three documents。

 
ReportFavorite 0Tip 0Comment 0
>Related Comments
No comments yet, be the first to comment
>SimilarEncyclopedia
Featured Images
RecommendedEncyclopedia
Table of Contents4 sections