Add SSL-cert to Java keystore on Ubuntu

Download cert in Chrome on MAC

  1. Open a new TextEdit document.
  2. In TextEdit, click Format | Make Plain Text.
  3. Arrange windows so that the TextEdit window and the Chrome window are both visible.
  4. In Chrome, click the icon to the left of the URL in the address bar.
  5. In the dropdown list, click Certificate.
  6. Hold down Option and drag from the large certificate icon to the body of the TextEdit document. Note: If you did not follow the steps above in exactly the order stated, you may need to first single-click within the Chrome window so that TextEdit doesn’t become hidden when you Option-click.
  7. Save the TextEdit document with a .pem extension.

Import cert to keystore

sudo keytool -import -alias <hostname> -keystore /usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/security/cacerts -file public.crt 

Default password for Java keystore is “changeit”.