服务器(java)无法从具有SSL连接的客户端(c#)接收XML
我正在尝试将XML从客户端发送到服务器。我使用这个using System.Security.Cryptography.X509Certificates;
并在AuthenticateClient
中调用了异常。例外是
AutenticationException was caught, A call to SSPI failed, see inner exception.
这是我的代码:
public static SslStream OpenSSL(string _IP, int _port)
{
try
{
TcpClient client = new TcpClient(_IP, _port);
// Create a secure stream
SslStream sslStream = new SslStream(client.GetStream(), false,
new RemoteCertificateValidationCallback(ValidateServerCertificate), null);
if (sslStream != null)
{
sslStream.AuthenticateAsClient(_IP);
}
return sslStream;
}
catch (Exception _e)
{
Util.Log.Track(Config.System.LogMode.UTIL, "Comms.Handler.OpenSSL: exception = " + _e.ToString());
return null;
}
}
我可以连接到服务器,但服务器不会接收XML。我被困在这里两天了,有人知道这个问题出了什么问题吗
注意:我使用VS2010(客户端)和Eclipse Mars for linux(服务器)
# 1 楼答案
尝试添加此C#代码
它忽略了ssl验证的错误
然后尝试另一种方法 改变它
对这个
事实上,我不确定SslProtocols的旗帜。也许
SslProtocols.Tls | SslProtocols.Ssl3
如果没用,我也不知道:)