Android's Package Management System

Android's Package Management System


Table of Contents

  • How to resign an android app?
  • How to install an android apk?
  • android package management system.
  • How to get an app's certification?

1 How to resign an android app?

Android apk's digital signature strategy just employs the java's jar package method. So We can use java's keystore and jarsigner tools to sign an apk.
And the first step is to generate a valid certification:
  • make your own keystore
keytool -genkey -v -keystore iboxpay.keystore -alias ibox -keyalg RSA -keysize 2048 -validity 100000
please remember the store password and key password, I always set them the same one.
then before to resign an apk, I should remove its original signature first.
  • remove apk's digital signature
zip -d whatever.apk "META-INF/*"
After that, I can sign that apk by our own certification.
  • sign apk by jarsigner
jarsigner -verbose -keystore iboxpay.keystore -storepass 123456 whatever.apk ibox
  • align the apk
zipalign is a tool of android sdk, located in <android-sdk>/tools/. And this is not a necessary step, but it will make apk file more efficient.

zipalign -v 4 whatever.apk whatever_align.apk

2 How to install an android apk?

there are many ways to install an android apk. I list the ways here:
  • Android's PackageInstaller app
  • adb install whatever.apk
  • adb push whatever.apk /system/app
  • pm install "/path/to/apk"
But both of those ways must pass the android's package management system.

3 android package management system.

During the installation process, Android's PackageMangement system first authorize its signature, after that if the app request system priority, it will compare its certification with the system certification, only the app signed with system's certification can have system priority.

4 How to get an app's certification?

Actually, this section's topic should be how to get the signature of an app's certification, I consider the certification's signature as the serialization of the certification. So we can get the certification from its signature. I wrote an app to demonstrate it.

https://github.com/suzp1984/parrot/tree/master/android_app/GetSignatureApp

Comments

Popular posts from this blog

Bluedroid stack in android

How to setup a NAT server?

Network programming in elisp