Skip to content

Instantly share code, notes, and snippets.

@awabcodes
Created January 24, 2019 07:56
Show Gist options
  • Save awabcodes/8d7d62c43d6368534f5f4f7a7853a995 to your computer and use it in GitHub Desktop.
Save awabcodes/8d7d62c43d6368534f5f4f7a7853a995 to your computer and use it in GitHub Desktop.
[Keytool Commands] #keytool #java
# List the content of cacerts
$ echo 'changeit' | keytool -list -v -keystore $(find $JAVA_HOME -name cacerts) | grep 'Owner:'
# List the content of a Keystore
$ keytool -list -v -keystore <keystore.jks>
# View Certificate Information
keytool -printcert -file <domain.crt>
# Generate Keys in New/Existing Keystore
$ keytool -genkeypair-alias <domain> -keyalg RSA -keystore <keystore.jks>
# Import Signed/Root/Intermediate Certificate
keytool -importcert -trustcacerts -file <domain.crt> -alias <domain> -keystore <keystore.jks>
# Change Keystore Password
keytool -storepasswd -keystore <keystore.jks>
# Rename Alias
keytool -changealias -alias <domain> -destalias <newdomain> -keystore <keystore.jks>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment