Setting trusted server certificates

Top  Previous  Next

In a secure FTP connection you may wish to validate that the server you are connecting to is indeed the server you think it is.  To do this you may require that the server provided a certificate that matches one or more certificates that you know to be associated with trusted servers.  Trusted server certificates must be stored in a PKCS#12/PFX file.  To define trusted server certificates to use in a connection use the Ftp.SetTrustedCertificates method.

 

Example

 

// create new Ftp instance

Ftp client = new Ftp(HOST, USER, PWD, PORT);

 

// set connection type to explicit ssl

client.ConnectionType = Ftp.AUTH_TLS;

 

// set trusted certificate file and password          

client.SetTrustedCertificates("trusted.pfx", "test");

 

// establish connection

client.Connect();