Post

Java create new keystore

Java create new keystore

When you’re setting up a Java app from scratch and need a keystore — usually for HTTPS or client certificate auth — this is the starting point. The keytool -list at the end is important; always verify the keystore was created correctly before wiring it into your app config.

  • Create new keystore
1
$ keytool -genkey -noprompt -alias investec -validity 365 -dname "CN=website.domain.com, OU=My_Website, O=MY_ORG, L=Johannesburg, S=Gauteng, C=SA" -keystore testKeystore -storepass password -keypass password
  • View contents of keystore
1
$ keytool -list -keystore testKeystore
This post is licensed under CC BY 4.0 by the author.