WebDAV with untrusted SSL cert from .Net

Advertisement

semery
Joined:
Posts:
2

WebDAV with untrusted SSL cert from .Net

WinSCP version: 5.7 (https://winscp.net/download/winscp570automation.zip)

I am trying to connect to a WebDAV server with a self-signed certificate using the .Net assembly. I can connect to the same server with the WebDAV protocol on a different port (and with the WinSCP GUI) without SSL but I can't figure out the correct options to set to get SSL working.

If I don't supply the server's host certificate fingerprint, I get the error (as expected):
WinSCP.SessionRemoteException: Server certificate verification failed: certificate issued for a different hostname, issuer is not trusted ---> WinSCP.SessionRemoteException: Connection failed.    
If I supply the certificate fingerprint with SessionOptions.TlsHostCertificateFingerprint, I get the error:
System.ArgumentException: SessionOptions.TlsHostCertificateFingerprint or SessionOptions.GiveUpSecurityAndAcceptAnyTlsHostCertificate is set, but SessionOptions.FtpSecure is FtpSecure.None.    
So then if I set SessionOptions.FtpSecure to FtpSecure.Implicit, I get the error:
System.ArgumentException: SessionOptions.FtpSecure is not FtpSecure.None, but SessionOptions.Protocol is not Protocol.Ftp.    
Is there anything else I can try?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Re: WebDAV with untrusted SSL cert from .Net

Thanks for your report.

That's a bug, will fix it.

Meanwhile, you can download source code of WinSCP and modify the check in Session.SessionOptionsToOpenSwitches.

Instead of
if (sessionOptions.FtpSecure == FtpSecure.None)
use
if ((sessionOptions.FtpSecure == FtpSecure.None) && !sessionOptions.WebdavSecure)
_________________
Martin Prikryl

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

fvboegeld wrote:

I'm having the same issue with SSL webdav

Can i also give this dev version a try?
Sent.
_________________
Martin Prikryl

Reply with quote

kyle@...
Guest

Re: WebDAV with untrusted SSL cert from .Net

martin wrote:

Thanks for your report.

That's a bug, will fix it.

Meanwhile, you can download source code of WinSCP and modify the check in Session.SessionOptionsToOpenSwitches.

Instead of
if (sessionOptions.FtpSecure == FtpSecure.None)
use
if ((sessionOptions.FtpSecure == FtpSecure.None) && !sessionOptions.WebdavSecure)

Hi, can I have this version please.

Reply with quote

Peterpan
Guest

Re: WebDAV with untrusted SSL cert from .Net

martin wrote:

kyle@... wrote:

Hi, can I have this version please.
Just download the latest version, this has been fixed while ago:
https://winscp.net/tracker/show_bug.cgi?id=1284

I can't find the latest version to download. I went to download link (https://winscp.net/eng/download.php#download2), but that is the version modified on 6/3/2016, which is before the fixed one.
Please help.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Re: WebDAV with untrusted SSL cert from .Net

Peterpan wrote:

I can't find the latest version to download. I went to download link (https://winscp.net/eng/download.php#download2), but that is the version modified on 6/3/2016, which is before the fixed one.
Please help.
No idea what you mean. The bug was fixed in 5.7.1, which was released on 2015-03-25 (over a year ago). The current stable version is 5.7.7, released on 2016-03-06.

Reply with quote

Advertisement

You can post new topics in this forum