How to generate a Keystore. What is it?

How to generate a Keystore and what is it used for Google Play or other things

Let’s see how to generate a Keystore and answering the question: what is a keystore? What is it used for?

What is a Keystore and what is its utility? Google Play, Android and Java usability.

A Keystore is a repository where some private information is stored. That information is needed to sign your application: when you ship an app it uses the information inside the Keystore to sign it.
The protection offered by the Keystore allows only to the developer – o whoever generated it – to access the information it contains: the final user can’t read it.

Keystores are mainly used to sign mobile apps or games for Android because it is handled by Java language. Google Play requires a Keystore to publish your app.

What information contains a Keystore?

  • First and last name of the one is generating the Keystore.
  • The name of your department or organization unit.
  • Your company name.
  • The City or Locality name of the organization.
  • The State or Province name of the organization.
  • Two-letter country code (e.g. IT for Italy or ES for Spain)
  • A password to make it unique.

If you don’t have an organization but you are a solo developer, choose a nickname for your activity.

How to generate a keystore without external tools

Let’s proceed with the actual generation of the key.
Some people use external tools like KeyStore Explorer or Java Keytool to generate it, but in many cases (for example in the case you wanna publish a game on Google Play) you don’t need to download anything, you can generate it directly from your command prompt.

  1. Open the command prompt

    It depends on your OS the method to open the command prompt.Open Command Prompt How to generate a Keystore and what is a Keystore, what is it used for? using CMD

  2. Let the CMD know were your JDK are located.

    Write in the command prompt: cd “path where your JDK is located /bin”.
    They usually are located in C:\NVPACK path (e.g. C:\NVPACK\jdk1.8.0_65\bin). Obviously select the same JDK used to develop your app or game!

  3. Store the information inside the Keystore

    Write in the command prompt: keytool -genkey -v -keystore Store.keystore -alias Alias -storepass password -validity 9999
    It will then require you all the information we told you before: insert them and digit “yes” when it asks you to confirm them in the last passage.
    Remember the password you’re gonna choose for your Keystore and don’t let anyone know it! It is what makes your app unique.

  4. Get your Keystore!

    Go to the path inserted in passage 2, you will find a file named Store.keystore. Congratulations: you have successfully generated your Keystore!

Something unclear? Check this short video!

You can now upload your Keystore inside your app or game and eventually also to Google Play.
If you’re having problems setting up Google Play Services be aware of what written in this guide!
Good luck with your project!