how to get certificate from a https site

When integration with third party using HttpsURLConnection in java you usually get following issue if your third party use self signed certificate:

 javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed:sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

This issue happen cause java cannot verify that certificate and you must import it manual to trust store so java can trust site. But how you can get that certificate? In this post i will guide you how to get certificate from a https site.

Access https site using firefox. You see lock icon on address bar, Click on that icon
lockicon

Click on More information… to bring site information diaglog

siteinformation

Click on View Certificate to show detail about certificate of this site and choose tab Details

certificate-detail
Click Export… to export that certificate to file.

Leave a Reply