tags:

views:

125

answers:

0

I am trying to implement FTP over SSL to upload encrypted files. I've created a SSL certificate and send it to the vendor. But I couldn't make a FTPS connection to the server. When connecting via FTPS, I'm authenticating using my private key file.

I have tried .NET FTPWebRequest, SmartFTp,CuteFTP Pro.

I am getting the following error:-

A call to SSPI failed. See inner exception.

The inner exception is "The token supplied to the function is invalid"

        FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create("ftp://RemoteHost.Com");
        request.Credentials = new NetworkCredential("UserName", "Password");
        request.KeepAlive = false;
        request.EnableSsl = true;
        X509Certificate2 cert2 = new X509Certificate2("PrivateKeyFile.pfx", "password");             
        request.ClientCertificates.Add(cert2);               
        FtpWebResponse response = (FtpWebResponse)request.GetResponse();

Any Help Appreciated.

Thanks.