Home > Uncategorized > Java import certificate from website

Java import certificate from website

Making calls to a server with a self signed certificate might give you the following error:

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

To fix this we need to import the certificate of this website into our local keystore.

Default pw for the keystore is ‘changeit’.

openssl s_client -showcerts -connect www.example.com:443 < /dev/null | openssl x509 -outform DER > www.example.com.der
keytool -importcert -trustcacerts -alias www.example.com -file www.example.com.der -keystore <path_to_keystore>
Categories: Uncategorized Tags:
  1. October 30th, 2018 at 19:37 | #1

    Excellent goods from you, man. I have take into account your stuff previous to and you are just extremely excellent.
    I actually like what you’ve bought right here, certainly like what you are saying and the way in which you assert it.
    You are making it enjoyable and you still care for to keep
    it sensible. I can not wait to learn much more from you.

    That is actually a wonderful web site.

  1. No trackbacks yet.

Time limit is exhausted. Please reload CAPTCHA.