How to make keystore key for Google Play to publish
Keystore key generation for you app
Android requires that all APKs be digitally signed with a certificate before they are installed on a device. Android studio has GUI facility to make keystore file (.jks or .keystore): A binary file that serves as a repository of certificates and private keys. There are i am showing simple steps to create this file using command line. While we have keystore file already generated by android studio on following path:
~/.android/
on OS X and LinuxC:\Documents and Settings\user\.android\
on Windows XPC:\Users\user\.android\
on Windows Vista and Windows 7, 8, and 10
Development:(PWD: android) - com.example.test.debug
————————————
Deepaks-MacBook-Air:app dsharma$ keytool -genkey -v -keystore debug.keystore -alias androiddebugkey -keyalg RSA -keysize 2048 -validity 10000
Deepaks-MacBook-Air:keystores dsharma$ keytool -genkey -v -keystore debug.keystore -alias androiddebugkey -keyalg RSA -keysize 2048 -validity 10000
Enter keystore password:
Re-enter new password:
What is your first and last name?
[Unknown]: Android Debug
What is the name of your organizational unit?
[Unknown]: Android
What is the name of your organization?
[Unknown]: Android
What is the name of your City or Locality?
[Unknown]: Jaipur
What is the name of your State or Province?
[Unknown]: Rajasthan
What is the two-letter country code for this unit?
[Unknown]: IN
Is CN=Android Debug, OU=Android, O=Android, L=Jaipur, ST=Rajasthan, C=IN correct?
[no]: y
Generating 2,048 bit RSA key pair and self-signed certificate (SHA256withRSA) with a validity of 10,000 days
for: CN=Android Debug, OU=Android, O=Android, L=Jaipur, ST=Rajasthan, C=IN
Enter key password for <androiddebugkey>
(RETURN if same as keystore password):
Re-enter new password:
[Storing debug.keystore]
Warning:
The JKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 which is an industry standard format using "keytool -importkeystore -srckeystore debug.keystore -destkeystore debug.keystore -deststoretype pkcs12".
Keystore fingerprints and other details - development
Deepaks-MacBook-Air:keystores dsharma$ keytool -v -list -keystore debug.keystore
Enter keystore password:
Keystore type: jks
Keystore provider: SUN
Your keystore contains 1 entry
Alias name: androiddebugkey
Creation date: 16 Feb, 2020
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=Android Debug, OU=Android, O=Android, L=Jaipur, ST=Rajasthan, C=IN
Issuer: CN=Android Debug, OU=Android, O=Android, L=Jaipur, ST=Rajasthan, C=IN
Serial number: 373dc453
Valid from: Sun Feb 16 22:35:56 IST 2020 until: Thu Jul 04 22:35:56 IST 2047
Certificate fingerprints:
MD5: D1:3E:E5:43:9E:10:8F:94:17:28:B1:C2:C7:4B:07:09
SHA1: A4:CE:1B:39:4B:1C:F0:8E:A9:14:28:5F:B0:FF:51:A5:AD:AF:79:D6
SHA256: BF:C7:81:BB:BA:C0:B6:76:14:8B:E8:F6:1F:E2:D2:6E:3C:FF:D5:33:74:81:1A:FD:A2:7A:F2:8C:19:C9:4B:E9
Signature algorithm name: SHA256withRSA
Subject Public Key Algorithm: 2048-bit RSA key
Version: 3
Extensions:
#1: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: 14 1C C4 12 C6 05 05 0A 54 CC 2A 07 5A D2 53 C6 ........T.*.Z.S.
0010: CE 76 98 66 .v.f
]
]
*******************************************
*******************************************
Warning:
The JKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 which is an industry standard format using "keytool -importkeystore -srckeystore debug.keystore -destkeystore debug.keystore -deststoretype pkcs12".
Production:(PWD: deepak123) - com.example.test
————————————
Deepaks-MacBook-Air:keystores dsharma$ keytool -genkey -v -keystore test.keystore -alias testkeyalias -keyalg RSA -keysize 2048 -validity 10000
Enter keystore password:
Re-enter new password:
What is your first and last name?
[Unknown]: XXXXX Technologies
What is the name of your organizational unit?
[Unknown]: XXXXX Technologies
What is the name of your organization?
[Unknown]: XXXXXXX Technologies Pvt. Ltd.
What is the name of your City or Locality?
[Unknown]: Jaipur
What is the name of your State or Province?
[Unknown]: Rajasthan
What is the two-letter country code for this unit?
[Unknown]: IN
Is CN=XXXXXX Technologies, OU=XXXXX Technologies, O=XXXXX Technologies Pvt. Ltd., L=Jaipur, ST=Rajasthan, C=IN correct?
[no]: y
Generating 2,048 bit RSA key pair and self-signed certificate (SHA256withRSA) with a validity of 10,000 days
for: CN=XXXXXX Technologies, OU=XXXXXX Technologies, O=XXXXXX Technologies Pvt. Ltd., L=Jaipur, ST=Rajasthan, C=IN
Enter key password for <testkeyalias>
(RETURN if same as keystore password):
Re-enter new password:
[Storing test.keystore]
Warning:
The JKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 which is an industry standard format using "keytool -importkeystore -srckeystore test.keystore -destkeystore test.keystore -deststoretype pkcs12".
Keystore fingerprints and other details - production
Deepaks-MacBook-Air:keystores dsharma$ keytool -v -list -keystore test.keystore
Enter keystore password:
Keystore type: jks
Keystore provider: SUN
Your keystore contains 1 entry
Alias name: testkeyalias
Creation date: 16 Feb, 2020
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=XXXXXXX Technologies, OU= XXXXXXX Technologies, O= XXXXXXX Technologies Pvt. Ltd., L=Jaipur, ST=Rajasthan, C=IN
Issuer: CN= XXXXXXX Technologies, OU= XXXXXXX Technologies, O= XXXXXXX Technologies Pvt. Ltd., L=Jaipur, ST=Rajasthan, C=IN
Serial number: 37d41ecc
Valid from: Sun Feb 16 23:01:08 IST 2020 until: Thu Jul 04 23:01:08 IST 2047
Certificate fingerprints:
MD5: 3D:7E:28:18:6F:C6:AA:91:17:58:15:D4:CF:8D:37:84
SHA1: C2:2D:60:00:53:9D:57:33:A8:FB:B8:C9:F7:87:FD:4B:12:84:89:7E
SHA256: 22:62:27:7F:6C:F7:54:7C:AD:F4:6F:F6:86:A9:B6:C6:25:D0:89:C9:B2:D0:E5:40:74:FE:20:6C:E2:45:DB:EB
Signature algorithm name: SHA256withRSA
Subject Public Key Algorithm: 2048-bit RSA key
Version: 3
Extensions:
#1: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: B1 33 5E FA 6F 0C 4F 38 07 59 70 14 DE 18 B6 CC .3^.o.O8.Yp.....
0010: 03 77 22 E5 .w".
]
]
*******************************************
*******************************************
Warning:
The JKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 which is an industry standard format using "keytool -importkeystore -srckeystore test.keystore -destkeystore test.keystore -deststoretype pkcs12".
How you can use this in app
Create a keystore folder in you app folder of android like
Release - <root project>/app/keystore/test.keystore
Debug - <root project>/app/debug.keystore
in app module build.gradle file:
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
release {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
In gradle.properties file
MYAPP_RELEASE_STORE_FILE=keystore/test.keystore
MYAPP_RELEASE_KEY_ALIAS=testkeyalias
MYAPP_RELEASE_STORE_PASSWORD=deepak123
MYAPP_RELEASE_KEY_PASSWORD=deepak123
Note: If git is public access then try to avoid commit on git this keystore file of release.
If you like(👍) this please vote and comment .
It's really useful
ReplyDelete