Signature Verification in Android (1)

Source: Internet
Author: User

Android requires all installed applicationsProgramA digital signature is required. Otherwise, the system will not install and run programs without proper signature licenses. You must sign your program on both the device and the simulator to debug and run the program. This is what all Android Developers know. But what is digital signature, and what is the principle? I don't know. I checked the relevant knowledge when I was free.

When introducing Android, we need to understand the basic knowledge of cryptography: encryption. SeeSummary of encryption technology (1)

The digital signatures on gphonedo not only exist in all installed applications. When you use updata.zip to flash a machine, signature verification is also used for the refresh process.

 

First, let's see how the APK is signed:

 

(1) required tools: Download JDK from the sun official website and install the keytool and jarsigne system tools.

 

For details about the two tools and keystore, see: JDK tool keytool and jarsigner help Part1 (JDK keytool & jarsigner tool Manual)
And JDK tool keytool and jarsigner help Part2 (JDK keytool & jarsigner tool manual)

These two articles are very thorough. Thanks to ncnc.

 

(2) generate a keystore

$ Keytool-genkey-alias tekkaman. keystore-keyalg
RSA-validity 20000-keystore tekkaman. keystore
Enter the keystore password:
Enter the new password again:
What is your first name and last name?
[UNKNOWN]: tekkaman
What is the name of your organization?
[UNKNOWN]: NERV
What is your organization name?
[UNKNOWN]: NERV
What is the name of your city or region?
[UNKNOWN]: Linux
What is the name of your state or province?
[UNKNOWN]: GNU
Two-letter country in the unitCodeWhat is
[UNKNOWN]: CN
CN = tekkaman, ou = NERV, O = NERV, L = Linux, St = GNU, c = Cn is it correct?
[No]: Yes

Enter the master password of <tekkaman. keystore>
(If the password is the same as the keystore password, press Enter ):

 

 

(3) Use Your generated keystore to sign the APK package

$ Jarsigner-verbose-keystore tekkaman. keystore-
Signedjar tekkaman_signed.apk tekkaman.apk tekkaman. keystore
Enter the password phrase of the keystore:
Adding: META-INF/tekkaman. SF
Adding: META-INF/tekkaman. RSA
Signing :......

......

Next, we will introduce how to generate Encryption Files and use these files to sign the updata.zip Refresh!

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.