javax.net.ssl.SSLException: Certificate doesn't match any of the subject alternative names

前端 未结 5 883
攒了一身酷
攒了一身酷 2020-12-29 13:36

I recently added LetsEncrypt certificates to my server and my java applet is having problems connecting using TLS.

My applet uses Apache HttpClient.

My web s

5条回答
  •  臣服心动
    2020-12-29 14:09

    If you use HttpClient 4.4 then you need to specify host verifier (NoopHostnameVerifier) to allow accepting certificates from different hosts:

    SSLConnectionSocketFactory scsf = SSLConnectionSocketFactory(
         SSLContexts.custom().loadTrustMaterial(null, new TrustSelfSignedStrategy()).build(), 
            NoopHostnameVerifier.INSTANCE)
    httpclient = HttpClients.custom().setSSLSocketFactory(scsf).build()
    

提交回复
热议问题