得到此错误:“javax.net.ssl.SSLHandshakeException:没有共同的密码套件” [英] Getting this error: "javax.net.ssl.SSLHandshakeException: no cipher suites in common"

查看:874
本文介绍了得到此错误:“javax.net.ssl.SSLHandshakeException:没有共同的密码套件”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用C#编写的客户端和JAVA中的服务器。因此,当我尝试连接时,我在服务器 javax.net.ssl.SSLHandshakeException中遇到错误:没有共同的密码套件和C#EOF或0字节。

I have a client written in C# and server in JAVA. So, when I'm trying to connect I got error in server javax.net.ssl.SSLHandshakeException: no cipher suites in common and in C# "EOF or 0 bytes".

[C#]:

  TcpClient tc = new TcpClient(server, 1337); 


            using (sslStream = new SslStream(tc.GetStream())){ }

[JAVA]:

   SSLServerSocketFactory ssocketFactory = (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
   SSLServerSocket server = (SSLServerSocket) ssocketFactory.createServerSocket(1337);
   server.setEnabledCipherSuites(server.getEnabledCipherSuites());

和JAVA推出属性:

-Djavax.net.ssl.trustStore=Certificatename -Djavax.net.ssl.trustStorePassword=thereisapw -Djava.protocol.handler.pkgs=com.sun.net.ssl.internal.www.protocol -Djavax.net.debug=ssl TCPServer


推荐答案

信任库定义了如何信任呈现给您的远程证书。密钥库用于您拥有的证书(并且您拥有私钥)。 (关于差异的更多细节此处。关于密钥库的术语可能会令人困惑,因为它可能有两个含义)。

The truststore defines how you're going to trust remote certificates that are presented to you. The keystore is for the certificates you have (and for which you have the private key). (More details about the difference here. The terminology about "keystore" can be confusing, since it can have two meanings).

在这里,您尝试运行服务器,但尚未设置自己的证书。您需要在密钥库中导入/创建证书并将其用作密钥库。

Here, you're trying to run a server, but you haven't set up your own certificate. You need to import/create a certificate in a keystore and use it as a keystore.

如果未指定密钥库,则服务器将无法找到证书/密钥。因此,它将无法使用默认启用的任何密码套件。

If you don't specify a keystore, the server won't be able to find a cert/key. As a result, it won't be able to use any of the cipher suites enabled by default.

我是不知道你从哪里得到这个,但你不需要它: -Djava.protocol.handler.pkgs = com.sun.net.ssl.internal.www.protocol

I'm not sure where you got this from, but you don't need it: -Djava.protocol.handler.pkgs=com.sun.net.ssl.internal.www.protocol

这篇关于得到此错误:“javax.net.ssl.SSLHandshakeException:没有共同的密码套件”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆