Search code examples
digital-certificatetruststore

Digital Certificate: How to import .cer file in to .truststore file using?


Has anyone came across where they have to deal with .truststore file? and knowing how to import .cer into .truststore file?

I am not sure if I have to use Java Keytool or Linux command (such as openssl command).

Thanks


Solution

  • # Copy the certificate into the directory Java_home\Jre\Lib\Security
    # Change your directory to Java_home\Jre\Lib\Security>
    # Import the certificate to a trust store.
    
    keytool -import -alias ca -file somecert.cer -keystore cacerts -storepass changeit [Return]
    
    Trust this certificate: [Yes]
    

    changeit is the default truststore password