Before we begin make copy of old keystor like this:
1 |
$ cp /path/to/keystore.jceks cp /path/to/keystore.jceks.backup.$(date +%F) |
and then we can remove alias:
1 |
$ /opt/java/bin/keytool -delete -alias name_alias -keystore /path/to/keystore.jceks -storetype JCEKS |
when you gonna add new alias by keytool:
1 |
$ /opt/java/bin/keytool -import -file /path/to/cert.pem -alias mc -keystore /path/to/keystore.jceks |
To be sure, you can check it and see more information like date or fingerprint:
1 |
$ /opt/java/bin/keytool -list -keystore /path/to/keystore.jceks -storetype JCEKS -v | less |
When sometings go wrong, you can also copy backup file.
Good luck!