Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Open a command terminal in the bin folded of your java installation (e.g: C:\Program File(x86)\Java\jreXXXX\bin)
# In the commands below :
# - selfsigned is the name of the certificate
# - storPass is the password of the keystore and truststore
# - keyPass is the password of the certificate
# You can change those values for yours
#Generate the keystore.jks
keytool -genkeypair -alias selfsigned -keyalg RSA -keysize 2048 -validity 365 -keypass keyPass -storepass storPass -keystore keystore.jks
#Enter your informations when prompt
#Be aware those information will be visible in your browser
#Export the selfsigned.cer from the keystore.jks
keytool -exportcert -alias selfsigned -file root.cer -keystore keystore.jks -storepass storPass
#Generate the truststore.jks
keytool -importcert -alias selfsigned -file root.cer -keystore truststore.jks -storepass storPass
#The jks files are available in the folder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment