(转)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 二, 某表多个外键 ...
随机推荐
- QPushButton 点击信号分析
QPushButton 点击信号分析 QPushButton有三个很重要的信号跟点击有关 pressed clicked toggled 表面上看,pressed和clicked都会在点击按钮时触发, ...
- 【原创】vim插件安装简介
一.安装vundle(vim插件管理软件): git clone https://github.com/VundleVim/Vundle.vim 拷贝目录到 ~/.vim/bundle/Vundle. ...
- OI题目类型总结整理
## 本蒟蒻的小整理qwq--持续更新(咕咕咕) 数据结构 数据结构 知识点梳理 数据结构--线段树 推荐yyb dalao的总结--戳我 以后维护线段树还是把l,r写到struct里面吧,也别写le ...
- 初学python - 脚本文件
解析: 第一行 #!/usr/bin/env python - py脚本运行环境[用python解释器解释脚本文件-对应python安装路径] 第二行 #-*-coding:utf-8-*- - ...
- 图形学思考 - 聊聊透视图投射矩阵perspective projective matrix
from:版权声明:本文作者靖心,靖空间地址:http://blog.csdn.net/kenden23/,未经本作者允许不得转载. 什么是透视图投射矩阵perspective projective ...
- chipmunk 物理引擎的基本概念和基本用法
chipmunk是一个开源2D物理引擎, 项目主页:http://code.google.com/p/chipmunk-physics/ 工作需要研究了一下,这个引擎的资料还是不多,我阅读了所有的文档 ...
- 十,PHP下载文件
1,文件类型 (1)文本文件,如xx.txt. (2)二进制文件,如图片.视频.音频. 2,文件下载流程如下图所示,首先浏览器向服务器发送下载请求,服务器将下载资源读入内存,再通过http将资源返回到 ...
- 树莓派 Raspbian
备注,从右往左分别是:无线鼠标一个, HDMI转VGA接口一个,网线一根,小米充电宝电源线一个.树莓派Pi 3 一台,包括读卡器一个+32G class10 SD卡一块.最后俩个U盘作为备用里面有Ar ...
- UIControl笔记
UIControl继承自UIView UIControl与Target-Action模式 使用addTarget:action:forControlEvents方法来设置某一个controlEvent ...
- mysql查询语句常用字段操作函数
一.concat()函数 1.功能:将多个字符串连接成一个字符串. 2.语法:concat(str1, str2,...) 返回结果为连接参数产生的字符串,如果有任何一个参数为null,则返回值为nu ...