How to bypass CertificateException by Java?

前端 未结 1 538
再見小時候
再見小時候 2020-12-20 06:50

I am trying to send a request to a server but it runs into following error, as I know should create a certificate but not sure how to do it. I\'ve found this answer but coul

相关标签:
1条回答
  • 2020-12-20 07:44

    The server might be using a certificate that lacks the proper extensions. You can either disable host name verification (which creates a security problem), or install a proper certificate on the server (which might be difficult if it's not your server).

    More specifically, I'd guess that either the server certificate contains a Subject Alternative Name extension, but that extension doesn't contain the host name of the server, or there is no SAN extension and the Common Name attribute of the Subject Name doesn't match the server. In either case, the solution would be to get a certificate with the correct server host name in the SAN extension.

    0 讨论(0)
提交回复
热议问题