keytool -genkeypair -alias mykey -keyalg RSA -keystore keystore.jks -keysize 2048
keytool -list -v -keystore keystore.jks
keytool -export -alias mykey -file cert.cer -keystore keystore.jks
keytool -import -alias newcert -file newcert.cer -keystore keystore.jks
keytool -delete -alias mykey -keystore keystore.jks
keytool -keypasswd -alias mykey -keystore keystore.jks
keytool -storepasswd -keystore keystore.jks
keytool -importkeystore -srckeystore keystore.jks -destkeystore newkeystore.p12 -deststoretype PKCS12
openssl pkcs12 -in newkeystore.p12 -out newkeystore.pem -nodes