User Community Service Desk Downloads
If you can't find the product or version you're looking for, visit support.ataccama.com/downloads

Import Certificates to Java Truststore

This article describes how to import certificates to the Java trustsore using the keytool tool. The default truststore is <JAVA_HOME>/lib/security/cacerts file.

After each of the following commands, you are prompted to enter the keystore password. Make sure you know passwords to the source and the target keystore.

Import all certificates

To import all certificates from an existing keystore, run the following command in Java:

keytool -importkeystore -srckeystore <source_keystore> -destkeystore <target_keystore>
Example - Import all certificates from another keystore*
keytool -importkeystore -srckeystore gateway.jks -destkeystore dest.jsk

Import specific certificate

Alternatively, you can also import a specific certificate from a keystore:

  1. List the certificates that are in the source Java keystore (JKS) file with the command keytool -list -v -keystore <source_keystore>.

    List keystore certificates
    keytool -list -v -keystore gateway.jks
  2. Export the selected certificate from the source keystore to the certificate file with the command keytool -exportcert -alias <certificate_alias> -file <certificate> -keystore <source_keystore>.

    Export certificate
    keytool -exportcert -alias certificate-alias -file C:/myCertificate -keystore gateway.jks
  3. Import the certificate to the Java truststore with the command keytool -importcert -alias <certificate_alias> -file <certificate> -keystore <target_keystore>.

    When asked whether you Trust this certificate?, enter yes.

    Import certificate
    keytool -importcert -alias certificate-alias -file C:/myCertificate -keystore <JAVA_HOME>/lib/security/cacerts

Was this page useful?