Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
2.4k views
in .NET FTP by (220 points)
I work with an application that is implementing SFTP/FTPS. The client private keys are loaded by the user for the connection and stored in a database (encrypted AND compressed) by a client application.

I am attempting to implement the SFTP feature. I get the client private key data from the server (the entire contents of the file). I convert it to a byte array and then load it into the SecureFTPConnection.ClientPrivateKeyBytes property using System.Buffer.BlockCopy(). No matter which file format I receive (PuTTY, OpenSSH or SSH.com), I get the following error when I attempt to connect:

Request failed: Failed to recognize key format. Supported formats are OpenSSH, SSH.com and PuTTY.


What data specifically should get put into the ClientPrivateKeyBytes property? Should it include the key's header/footer information? Should it include newline characters?

...Glenn

2 Answers

0 votes
by (162k points)
It should just be the contents of the file. Have you written those bytes to a file and verified that they work?
0 votes
by (220 points)
It should just be the contents of the file. Have you written those bytes to a file and verified that they work?


If found out that the issue was a result of using String.ToCharArray(), which outputs the string as a Unicode byte array rather than an ASCII char byte array.

Categories

...