Java SSLHandshakeException“没有共同的密码套件”
我正在使用SSLServerSocket接受我的openSUSE服务器上的客户端连接,但它们都不能连接。我总是得到一个SSLHandshakeException说no cipher suites in common
。我已经激活了所有可能的套件,启用了多个协议,尝试使用最新的oracle JRE和openjdk。我还在论坛和东西上关注了其他几个帖子并“解锁”了oracle jre中的所有密码套件,我改变了openjdk jre的设置,如下所示:
已禁用:已#security.provider.10=sun.security.pkcs11.SunPKCS11 ${java.home}/lib/security/nss.cfg
启用:security.provider.9=sun.security.ec.SunEC
这是我初始化SSLServerSocket的方式:
System.setProperty("javax.net.ssl.keyStore", "./keystore"); System.setProperty("javax.net.ssl.keyStorePassword", "nopassword"); java.lang.System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");// Create a trust manager that does not validate certificate chains TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) { } public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) { } public java.security.cert.X509Certificate[] getAcceptedIssuers() { return null; } } }; // Install the all-trusting trust manager SSLContext sc = SSLContext.getInstance("TLSv1.2"); sc.init(null, trustAllCerts, new SecureRandom()); SSLServerSocket ssl = (SSLServerSocket) sc.getServerSocketFactory().createServerSocket( DownloadFilelist.PORT); // Got rid of: //ssl.setEnabledCipherSuites(sc.getServerSocketFactory().getSupportedCipherSuites()); ssl.setEnabledProtocols(new String[] {"TLSv1", "TLSv1.1", "TLSv1.2", "SSLv3"}); // System.out.println(Arrays.toString(ssl.getEnabledCipherSuites())); s = ssl; // s = new ServerSocket(DownloadFilelist.PORT); s.setSoTimeout(TIMEOUT);
问题是我无法找出客户想要的密码套件,也不能影响它。我启动了程序-Djavax.net.debug=ssl,handshake
,这是结果。你们有人能弄明白问题是什么吗?
人到中年有点甜
慕无忌1623718