What to do when forgetting Android KeyStore and Key Password?
This problem can arise when you update your Android application in the Play Store. So you just need to create a new app bundle. At that time, you need to give your JKS file path and Key Store and Key passwords. If you need to remember your password or you give incorrect passwords, it will give you the following error message.
Cause: failed to decrypt safe contents entry: javax.crypto.BadPaddingException: Given final block not properly padded. Such issues can arise if a bad key is used during decryption.
What is the solution?
There are lots of suggestions in StackOverflow, ChatGTP and many other communities. But I followed the path below.
- Go to the App signing of your app in the play console.
- There you can see the Request upload key reset. Then you will be directed to the page that shows the steps to solve the issue. There are 4 steps to complete to request a new app signing key.
- First, select the reason as I forgot the password to my keystore.
- Then create a new .jks file as usual.
- The most important step is creating the .pem file. For that, run the following command in the terminal.’
$ keytool -export -rfc -keystore upload-keystore.jks -alias upload -file upload_certificate.pem
For this, you must replace the bolded parts.
- Path to the new .jks file (‘E:/USMLE mcq/Bone Age/boneAge2.jks’)
- Alias of new .jks file (key0)
- Path to import the new .pem file (‘E:/USMLE mcq/Bone Age/boneAge.pem’)
So my command is as follows.
keytool -export -rfc -keystore 'E:/USMLE mcq/Bone Age/boneAge2.jks' -alias key0 -file 'E:/USMLE mcq/Bone Age/boneAge.pem'
- You will have to enter your new key store password.
- Then you can see your new .pem file and finally upload it as the last step (4th step) of the process.
That’s all you have to do. After within a few days, you can see your App signing keys were changed. Please keep saving the new passwords carefully.😅
Happy Coding !!!!
Found this post useful? Kindly tap the 👏 button below! :)