Prerequiste:
Generate a file platform.priv.pem
from you pk8 file.
openssl pkcs8 -in platform.pk8 -inform DER -outform PEM -out platform.priv.pem -nocrypt
Generate platform.pk12
file using both your platform.x509.pem
file and the previously generated platform.priv.pem
.
The key alias KEY_ALIAS
is a string value and it can be anything. After entering command below,
you'll be prompted for a password (and a password confirmation). It will be your a key password KEY_PASSWORD
.
openssl pkcs12 -export -in platform.x509.pem -inkey platform.priv.pem -out platform.pk12 -name {{KEY_ALIAS}}
Create a brand new jks file STORE_FILE_NAME
, and import your key with the given key alias and password before.
Once the command below is entered, you'll be prompted for the store password STORE_PASSWORD
.
keytool -importkeystore -destkeystore {{STORE_FILE_NAME}}.jks -srckeystore platform.pk12 -srcstoretype PKCS12 -srcstorepass {{KEY_PASSWORD}} -alias {{KEY_ALIAS}}
You already defined:
- key alias
- key password
- store password
- store file name
Finally update your signing config on app's build.gradle
.
android {
signingConfigs {
release {
storeFile file('/replace/with/path/to/your/{{STORE_FILE_NAME}}.jks')
storePassword '{{STORE_PASSWORD}}'
keyAlias = '{{KEY_ALIAS}}'
keyPassword '{{KEY_PASSWORD}}'
}
}