Do not use a drowned TrustManager, as this makes your application reliable to everyone . I would recommend downloading the certificate provided on the site and adding it to the private trust keystore. This allows an exception to be made for this single site without allocation to all users.
I also like this approach because it does not require code changes.
In Chrome, click the lock icon to the left of the URL. Then click on "Certificate Information." Go to the "Details" tab and click "Copy to file." Save it as “base64 X.509 (.cer)” to “SITENAME.cer”.
Copy $ JAVA_HOME / lib / security / cacerts to your application directory as "mykeystore.jks".
Install the certificate using:
keytool -keystore mykeystore.jks -storepass changeit -importcert -alias SITENAME -trustcacerts -file SITE.cer
Now that you run your application, tell it to use a closed certificate store:
java -Djavax.net.ssl.trustStore=mykeystore.jks ...
source share