Sign: Writes specific tag information to a specific field in the application, indicating that the software has passed the signer's approval. Procedure: Digitally sign a given application with a private key
Role:
Identify application Authors
Detects if the application has changed
There is a kind of program upgrade, when the new program and the old program signature is inconsistent, there will be conflicts that are not the same app, requiring new programs to change the package name
。。。
Keytool generating the Signature private key command
Keytool-genkey-v-keyalg dsa-keysize 1024-sigalg sha1withdsa-validity 10000-keystore test.keystore-alias devel -keypass 123456-storepass 123456
Parameters:
Keytool Options |
Description |
-genkey |
Produces a key-value pair (public and private) |
-v |
Allow action output |
-alias<alias_name> |
The alias of the key. Only the first eight characters are valid. |
-keyalg |
The encryption algorithm that generates the key. Supports DSA and RSA. |
-keysize |
Produces the length of the key. If not supported, Keytool uses the default value of bits. Usually we use 2048 bits or longer keys. |
-dname |
A distinguished name that describes who created the key. This value is used as the issuer and subject field of the self-signed certificate. Note You can not specify at the command line. If not specified Keytool will prompt you (CN, OU, and so on). |
-keypass |
The password for the key. Mainly for security reasons, if not provided, Keytool will prompt you to enter. |
-validity |
Key expiration date, Unit: Day Note: A value of 10000 or greater is recommended. |
-keystore.keystore |
The file used to store the private key. |
-storepass |
The password for the private key store file. Mainly for security reasons, if not provided, Keytool will prompt you to enter. This password is not stored in your shell history. |
Jarsigner signing with a private key
Jarsigner-verbose-sigalg sha1withdsa-digestalg sha1-keystore test.keystore-storepass 123456 test.apk devel
Parameters:
Jarsigner Options |
Description |
-keystore.keystore |
The storage file that contains your private key |
-verbose |
Displays the output action. |
-sigalg |
Signature algorithm, with SHA1withRSA . |
-digestalg |
Message digest algorithm, with SHA1 . |
-storepass |
The password to store the file. Mainly for security reasons, if not provided, Jarsigner will prompt you to enter. This password is not stored in your shell history. |
-keypass |
The password for the private key. Mainly for security reasons, if not provided, Jarsigner will prompt you to enter. This password is not stored in your shell history. |
Why the app is signed, signed with Keytool Jarsigner