.NET FtpWebRequest 是否同时支持隐式 (FTPS) 和显式

Does .NET FtpWebRequest Support both Implicit (FTPS) and explicit (FTPES)?(.NET FtpWebRequest 是否同时支持隐式 (FTPS) 和显式 (FTPES)?)
本文介绍了.NET FtpWebRequest 是否同时支持隐式 (FTPS) 和显式 (FTPES)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我被要求支持隐式和显式 FTPS(也称为 FTPES).我们目前正在使用 .NET FtpWebRequest.FtpWebRequest 是否支持这两种类型的 FTPES,有什么区别?

I am being asked to support implicit and explicit FTPS (also known as FTPES). We are currently using the .NET FtpWebRequest. Does the FtpWebRequest support both types of FTPES, and what is the difference?

谢谢

推荐答案

据我所知,当前(.NET 2.0 和 3.5)版本的 FtpWebRequest 仅支持显式 SSL.

as far as I know the current (.NET 2.0 and 3.5) version of FtpWebRequest supports Explicit SSL only.

实际上,.NET 2.0 目前还没有支持隐式 SSL,仅支持显式.我们将考虑将其添加为未来版本.

Actually, .NET 2.0 does not currently support implicit SSL, only explicit. We will consider adding this for a future release.

JonCole - MSDN 论坛帖子

如果您需要同时使用隐式和显式 TLS/SSL,则必须尝试使用​​第三方 FTP/SSL 组件之一.以下代码使用我们的 Rebex FTP/SSL 并取自 教程页面.

If you need to use both Implict and Explicit TLS/SSL you have to try one of third-party FTP/SSL components. Following code uses our Rebex FTP/SSL and is taken from the tutorial page.

显式 TLS/SSL

客户端以通常不受保护的方式连接到 FTP 服务器,通常将端口 21 分配给 FTP 协议.当需要使用 SSL 保护连接时,会初始化 SSL 协商,保护控制连接并保护所有后续通信.

Client connects to FTP server in a usual non-protected way, usually to port 21 was assigned to FTP protocol. When it is desired to protect the connection using SSL, an SSL negotiation is initialized, control connection is secured and all following communication is being protected.

// Create an instance of the Ftp class. 
Ftp ftp = new Ftp();

// Connect securely using explicit SSL. 
// Use the third argument to specify additional SSL parameters. 
ftp.Connect(hostname, 21, null, FtpSecurity.Explicit);

// Connection is protected now, we can log in safely. 
ftp.Login(username, password);

显式保护意味着可以随时保护连接.如果您不知道在连接时是否需要保护,您可能希望使用普通未加密的 FTP 协议进行连接,并在以后保护连接.

Explicit protection means that it is possible to secure the connection at any moment. If you don't know whether you will need the protection on not at the connection time, you might want to connect using the ordinary unencrypted FTP protocol and secure the connection later.

Ftp ftp = new Ftp();

// Connect to the server with no protection. 
ftp.Connect(hostname, 21);

// Upgrade connection to SSL. 
// This method also accepts an argument to specify SSL parameters. 
ftp.Secure();

// Connection is protected now, we can log in safely. 
ftp.Login(username, password);

FTP 会话的隐式 SSL 保护

FTPS 协议最初由 IANA 分配一个单独的端口.连接到此端口后,SSL 协商立即开始,控制连接得到保护.所有数据连接也以相同的方式隐式保护.这类似于 HTTPS 使用的方法.

FTPS protocol was originally assigned a separate port by the IANA. Upon connection to this port, an SSL negotiation starts immediately and the control connection is secured. All data connections are also secured implicitly in the same way. This is similar to the approach used by HTTPS.

这种方法不受 IETF 的青睐,已被弃用.Rebex FTP/SSL 支持它与旧服务器的互操作性,但强烈建议尽可能使用显式保护.

This approach is not favored by the IETF and is deprecated. It is supported by Rebex FTP/SSL for interoperability with older servers, but it is strongly recommended to use the explicit protection instead whenever possible.

Ftp ftp = new Ftp();

// Connect securely using implicit SSL. 
// Use the third argument to specify additional SSL parameters. 
ftp.Connect(hostname, 990, null, FtpSecurity.Implicit);

// Connection is protected now, we can log in safely. 
ftp.Login(username, password);

您可以在 rebex.net/ftp-ssl.net/下载组件

这篇关于.NET FtpWebRequest 是否同时支持隐式 (FTPS) 和显式 (FTPES)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)