APK Package encryption for Android

Source: Internet
Author: User

the text starts with the numbering Note: QQ group number 296733909

(Background introduction and the like to skip the good) development of Android applications will inevitably need to write Java code, but the Java write application is not secure, you can use the Android Reverse helper and other tools, easy to decompile the APK package, to view the APK package source code, Then there is the obfuscation tool to confuse the Java code. Even if it's confusing, it's not safe, confusion makes your code difficult to understand, but it can still be understood, and confusion is not so easy, but also to write files to make sure what needs to be confused and which don't need to be confused.

By understanding some of the principles of Android, you can know that Android packaging will generate a Classes.dex file, and the Anti-compilation tool is the file that is recompiled. So just encrypt the file.

Love encryption is a good site, the APK package, they will help you to encrypt the APK package, and so on for 1 minutes to 5 days or so, if passed the security detection, will help you encrypt, and then you download, with the Anti-compilation tool to decompile it, you will find the original Dex file is not, And in the assets directory more than a Ijiami,dat file, this file is actually encrypted Dex.

But you upload the bag, you always worry about something, right. And encryption takes a variable amount of time, evening packets may be the next day to see the results, weekend packets may be Monday to see the results. and also to do the security test of the package you upload, in case your package ... Well, so we can encrypt it ourselves.

(The text is coming)

I wrote a cryptographic method to encrypt the Dex file myself, let's try it together.


encryption required tools in Baidu network disk, address:Http://pan.baidu.com/s/1eQzssKE

1. Run your own project and copy the generated classes.dex from the Bin directory to the tool directory under the folder (you can also unzip the APK package and take out the Class.dex file)
2. Right-click Edit First.bat, modify the DX command directory, DX command under the android-sdk\build-tools\x.x.x\ (according to my path to change their own path is good)
3. running First.bat First will generate a Dex.jar
4. then run Second.bat, generate a _rf.dat file
5. open Eclipse, import the folder under the Androiden project (the project for me to test through the project, inside the Dex has been encrypted, can run under the effect of viewing)
6. Replace the Assets,res directory and the Anroidmainfest.xml file for the files in your own project, merge the Libs folder, delete the original project's jar reference package
7. Place the _rf.dat file you just generated under the assets directory
8. Modify the Anroidmainfest.xml file, as follows:

<?xml version= "1.0" encoding= "Utf-8"    ... <application ...        Android:name= "Com.shell.AppApplication" >                         <meta-data android:name= "to_run_activity" android:value= " Android.app.Application "/><!--the rows to be added for the above two behaviors, where com.shell.AppApplication is the entry for the encrypted program and must not be changed To_run_ The activity value defaults to Android.app.Application, and in general does not change if you have your own application, modify the value of As Com.example.MyApplication of course you can also change the value to the value of the activity that will start, such as com.example.YourActivity--! >        <activity ...        </activity>    </application>...</manifest>
9.Run the project to see the effect on your phone
.If you have questions about the above steps, or the project can not be run, or want to know the specific principle, you may add QQ Group (Group No. 296733909), ask the relevant personnel, to obtain the encrypted source of self-study.

Principle Summary: Use Dexclassloader to load Dex files. Use C or C + + write Dex file encryption decryption, using JNI, in the c,c++ code to write Dexclassloader load and run, which also involves reflection problems, etc., want to know the detailed ideas can add group (296733909) discussion.

Baidu Keyword: dexclassloader,jni

(Feel good, welcome to reprint Oh!!) Reprint Please indicate the source is good!

APK Package encryption for Android

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.