Dans Dev Diary 2.0 Help

Java Import TLS Certificate

Install a root certificate on Java

  1. Extract root certificate from the website

    openssl s_client -connect $DOMAIN:$PORT < /dev/null 2>/dev/null | openssl x509 -outform PEM >/etc/ssl/mycert.pem
  2. Import the root certificate into the keystore

    sudo keytool -import -alias mycert -keystore $JAVA_HOME/jre/lib/security/cacerts -file /etc/ssl/mycert.pem
  3. Enter the password for the keystore

    changeit
  4. Verify the certificate is in the keystore

    sudo keytool -list -keystore $JAVA_HOME/jre/lib/security/cacerts
Last modified: 09 January 2024