- 29 Sep 2022
- 1 Minute to read
- Contributors
- Print
- DarkLight
- PDF
Generating Keystore Certificate
- Updated on 29 Sep 2022
- 1 Minute to read
- Contributors
- Print
- DarkLight
- PDF
Android requires that all APKs be digitally signed with a certificate before they are installed on a device or updated. In order to do that we need the following:
- Key Store file
- Key Store Password
- To enable Push notification for android, we need the following:
- GCM Project
- API Key
Generating Keystore file and Password
The Keystore and Password can be created in two ways:
- Using Android Studio
- Using Java Keytool Utility
Using Android Studio
Refer the steps in developer.android.com to generate the certificate.
Using Java Keytool Utility
Pre-requisite - Download and install Java Development Kit(JDK) in your system. You can create a Keystore with the Java Keytool utility that comes with any standard JDK distribution and can be located at %JAVA_HOME%\bin. On Windows, this would usually be in C:\Program Files\Java\jre7\bin.
1. In Windows, open the command prompt(with admin rights) and switch to the \bin directory.
2. Enter the following command:
keytool -genkey -v -keystore my-release-key-tw.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
(where 'my-release-key-tw.keystore' is the name of the file')
3. Keytool prompts you to provide:
- Keystore password
- Distinguished Name fields
Now the Keytool generates the keystore as a file called my-release-key-tw.keystore in the \bin directory. The keystore and key are protected by the passwords you entered. The keystore contains a single key, valid for 10000 days. The alias_name is a name that you will use later, to refer to this keystore when signing your application.