C# FtpWebRequest EnableSsl=真实错误';根据验证过程3,远程证书无效

C# FtpWebRequest EnableSsl=真实错误';根据验证过程3,远程证书无效,c#,.net-core,ftpwebrequest,C#,.net Core,Ftpwebrequest,我尝试通过激活启用的选项ssl=true,使用ftpwebrequest类通过ssl连接到ftp服务器。显示足够的错误 根据验证过程,远程证书无效。 这是我的密码 public void Upload(string container, string fileName, byte[] b) { Uri fullUri = new Uri(string.Format(@"{0}/{1}/{2}", Host, container, fileName));

我尝试通过激活启用的选项ssl=true,使用ftpwebrequest类通过ssl连接到ftp服务器。显示足够的错误

根据验证过程,远程证书无效。

这是我的密码

public void Upload(string container, string fileName, byte[] b)
        {
            Uri fullUri = new Uri(string.Format(@"{0}/{1}/{2}", Host, container, fileName));
            FtpWebRequest ftps = (FtpWebRequest)FtpWebRequest.Create(fullUri);
            ftps.Credentials = GetCredentials();

            ftps.KeepAlive = false;
            ftps.Method = WebRequestMethods.Ftp.UploadFile;
            ftps.UseBinary = true;
            ftps.EnableSsl = Ssl;
            ftps.ContentLength = b.Length;
            using (Stream StreamRequest = ftps.GetRequestStream())
            {
                StreamRequest.Write(b, 0, b.Length);
                StreamRequest.Close();
            }
        }
我在一些出版物中看到,他们使用的方法包括

ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };

但是我不知道它有多正确,或者我是否必须获得我的证书并对其进行类似的验证

1)请务必了解什么是SSL/TLS以及证书(服务器/客户端)是如何涉及的。2) 当然,您得到的错误是由于客户端Windows系统不信任服务器证书(在FTP服务器端)。您看到的方法只是一种常见的黑客行为,盲目信任所有此类证书。如果你想信任所有人,或者至少做一些验证,你应该仔细考虑。是的,我知道让所有证书都有效是。。。傻?现在我在寻找如何验证通过file.crt文件提供的证书,但很难找到问题的具体答案。我已经实现了本博客中提出的解决方案,但我的文件路径有问题。CRT请向Microsoft工程师学习,