Linux CentOs add a SSL certificate to trusted certificates

Dr. Viktor Walter-Tscharf1 MIN. LESEZEIT
Linux CentOs add a SSL certificate to trusted certificates

The problem is that we want to communicate with a server over ssl witch does not provide a vailed ssl certificate. The returned certificate from the server is only self signed and therefore not valued enough. To overcome this security regulation follow the following instructions.

Problem:

[SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target]

How to extract the certificate?

source: https://stackoverflow.com/questions/25940396/how-to-export-certificate-from-chrome-on-a-mac

Solution:

cd [into the directory of your SSL cert, should be already on your server]

sudo keytool -import -alias server_ssl_cert_self_signed -keystore /…/Java/JavaVirtualMachines/jdk-15.jdk/Contents/Home/lib/security/cacerts -file ./github.com.cer

If the keytool is asking for a password the default one is changed.