(转)The remote certificate is invalid according to the validation procedure
If you get “The remote certificate is invalid according to the validation procedure” exception while trying to establish SSL connection, most likely your’s server certificate is self-signed or you used incorrect host name to connect (Host name must match the name on certificate, for example ftp.example.com and example.com may point to the same server, but certificate is issued only to ftp.example.com and this is the address you should use).
Good news is that you can accept self-signed certificates using Ftp.dll FTP and FTPS .NET component.
First you need to subscribe to ServerCertificateValidate event.
Then you need to create ValidateCertificate method that validates the certificate (ignores certificate chain and name mismatch errors).
// C# version using (Ftp client = new Ftp())
{
// we will use custom validation
client.ServerCertificateValidate +=
new ServerCertificateValidateEventHandler(Validate); // Minimalistic version to accept any certificate:
//client.ServerCertificateValidate +=
// (sender, e) => { e.IsValid = true; }; client.ConnectSSL("ftp.example.org");
client.Login("username", "password"); foreach (FtpItem item in client.GetList())
{
if (item.IsFolder == true)
Console.WriteLine("[{0}]", item.Name);
else
Console.WriteLine"{0}", item.Name);
}
client.Close();
} private static void ValidateCertificate(
object sender,
ServerCertificateValidateEventArgs e)
{
const SslPolicyErrors ignoredErrors =
SslPolicyErrors.RemoteCertificateChainErrors | // self-signed
SslPolicyErrors.RemoteCertificateNameMismatch; // name mismatch if ((e.SslPolicyErrors & ~ignoredErrors) == SslPolicyErrors.None)
{
e.IsValid = true;
return;
}
e.IsValid = false;
}
You can download Ftp.dll FTP/FTPS component for .NET here.
(转)The remote certificate is invalid according to the validation procedure的更多相关文章
- 解决“The remote certificate is invalid according to the validation procedure”问题
在用HttpClient发起https请求时,遭遇了“The remote certificate is invalid according to the validation procedure”异 ...
- The remote certificate is invalid according to the validation procedure 远程证书验证无效
The remote certificate is invalid according to the validation procedure 根据验证过程中远程证书无效 I'm calling ...
- .net core中Grpc使用报错:The remote certificate is invalid according to the validation procedure.
因为Grpc采用HTTP/2作为通信协议,默认采用LTS/SSL加密方式传输,比如使用.net core启动一个服务端(被调用方)时: public static IHostBuilder Creat ...
- 异常处理之“The remote certificate is invalid according to the validation praocedure.”
参考文章:http://brainof-dave.blogspot.com.au/2008/08/remote-certificate-is-invalid-according.html 参考文章:h ...
- use AP_VENDOR_PUB_PKG.Update_Vendor_Site_Public to u ORA-01722: invalid number in Package AP_VENDOR_PUB_PKG Procedure Update_Vendor_Site_Public
ORA-01722: invalid number in Package AP_VENDOR_PUB_PKG Procedure Update_Vendor_Site_Public 发现此问题的经过: ...
- 使用.NET读取exchange邮件
公司有个第3方的系统,不能操作源码修改错误捕获,但是错误会发一个邮件出来,里面包含了主要的信息.于是想从邮件下手,提取需要的数据 开始考虑使用的是exchange service,主要参考http:/ ...
- ClickOnce发布后不能安装
当在internet发布用ClickOnce打包的客户端程序时,遇到ClickOnce启动后出错,错误信息如下: + Downloading https://xxxxx/Deploy/pc/Boote ...
- SignalR Troubleshooting
This document contains the following sections. Calling methods between the client and server silentl ...
- ef 问题汇总
持续更新: 一 属性重命名 数据库:UserName Model: [Column("UserName")]public string UserName222 二, 某表多个外键 ...
随机推荐
- 使用System.Data.SQLite及其EF模块操作SQLite数据库(文件)
SQLite for .NET (System.Data.SQLite) introduction An ADO.NET provider for SQLite including EF and Li ...
- BZOJ 2535:NOI 2010 航空管制
[NOI2010]航空管制 题面请点上面. 首先第一问,我第一想法是把它放到一个小根堆中,然而这是不行的. 正确的思路是,把图反过来建,然后放到一个大根堆里去. 至于原因,感性理解一下,正着贪是有后效 ...
- 「AH2017/HNOI2017」礼物
题目链接 戳我 \(Solution\) 应为我们可以将任意一个数列加上一个非负整数,即可以变为将一个数列加上一个整数(可以为负),我们将这个整数设为\(z\).所以要求的式子的变为: \[\sum_ ...
- Android 用 res 中文件名获取资源 id 的方法
res 中我们可能会放很多图片和音频视频等.它们放在 R.drawable, R.raw 下面. 有一种情况是,比如我有一个数据库保存项目中声音的一些信息.声音的 id 就很难保存.因为我们不能把 R ...
- OI数据结构&&分治 简单学习笔记
持续更新!!! [例题]简单题(K-D tree) 题目链接 线段树 [例题](环上最大连续和) 给定一个长度为n的环形序列A,其中A1与A_n是相临的,现在有q次修改操作,每次操作会更改其中一个数, ...
- [转] Linux 中提高 VsFTP 服务器的安全性
FTP是互联网应用中的一个元老级人物了,其方便企业用户文件的共享.但是,安全问题也一直伴随在FTP左右.如何防止攻击者通过非法手段窃取FTP服务器中的重要信息;如何防止攻击者利用FTP服务器来传播木马 ...
- jmeter之jtl文件解析(生成测试报告)
我们知道命令行的方式执行完成jmeter后,会生成jtl文件,里面打开后就是一行行的测试结果, <httpSample t="1" lt="1" ts=& ...
- flask.abort
abort(status) status:标注状态码,和异常 抛出异常后会终止当前函数 使用errorhandler装饰器捕获abort异常 @app.errorhandler(500) def in ...
- 北航软院2014级C#期末考试部分考题解答
博主注:本渣渣水平有限,文中若有不对的地方敬请指出,谢谢. 本文中大部分图片来自老师的PPT,感谢邵老师,想要的可以点击右边QQ联系我:) 一.选择 6.Which of the following ...
- Codeforces - tag::flows 大合集 [完坑 x14]
589F 题意:给出n个时间区间,每个区间挑定长的非连续区间,求不同个区间不存在时间冲突的最大定长,输出乘上n 二分图模型+二分长度,左顶点集为区间编号,右顶点集为时间编号(1...10000),汇点 ...