Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# ssh.net不接受DSA密钥类型_C#_.net_Ssh - Fatal编程技术网

C# ssh.net不接受DSA密钥类型

C# ssh.net不接受DSA密钥类型,c#,.net,ssh,C#,.net,Ssh,我正在使用SSH.NET的nuget库,我打算做一个SFTP连接来检索和上传数据。但是,我遇到了一个问题,那就是我收到了一个无效的私钥文件。错误 这是我的私钥文件字符串: PuTTY-User-Key-File-2: ssh-dss Encryption: none Comment: dsa-key-20160523 Public-Lines: 18 AA ------some key----------NAZiN8jDuiBte7MPV7 F6s= Private-Lines:

我正在使用SSH.NET的nuget库,我打算做一个SFTP连接来检索和上传数据。但是,我遇到了一个问题,那就是我收到了一个
无效的私钥文件。
错误

这是我的私钥文件字符串:

PuTTY-User-Key-File-2: ssh-dss
Encryption: none
Comment: dsa-key-20160523
Public-Lines: 18
AA         ------some key----------NAZiN8jDuiBte7MPV7
F6s=
Private-Lines: 1
AAAAFDfhoQV18cCh6cVFcNcvRoqdXPXI
Private-MAC: f06d16402bbe702c0f27bd43290e12c6954f02d5
这是我的代码:

var keyFile = new PrivateKeyFile(ConfigurationManager.AppSettings["SFTPKeyLocation"]);
var keyFiles = new[] { keyFile };
#region define sftp connection
var methods = new List<AuthenticationMethod>();
var connectionInfo = new ConnectionInfo(ConfigurationManager.AppSettings["SFTPHost"],
                 ConfigurationManager.AppSettings["SFTPUser"],
                new PrivateKeyAuthenticationMethod(ConfigurationManager.AppSettings["SFTPUser"], keyFiles));

var sftp = new SftpClient(connectionInfo);
var-keyFile=new-PrivateKeyFile(ConfigurationManager.AppSettings[“SFTPKeyLocation]”);
var keyFiles=new[]{keyFile};
#区域定义sftp连接
var方法=新列表();
var connectionInfo=new connectionInfo(ConfigurationManager.AppSettings[“SFTPHost”],
ConfigurationManager.AppSettings[“SFTPUser”],
新的PrivateKeyAuthenticationMethod(ConfigurationManager.AppSettings[“SFTPUser”],keyFiles));
var sftp=新的SftpClient(connectionInfo);
为什么我得到了无效的私钥错误?我可以确保这个密钥是有效的,因为它成功地在其他地方进行了SFTP