I have to communicate to an FTP server with SSL.
I've received an example on how to do that that uses, I believe, the WinScp command:
open ftpes://SomeUser:SomePass@SomeDomain.com/ -certificate="xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
The question is how to use the -certificate
part in an application? Do I have to save the string in a file or...?
For example if we use C#'s FtpWebRequest:
FtpWebRequest ftp = (FtpWebRequest)WebRequest.Create(downlaodLocation);
how can we use this fingerprint?
X509Certificate class has a constructor that accepts byte[].
byte[] toBytes = Encoding.ASCII.GetBytes("xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx");
ftp.ClientCertificates.Add(new X509Certificate(toBytes));
Is this the right way to use the certificate fingerprint?