Current location - Quotes Website - Signature design - How to prevent the APP from being packaged twice?
How to prevent the APP from being packaged twice?
Methods/steps

1

"Android APP secondary packaging" is a pirated regular Android APP, which is repackaged after being cracked and implanted with malicious code. It is exactly the same as the regular APP in terms of performance, user experience and appearance, but there is a terrible program running quietly behind it, which will unconsciously waste the power and traffic of the mobile phone, maliciously deduct fees, peek at privacy and so on. How to encrypt Android APP to prevent secondary packaging?

2

Faced with secondary packaging, many Android developers have their own preventive measures. Almost all well-known companies' apps have been processed internally to prevent their apps from being packaged twice. Once they are packaged and re-run, the program will automatically exit. Next, explain in detail how Android APP encrypts and prevents secondary packaging.

three

To prevent Android APP from being packaged twice inside the code, we must first understand the machine recognition principle of APK. The unique identification of APK depends on the package name and signature. For example, security software such as Pea Folder Wash and 360 Mobile Guardian identify counterfeit APK. They only rely on the package name to determine the APK, and then determine whether it is a fake by signature. Therefore, when your own program starts, you can identify whether you are repackaged by obtaining the signature of APK itself and comparing it with the correct signature. How to encrypt Android APP to prevent secondary packaging?

four

The signature of APK itself can be obtained through the PackageManag object.

five

By decomposing the signed code, a string of about 20 characters is obtained, which is the MD5 value of APK signature. By comparing the obtained MD5 value with the correct MD5 value, we can identify whether its APK is pirated. How to encrypt Android APP to prevent secondary packaging?

end

Method/Step 2

1

The following figure shows the code block analysis of some protected apps: How to encrypt Android APP to prevent secondary packaging?

(1) "XX Power Saving King" key code to prevent secondary packaging.

2

(2) "XX Battery Manager" key code to prevent secondary packaging.

three

The above two places are the code of smali layer, and the screenshots of the above two places are made by the APP with very high download volume to prevent secondary packaging. The key code that will definitely be used in code processing is how to encrypt Android APP to prevent secondary packaging.

land roid/content/pm/package info; -& gt; Signature: [android/content/pm/signature.

This method can play a certain security role, and the general packager is helpless about it. If you know some smali grammar, its effect is equal to zero.