issue with provided public key

Advertisement

DirtyHowi
Joined:
Posts:
1
Location:
planet earth

issue with provided public key

I am trying to interface with a partner FTP site using SFTP, I've gotten the winscp package for .net.

code looks like

        protected void UploadViaWINSCP()
        {
            var sessionOptions = new SessionOptions
            {
                Protocol = Protocol.Sftp,
                HostName = ConfigurationManager.AppSettings["Host"],
                UserName = ConfigurationManager.AppSettings["username"],
                Password = ConfigurationManager.AppSettings["password"],
                SshHostKeyFingerprint = "ssh-rsa 1024 xx:xx:xx:xx etc",
                PortNumber = 22
            };
            var localfilename = @"~/DataStore/" + ViewState["FileName"];
            var remotefilename = Path.GetFileName(localfilename);
            using (var session = new Session())
            {
                session.DisableVersionCheck = true;
                session.Open(sessionOptions);  //gets here and crashes
                TransferOptions transfer = new TransferOptions();
                transfer.TransferMode = TransferMode.Binary;
                TransferOperationResult transferrResult;
                transferrResult = session.PutFiles(localfilename, remotefilename, false, transfer);
                transferrResult.Check();
            }
        }

see comment line above...it gets to the session.open(sessionoptions) and kicks back with server said public key, which i have in a .pub file (both server and other). How do i use the public key file provided by the trading partner to upload a file to them, basically on demand, this is part of a larger asp.net project, 4.5 framework.

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum