Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

javax.net.ssl.SSLHandshakeException while trying to reach some resources #141

Open
TwiceII opened this issue Nov 15, 2016 · 1 comment
Open

Comments

@TwiceII
Copy link

TwiceII commented Nov 15, 2016

Applying the html-resource function to some recources seems to throw 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 exception.
Is there a way to bypass this, can I provide some option like {:insecure? true} somewhere?

@mishadoff
Copy link

Spent a lot of time with similar issue, found a workaround to disable certificate check.

(defn trust-all-certificates []
  (let [trust (into-array javax.net.ssl.TrustManager
                          [(reify javax.net.ssl.X509TrustManager
                             (getAcceptedIssuers [this])
                             (checkClientTrusted [this certs auth])
                             (checkServerTrusted [this certs auth]))])
        sc (javax.net.ssl.SSLContext/getInstance "SSL")]
    (.init sc nil trust (java.security.SecureRandom.))
    (javax.net.ssl.HttpsURLConnection/setDefaultSSLSocketFactory (.getSocketFactory sc))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants