Topic "TLS connection error/bug"

Author Message
robbone
[View user's profile]

Joined: 2015-04-15
Posts: 2
I'm trying to do a TLS connection using .NET library in C#, but I'm receivin a SSH error, it seems a bug.

Here my code:
Code:
SessionOptions sessionOptions = new SessionOptions();
                sessionOptions.HostName = _hostName;
                sessionOptions.Password = _password;
                sessionOptions.UserName = _userName;
                sessionOptions.Protocol = Protocol.Ftp;
                sessionOptions.FtpSecure = FtpSecure.Implicit;
                sessionOptions.PortNumber = 990;
                sessionOptions.FtpMode = FtpMode.Passive;


If I set:
Code:
sessionOptions.GiveUpSecurityAndAcceptAnyTlsHostCertificate = true;


I get the error:
Code:
System.ArgumentException: SessionOptions.SshHostKey or SessionOptions.GiveUpSecurityAndAcceptAnySshHostKey is set, but SessionOptions.Protocol is not Protocol.Sftp nor Protocol.Scp.


If I set:
Code:
sessionOptions.GiveUpSecurityAndAcceptAnySshHostKey


I get the same error above.

If I set:
Code:
sessionOptions.TlsHostCertificateFingerprint = "61:79:71...";


I get teh same error above, again

If I set
Code:
sessionOptions.SshHostKeyFingerprint = "61:79:71..."


I get the error:
Code:
System.ArgumentException: SSH host key fingerprint "61:79:71..." does not match pattern /((ssh-rsa|ssh-dss)( |-))?(\d+ )?([0-9a-f]{2}(:|-)){15}[0-9a-f]{2}(;((ssh-rsa|ssh-dss)( |-))?(\d+ )?([0-9a-f]{2}(:|-)){15}[0-9a-f]{2})*/


When I set TLS properties, the error says that I'm using SSH properties. So I believe it is a bug.

Can anyone help me?
Advertisements
Guest




I tested with versions 5.7.0 and 5.7.2

robbone wrote:
I'm trying to do a TLS connection using .NET library in C#, but I'm receivin a SSH error, it seems a bug.

Here my code:
Code:
SessionOptions sessionOptions = new SessionOptions();
                sessionOptions.HostName = _hostName;
                sessionOptions.Password = _password;
                sessionOptions.UserName = _userName;
                sessionOptions.Protocol = Protocol.Ftp;
                sessionOptions.FtpSecure = FtpSecure.Implicit;
                sessionOptions.PortNumber = 990;
                sessionOptions.FtpMode = FtpMode.Passive;


If I set:
Code:
sessionOptions.GiveUpSecurityAndAcceptAnyTlsHostCertificate = true;


I get the error:
Code:
System.ArgumentException: SessionOptions.SshHostKey or SessionOptions.GiveUpSecurityAndAcceptAnySshHostKey is set, but SessionOptions.Protocol is not Protocol.Sftp nor Protocol.Scp.


If I set:
Code:
sessionOptions.GiveUpSecurityAndAcceptAnySshHostKey


I get the same error above.

If I set:
Code:
sessionOptions.TlsHostCertificateFingerprint = "61:79:71...";


I get teh same error above, again

If I set
Code:
sessionOptions.SshHostKeyFingerprint = "61:79:71..."


I get the error:
Code:
System.ArgumentException: SSH host key fingerprint "61:79:71..." does not match pattern /((ssh-rsa|ssh-dss)( |-))?(\d+ )?([0-9a-f]{2}(:|-)){15}[0-9a-f]{2}(;((ssh-rsa|ssh-dss)( |-))?(\d+ )?([0-9a-f]{2}(:|-)){15}[0-9a-f]{2})*/


When I set TLS properties, the error says that I'm using SSH properties. So I believe it is a bug.

Can anyone help me?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
With this code, I'm not getting any exception:

Code:
SessionOptions sessionOptions = new SessionOptions();
sessionOptions.HostName = "localhost";
sessionOptions.Password = "test";
sessionOptions.UserName = "test";
sessionOptions.Protocol = Protocol.Ftp;
sessionOptions.FtpSecure = FtpSecure.Implicit;
sessionOptions.PortNumber = 990;
sessionOptions.FtpMode = FtpMode.Passive;
sessionOptions.GiveUpSecurityAndAcceptAnyTlsHostCertificate = true;

using (Session session = CreateSession())
{
    session.Open(sessionOptions);
}


Neither with this code:

Code:
SessionOptions sessionOptions = new SessionOptions();
sessionOptions.HostName = "localhost";
sessionOptions.Password = "test";
sessionOptions.UserName = "test";
sessionOptions.Protocol = Protocol.Ftp;
sessionOptions.FtpSecure = FtpSecure.Implicit;
sessionOptions.PortNumber = 990;
sessionOptions.FtpMode = FtpMode.Passive;
sessionOptions.TlsHostCertificateFingerprint = "a0:cd:69:37:d2:f6:d3:ee:a7:5d:39:3d:e7:5e:36:f4:9a:83:45:60";

using (Session session = CreateSession())
{
    session.Open(sessionOptions);
}


Both with 5.7.2.

Please show us your exact complete code that produces the exception.
_________________
Martin Prikryl
jyothi

Guest


SSHkey which is using in the code seems to wrong ,please Provide the correct key then this error will be gone
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License