且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

获取 javax.net.ssl.SSLHandshakeException:收到致命警报:handshake_failure 错误

更新时间:2021-10-24 05:49:59

如果没有看到堆栈跟踪和可能在使用 -Djavax.net.debug=ssl,handshake 运行客户端或服务器时产生的输出,就无法回答. 但是:

Impossible to answer without seeing a stack trace and possibly the output produced when running client or server with -Djavax.net.debug=ssl,handshake. However:

String[] cipherSuites = sslSocket.getSupportedCipherSuites();sslSocket.setEnabledCipherSuites(cipherSuites);

String[] cipherSuites = sslSocket.getSupportedCipherSuites(); sslSocket.setEnabledCipherSuites(cipherSuites);

不要那样做.它根本不安全,它只是掩盖了真正的问题,这几乎总是一个证书信任链问题:要么客户端不信任服务器的证书,反之亦然.

Don't do that. It is radically insecure, and it just conceals the real problem, which is almost always a certificate trust chain problem: either the client doesn't trust the server's certificate or vice versa.