Free Support Forum - aspose.com

How to set passphrase parameter for SFTPClient

I need to connect to a server using SFTP and need to pass the following parameters:
- user
- private key
- passphrase

I haven't found any means to set the passphrase. Is this supported in the current version?

Best regards

Hi,

Thank you for inquiry.

It requires an instance of AuthenticationInfo class for user credentials. Please refer to http://www.aspose.com/documentation/.net-components/aspose.network-for-.net/connect-to-secure-ftp-server-using-sftp.html page for sample code and documentation.

I have seen this example already and still cannot see any option to set the passphrase. I do not mean the password to authenticate with the server, but the passphrase for the key file. Can this be passed in code as well?

Hi,

The private key is loaded using the below line:
authenticationInfo.LoadPrivateKey(@“path\ssh.key”);
The file is in OpenSSH format, it contains only the private key and is un-encrypted, therefore no passphrase is required to load the private key.