|
How to use FTPS (with server validation - part A)
|
|
IMPORTANT: An FTPS compatible FTP server is required for this example. There are free
FTPS-compatible servers available on Windows and *NIX platforms.
ftpConnection.Protocol = FileTransferProtocol.FTPSExplicit;
ftpConnection.ServerValidation = SecureFTPServerValidationType.Automatic;
Setting ServerValidation to Automatic instructs SecureFTPConnection to match the certificate
that the server presents against those in the Windows Certificate Store. This means that either of the following must be true:
1. the server certificate has been issued by a Certificate
Authority, such as VeriSign or
Thawte, whose certificate is in the Windows Certificate store; OR
2. the server's certificate itself is in the Certificate Store.
In the first case no manipulation of the Windows Certificate store is necessary. In the latter it
is necessary to install the server certificate on the machine on which SecureFTPConnection is
being used. In order to make this simpler, edtFTPnet/PRO provides both design-time and
runtime tools for managing certificates. For more information of these tools please refer to the
topic Certificate Manager.
SSLFTPCertificate.ShowCertificateManager();
This only needs to be done once since the certificate will remain in the store until it is
removed.
Once the server certificate or that of the Certificate Authority that issued it is in the Windows
certificate store, the Connect() may simply be called to establish a secure connection:
ftpConnection.Connect();