I am trying to prepare my app for the google market, but it is proving a lot more challenging than expected. I cannot seem to grasp the whole concept of signing the app, but to be more specific my problem is that I have installed the keytool plugin for eclipse, but when I want to create a certificate it asks me to select a keystore (Enter the filename and keystore password), I don't understand what I am supposed to enter as a file, because it actually wants me to select the file through browse and how do I proceed with the exporting of the file, Google has sadly not come up with very good or clear answers
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
You need to provide location and filename for your new keystore file in case you are creating a new one. Alternatively, you could choose "use existing keystore" and browse to existing keystore file location.
Edit: I thought I would provide elaborate answer. Hope this info would be useful.
What is signature and why it is needed.
The apk signature mechanism used by android is an example usage of digital signature applied to bytecode and resources of the application to ensure :
To better understand digital signature I suggest you also skim through public-key cryptography.
How does that work.
Android uses same standard JDK tools used for signature/verification of standard java apps:
private key
, and verifies data with certificate (i.e. public key bound to your identity)keystore
. Those keys are needed forjarsigner
.After you sign your application manually with
jarsigner
or export signed application using your IDE (which useskeytool
andjarsigner
under the hood anyway), you can then locate signature-related files placed inMETA-INF
directory of your signed .apk archive :SHA
hashes of your app components andHow to properly sign application for release.
This article very well describes steps you need to follow.
Note: Please consider important pre-release steps before you proceed with signing : logs/ critical string literals removal, obfuscation with proguard, etc.
Below I will provide some key points for the process :
Generate your private key and put it in java
keystore
.This may require creating
keystore
first if you don't have one. When creatingkeystore
you need to createKeystore password
, that is used to ensure integrity ofkeystore
data (i.e. you will be warned that your keystore is tampered with after someone - not you -has added new certificate to it). Practically, this password is not super crucial if you keep yourkeystore
file safe. You can get away if you forget it some day.When generating
private key
, you will be also asked to createPrivateKey password
that will be used to encrypt your private key inside the keystore. This is the very important password you need to keep as it ensuresWhen you generate your new private key in Eclipse, you will also be asked to provide identity information that is used to create your self-signed certificate.
As the next step your
private key
from specifiedkeystore
file will be used to sign the application and your.apk
will be updated with signature-related files explained above.Some important terminology :
Keystore is simply a single binary file keeping list of your private keys / certificates in a specific format. It is programmatically accessible using API provided by KeyStore.java. Your keystore can contain multiple private key entries, each identified by its
alias
.In majority of cases your
keystore
will have single private key with single self-signed certificate matching this private key.Keystore password is used for integrity check of the keystore content.
If you loose this password, but you still have password for private key stored inside, you can "clone" your keystore and provide new keystore password by running the following cmd:
provide new password, and leave old keystore password blank - you will only get warning. You can then use your new keystore and get rid of old one.
There are other ways you can retrieve your private key without using keystore password.
Private key password - protects(by encrypting)
private key
insidekeystore
. It is extremely important as it allows you to access your private key to, among other things, sign updates for your application. It is generally very hard to recover it.Self-signed ceritificate - very simple certificate binding your identity(name/organization/email) to your public key. This certificate is added to
.apk
file during signing operation and will be used on user's device to verify.apk
before installation.