Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ioleo/a79741af35a67a32e58b521d1d090063 to your computer and use it in GitHub Desktop.
Save ioleo/a79741af35a67a32e58b521d1d090063 to your computer and use it in GitHub Desktop.
Adding a certificate to JRE trusted certificates stores.

Add certificate to JDK trusted certificates store

The default JDK store is in:

<JDK>\lib\security\cacerts

Add a certificate with keytool:

<JDK>\bin\keytool.exe -importcert -file my-cert.cer -alias 'My cert' -keystore <JDK>\lib\security\cacerts -storepass "changeit"

Example paths:

/etc/java/java-11-openjdk/java-11-openjdk-11.0.11.0.9-0.fc33.x86_64/lib/security/cacerts

To find out the correct path on Fedora check:

/etc/alternatives/java_sdk_openjdk

Alias is a name by which the certificate can be, for instance, removed from the store.

Default password for cacerts is:

changeit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment