C# 在Xamarin.Android上调用RemoteCertificateValidationCallback时,SslStream.AuthenticateClientAsync不会填充发件人值
在CertificateValidationCallBack中,当我在Android上运行此代码时,sender为null,而在Windows上设置了相同的值。下面的代码使用sync方法,但我也测试了async,它们的行为相同。这是Xamarin.Android的bug还是我遗漏了什么C# 在Xamarin.Android上调用RemoteCertificateValidationCallback时,SslStream.AuthenticateClientAsync不会填充发件人值,c#,xamarin.android,.net-core,sslstream,C#,Xamarin.android,.net Core,Sslstream,在CertificateValidationCallBack中,当我在Android上运行此代码时,sender为null,而在Windows上设置了相同的值。下面的代码使用sync方法,但我也测试了async,它们的行为相同。这是Xamarin.Android的bug还是我遗漏了什么 static bool CertificateValidationCallBack( object sender, X509Certificate certificate, X509Cha
static bool CertificateValidationCallBack(
object sender,
X509Certificate certificate,
X509Chain chain,
SslPolicyErrors sslPolicyErrors)
{
return true;
}
...
Socket sock = new Socket(SocketType.Stream, ProtocolType.Tcp);
sock.Connect(IPAddress.Parse("192.168.0.100"), 993);
NetworkStream ns = new NetworkStream(sock);
SslStream ssl = new SslStream(ns, true, CertificateValidationCallBack);
ssl.AuthenticateAsClient("localhost", null, SslProtocols.Tls12, false);
sock.Disconnect(false);
我正在运行所有Xamarin和Android SDK工具的最新版本(今天更新,2016年12月23日)