This article will walk through the steps required to import an SSL cert into a truststore. If you don't have a copy of your SSL certificate to import, then check out our article on exporting an SSL certificate via your web browser.
- Via command prompt or terminal, access your Java installation's bin directory
- Run the command below to import an existing cert into a truststore. Note that the truststore will be created if one does not exist at the location specified - ensure that the location is accurate to avoid creating a new truststore inadvertently.
keytool -import -file /your/cert/location -alias certname -keystore /your/output/truststore/locationExample:
keytool -import -file /u/gcc1/supsrv1.cer -alias supsrv1 -keystore /u/gcc1/java8/mycerts
- When prompted to specify a password, specify the existing password if the truststore exists already. If the truststore doesn't exist already, then the password specified will be the new truststore's password. You will need this password each time this truststore is accessed in the future.
- When prompted to Trust this certificate, type yes.
- If setup was successful, the output will read:
Certificate was added to keystore