Android Signature detailed androidophoneant design mode eclipse
InAndroid system, allApplications installed to the system must have a digital certificate that identifies the author of the application and establishes a trust relationship between the applications, if a permission ProtectionLevel is signature, Then only applications that have the same digital certificate as the program where the permission resides can get that permission. Android uses Java digital certificates related toMechanism to stamp the APK with a digital certificate, to understand the digital certificate of Android, you need to understand the following digital certificate concepts and Java digital certificate mechanism. The Android system requires that every application installed into the system is signed with a digital certificate, and the private key of the digital certificate is stored in the programmer's hands. Android uses digital certificates to identify the author of an application and to establish a trust relationship between applications, not to determine which applications the end user can install. This digital certificate does not require an authoritative digital certificate signing Authority authentication, it is only used to make the application package self-certified. (Wen/feisky)
One: Multiple programs of the same developer use the same digital certificate as much as possible, this can bring the following benefits.
(1) in favor of the program upgrade, when the new version of the program and the old program's digital certificate, the Android system will think that the two programs are different versions of the same program. If the new program and the old version of the digital certificate is not the same, then the Android system think they are different programs, and create a conflict, will require the newly-created program to change the package name.
(2) facilitates the modular design and development of the program. Android allows programs with the same digital signature to run in one process, and the Android program treats them as the same program. So developers can develop their own programs into modules, and users only need to download the appropriate modules when needed.
(3) Data and code can be shared across multiple programs through permissions (permission). Android provides a digital certificate-based permission-granting mechanism that allows applications to share overviews or data with other programs to those that have the same digital credentials as themselves. If the ProtectionLevel of a permission (permission) is signature, this permission can only be granted to programs that have the same digital certificate as the package in which the permission resides.
When signing, you need to consider the numberValidity period of the certificate:
(1) The validity period of the digital certificate should include the program's expected life cycle, once the digital certificate expires, the program that holds the digital certificate will not be upgraded properly.
(2) If multiple programs use the same digital certificate, the validity period of the digital certificate will include the expected lifetime of all programs.
(3) Android market enforces that all application digital certificates remain valid until October 22, 2033.
Two: Android digital certificates contain the following points:
(1)all applications must have a digital certificate, the Android system does not install an application without a digital certificate
(2) The digital certificate used by the Android package can be self-signed and does not require an authoritative digital certificate Authority signature Authentication
(3)If you want to formally publish an android, you must sign the program with a digital certificate generated by a suitable private key , but not with ADTthe debug certificate generated by the plug-in or ant tool to publish.
(4) Digital certificates are valid , and Android only checks the validity of the certificate when the application is installed. If the program is already installed on the system, it does not affect the normal functionality of the program, even if the certificate expires.
(5) Android uses standard Java tools Keytool and Jarsigner to generate digital certificates and to sign application packages.
(6) Use the zipalign optimization program.
Android does not install an APK program that runs without a digital signature, either on the emulator or on the actual physical device. Android's development tools (ADT plugin and ANT) can help developers sign the APK program in two modes: Debug mode and Release mode.
In debug mode, Android's development tools use a debug digital certificate to sign the program each time they compile, and developers don't need to worry about it.
When you want to publish a program, developers need to use their own digital certificate to sign the APK package, there are two ways to do it.
(1) Use the Keytool in the JDK (for generating digital certificates) and Jarsigner (for signing with digital certificates) on the command line to sign the APK package.
(2) Signing with ADT Export Wizard (if no digital certificate may be required to generate a digital certificate).
Three, two kinds of signature methods
The first method of signing,
signing programs with Keytool and Jarsigner (for versions below 1.5)
Command:keytool-genkey-v-keystore android.keystore-alias android-keyalg rsa-validity 20000
In this command,-keystore Ophone.keystore represents the generated certificate, which can be added to the path (by default in the user home directory), and-alias ophone means that the certificate alias is the RSA algorithm used by the OPHONE;-KEYALG RSA representation ;-validity 20000 indicates that the certificate is valid for 20,000 days.
At this point, we'll see Ophone.keystore in the Interoperable home directory, which is the certificate we just created.
Second way of signing: now the Android 1.5 and the updated version of the APK signature mode
1. Open Eclipse-> Select the item you want to sign, right-click->android tools->export signed Application package ...
2, jump out of the window
3,project checks if there is no problem checking the project name, click Next
Then jump out of keystore selection if it is already present KeyStore the file is selected then next enter KeyStore password to sign.
If not, select Create New KeyStore and select KeyStore save location, set KeyStore password, and click Next.
4. Fill in the basic information of keystore, such as alias, password, expiration date, name, organization, organization name, city, province, country, etc., click Next
5. Select the location where the APK is saved after signing. Click Finish.
6. You can find the corresponding signed apk file in your saved location.
The above signatures are only available in ANDROID1.5 and later versions. Thank you.
I hope to help you, thank you.
Android Signature Detailed