java - creating your keystore and generating
We can create a keystore using keytool command as shown here:-
keytool -genkeypair -v -keystore your-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias your-alias-name
Parameters explained:
- -keystore your-keystore.jks - Output filename
- -keyalg RSA - Algorithm (RSA is standard)
- -keysize 2048 - Key size (2048-bit recommended)
- -validity 10000 - Validity in days (10000 days ≈ 27 years)
- -alias your-alias-name - Identifier for the key
You'll be prompted for:
- Keystore password
- Your name, organization, city, state, country code
To get SHA-1 fingerprint of your key (needed for Google OAuth):
And you can then list down the SHA1 of your
keytool -keystore your-keystore.jks -list -v
Here is a quick breakdown of what those flags are actually doing:
-keystore your-keystore.jks: Points the tool to your specific keystore file.-list: Tells the tool, "Show me what's inside this file." By default, this only shows a brief summary (the alias name, creation date, and SHA fingerprint).-v: Stands for Verbose. This is the magic flag that instructs it to print everything—the owner, issuer, validity dates, serial number, and all fingerprint algorithms (MD5, SHA-1, SHA-256).
Comments