Java/keytool

From Omnia
Jump to navigation Jump to search

View certificates

keytool -list -keystore <keystore>
keytool -list -v -keystore <keystore>

To change the keystore password, you use a command like the following:

keytool -storepasswd -keystore <keystore_file> -new <new_password>

To change the alias password, you can use a command like the following:

keytool -keypasswd -alias tomcat -keystore <keystore_file> -keypass <current_password> -new <new_password>

To import signed certificates

keytool -import -keystore <keystore> -alias <alias> -file cert.crt -trustcacerts

To change/rename an alias:

# First we will clone the key and certificate:
keytool -keyclone -keystore <keystore_file> -alias <old_alias> -dest <new_alias>
# Then we will delete the old key and certificate:
keytool -delete -keystore <keystore_file> -alias <old_alias>

See Also

SSL Certificates | openssl | keytool | Java Keystore

keywords